public function Request::setPort

Set the port that the request will be sent on

Parameters

int $port Port number to set:

Return value

RequestInterface

Overrides RequestInterface::setPort

2 calls to Request::setPort()
Request::setHost in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Request.php
Set the host of the request. Including a port in the host will modify the port of the request.
Request::setUrl in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Request.php
Set the URL of the request

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Request.php, line 375

Class

Request
HTTP request class to send requests

Namespace

Guzzle\Http\Message

Code

public function setPort($port) {
  $this->url
    ->setPort($port);

  // Include the port in the Host header if it is not the default port for the scheme of the URL
  $scheme = $this->url
    ->getScheme();
  if ($scheme == 'http' && $port != 80 || $scheme == 'https' && $port != 443) {
    $this->headers['host'] = new Header('Host', $this->url
      ->getHost() . ':' . $port);
  }
  else {
    $this->headers['host'] = new Header('Host', $this->url
      ->getHost());
  }
  return $this;
}