protected function initializeSettings(Request
$request) { $site_path =
static::
findSitePath($request);
$this->
setSitePath($site_path);
Settings::
initialize($this->root,
$site_path,
$this->classLoader
);
// Initialize our list of trusted HTTP Host headers to protect against
// header attacks.
$host_patterns = Settings::
get('trusted_host_patterns',
[]);
if (PHP_SAPI !== 'cli' && !
empty($host_patterns)) { if (static::
setupTrustedHosts($request,
$host_patterns) === FALSE
) { throw new BadRequestHttpException('The provided host name is not valid for this server.'
);
} } } /**
* Bootstraps the legacy global request variables.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request.
*
* @todo D8: Eliminate this entirely in favor of Request object.
*/