You are here

function HTTP_Request::_generateHostHeader in Flickr API 5

Generates a Host header for HTTP/1.1 requests

@access private

Return value

string

2 calls to HTTP_Request::_generateHostHeader()
HTTP_Request::sendRequest in phpFlickr/PEAR/HTTP/Request.php
Sends the request
HTTP_Request::setURL in phpFlickr/PEAR/HTTP/Request.php
Sets the URL to be requested

File

phpFlickr/PEAR/HTTP/Request.php, line 360

Class

HTTP_Request
Class for performing HTTP requests

Code

function _generateHostHeader() {
  if ($this->_url->port != 80 and strcasecmp($this->_url->protocol, 'http') == 0) {
    $host = $this->_url->host . ':' . $this->_url->port;
  }
  elseif ($this->_url->port != 443 and strcasecmp($this->_url->protocol, 'https') == 0) {
    $host = $this->_url->host . ':' . $this->_url->port;
  }
  elseif ($this->_url->port == 443 and strcasecmp($this->_url->protocol, 'https') == 0 and strpos($this->_url->url, ':443') !== false) {
    $host = $this->_url->host . ':' . $this->_url->port;
  }
  else {
    $host = $this->_url->host;
  }
  return $host;
}