TrustedHostsRequestFactory

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.

Hierarchy

See also

\Drupal\Core\DrupalKernel::setupTrustedHosts()

File

core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php, line 20

Namespace

Drupal\Core\Http

Members

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.
doc_Drupal
2016-10-29 09:49:34
Comments
Leave a Comment

Please login to continue.