[HttpFoundation] added missing trustProxy condition

This commit is contained in:
Kris Wallsmith 2012-01-13 11:05:57 -08:00
parent 02a12b2c5c
commit d67d419f3c

View File

@ -562,7 +562,11 @@ class Request
*/ */
public function getPort() 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');
}
} }
/** /**