/** * Create a new HTTP request. * * @param mixed $uri The absolute URI that has been requested. * @param string $method The HTTP request method being used. * @param string $protocol The HTTP protocol version being used. */ public function __construct($uri, $method = Http::METHOD_GET, $protocol = 'HTTP/1.1') { parent::__construct($protocol); $this->uri = new Uri($uri); $this->rawUri = '/' . (string) $this->uri->getPath(); if (count($this->uri->getQuery())) { $this->rawUri .= '?' . $this->uri->getQueryString(); } $this->setMethod($method); $this->setHeader('Host', $uri->getHost(true)); $this->setHeader('Connection', 'close'); }