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

Breadcrumb

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

function Request::updateHostFromUri

1 call to Request::updateHostFromUri()
Request::__construct in vendor/guzzlehttp/psr7/src/Request.php

File

vendor/guzzlehttp/psr7/src/Request.php, line 127

Class

Request
PSR-7 request implementation.

Namespace

GuzzleHttp\Psr7

Code

private function updateHostFromUri() : void {
    $host = $this->uri
        ->getHost();
    if ($host == '') {
        return;
    }
    if (($port = $this->uri
        ->getPort()) !== null) {
        $host .= ':' . $port;
    }
    if (isset($this->headerNames['host'])) {
        $header = $this->headerNames['host'];
    }
    else {
        $header = 'Host';
        $this->headerNames['host'] = 'Host';
    }
    // Ensure Host is the first header.
    // See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4
    $this->headers = [
        $header => [
            $host,
        ],
    ] + $this->headers;
}

API Navigation

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