Provides a request factory for requests using host verification.
Because the trusted host patterns for requests are stored statically, they are consulted even for fake request created with Request::create(), whose host is 'localhost' by default. Such requests would fail host verification unless 'localhost' matches one of the trusted host patterns. To circumvent this problem, this factory injects the server variables from the main request into each newly created request, so that the host is correctly set even for fake requests and they properly pass host verification.
\Drupal\Core\DrupalKernel::setupTrustedHosts()
Name | Modifiers | Type | Description |
---|---|---|---|
TrustedHostsRequestFactory::$host | protected | property | The host of the main request. |
TrustedHostsRequestFactory::createRequest | public | function | Creates a new request object. |
TrustedHostsRequestFactory::__construct | public | function | Creates a new TrustedHostsRequestFactory. |
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Http!TrustedHostsRequestFactory.php/class/TrustedHostsRequestFactory/8.1.x