You are here

private function Request::updateHostFromUri in Lockr 7.3

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

File

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

Class

Request
PSR-7 request implementation.

Namespace

GuzzleHttp\Psr7

Code

private function updateHostFromUri() {
  $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: http://tools.ietf.org/html/rfc7230#section-5.4
  $this->headers = [
    $header => [
      $host,
    ],
  ] + $this->headers;
}