"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php" (26 Nov 2020, 972 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "DefaultRequestPolicy.php" see the Fossies "Dox" file reference documentation.

    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 }