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:
commit
64bd058ba4
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user