summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php')
-rw-r--r--core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
new file mode 100644
index 0000000..b327753
--- /dev/null
+++ b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\PageCache\DefaultRequestPolicy.
+ */
+
+namespace Drupal\Core\PageCache;
+
+/**
+ * The default page cache request policy.
+ *
+ * Delivery of cached pages is denied if either the application is running from
+ * the command line or the request was not initiated with a safe method (GET or
+ * HEAD). Also caching is only allowed for requests without a session cookie.
+ */
+class DefaultRequestPolicy extends ChainRequestPolicy {
+
+ /**
+ * Constructs the default page cache request policy.
+ */
+ public function __construct() {
+ $this->addPolicy(new RequestPolicy\CommandLineOrUnsafeMethod());
+ $this->addPolicy(new RequestPolicy\NoSessionOpen());
+ }
+
+}