[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/EventListener/ -> ValidateRequestListener.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\HttpKernel\EventListener;
  13  
  14  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15  use Symfony\Component\HttpKernel\Event\GetResponseEvent;
  16  use Symfony\Component\HttpKernel\KernelEvents;
  17  
  18  /**
  19   * Validates that the headers and other information indicating the
  20   * client IP address of a request are consistent.
  21   *
  22   * @author Magnus Nordlander <magnus@fervo.se>
  23   */
  24  class ValidateRequestListener implements EventSubscriberInterface
  25  {
  26      /**
  27       * Performs the validation.
  28       */
  29      public function onKernelRequest(GetResponseEvent $event)
  30      {
  31          if (!$event->isMasterRequest()) {
  32              return;
  33          }
  34          $request = $event->getRequest();
  35  
  36          if ($request::getTrustedProxies()) {
  37              // This will throw an exception if the headers are inconsistent.
  38              $request->getClientIps();
  39          }
  40      }
  41  
  42      /**
  43       * {@inheritdoc}
  44       */
  45      public static function getSubscribedEvents()
  46      {
  47          return array(
  48              KernelEvents::REQUEST => array(
  49                  array('onKernelRequest', 256),
  50              ),
  51          );
  52      }
  53  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1