Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DrupalKernel.php

function DrupalKernel::initializeSettings

Locate site path and initialize settings singleton.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request.

Throws

\Symfony\Component\HttpKernel\Exception\BadRequestHttpException In case the host name in the request is not trusted.

2 calls to DrupalKernel::initializeSettings()
DrupalKernel::handle in core/lib/Drupal/Core/DrupalKernel.php
Handles a Request to convert it to a Response.
UpdateKernel::handle in core/lib/Drupal/Core/Update/UpdateKernel.php
Handles a Request to convert it to a Response.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1055

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

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.');
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal