merged branch kriswallsmith/http/forwarded-port (PR #3111)

Commits
-------

d67d419 [HttpFoundation] added missing trustProxy condition

Discussion
----------

[HttpFoundation] check trust setting in getPort()

Added a missing `self::$trustProxy` check in `Request::getPort()`.

```
Bug fix: yes
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
```
This commit is contained in:
Fabien Potencier 2012-01-13 22:26:43 +01:00
commit 64bd058ba4

View File

@ -562,7 +562,11 @@ class Request
*/
public function getPort()
{
return $this->headers->get('X-Forwarded-Port') ?: $this->server->get('SERVER_PORT');
if (self::$trustProxy && $this->headers->has('X-Forwarded-Port')) {
return $this->headers->get('X-Forwarded-Port');
} else {
return $this->server->get('SERVER_PORT');
}
}
/**