Skip to content

Commit

Permalink
[RequestHandler] changed Request to use the headers bag when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 25, 2010
1 parent 038f7d7 commit ee799f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Symfony/Components/RequestHandler/Request.php
Expand Up @@ -128,10 +128,10 @@ static public function createFromUri($uri, $method = 'get', $parameters = array(
}

$server = array_replace(array(
'HTTP_HOST' => 'localhost',
'SERVER_NAME' => 'localhost',
'SERVER_PORT' => 80,
'HTTP_USER_AGENT' => 'SymfonyClient/1.0',
'HTTP_HOST' => 'localhost',
'HTTP_USER_AGENT' => 'Symfony/X.X',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
Expand Down Expand Up @@ -280,9 +280,9 @@ public function isSecure()
return (
(strtolower($this->server->get('HTTPS')) == 'on' || $this->server->get('HTTPS') == 1)
||
(strtolower($this->server->get('HTTP_SSL_HTTPS')) == 'on' || $this->server->get('HTTP_SSL_HTTPS') == 1)
(strtolower($this->headers->get('SSL_HTTPS')) == 'on' || $this->headers->get('SSL_HTTPS') == 1)
||
(strtolower($this->server->get('HTTP_X_FORWARDED_PROTO')) == 'https')
(strtolower($this->headers->get('X_FORWARDED_PROTO')) == 'https')
);
}

Expand All @@ -293,15 +293,15 @@ public function isSecure()
*/
public function getHost()
{
if ($host = $this->server->get('HTTP_X_FORWARDED_HOST'))
if ($host = $this->headers->get('X_FORWARDED_HOST'))
{
$elements = implode(',', $host);

return trim($elements[count($elements) - 1]);
}
else
{
return $this->server->get('HTTP_HOST', $this->server->get('SERVER_NAME', $this->server->get('SERVER_ADDR', '')));
return $this->headers->get('HOST', $this->server->get('SERVER_NAME', $this->server->get('SERVER_ADDR', '')));
}
}

Expand Down

0 comments on commit ee799f6

Please sign in to comment.