Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / PageCache / DefaultRequestPolicy.php
1 <?php
2
3 namespace Drupal\Core\PageCache;
4
5 use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
6 use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
7 use Drupal\Core\Session\SessionConfigurationInterface;
8
9 /**
10  * The default page cache request policy.
11  *
12  * Delivery of cached pages is denied if either the application is running from
13  * the command line or the request was not initiated with a safe method (GET or
14  * HEAD). Also caching is only allowed for requests without a session cookie.
15  */
16 class DefaultRequestPolicy extends ChainRequestPolicy {
17
18   /**
19    * Constructs the default page cache request policy.
20    *
21    * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
22    *   The session configuration.
23    */
24   public function __construct(SessionConfigurationInterface $session_configuration) {
25     $this->addPolicy(new CommandLineOrUnsafeMethod());
26     $this->addPolicy(new NoSessionOpen($session_configuration));
27   }
28
29 }