Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbowers committed Jun 30, 2019
1 parent c266d6c commit 6c49a0c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -2427,6 +2427,18 @@ public function testTrustedPort()

$this->assertSame(443, $request->getPort());
}

public function testTrustedPortDoesNotDefaultToZero()
{
Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL);

$request = Request::create('/');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$request->headers->set('X-Forwarded-Host', 'test.example.com');
$request->headers->set('X-Forwarded-Port', null);

$this->assertSame(80, $request->getPort());
}
}

class RequestContentProxy extends Request
Expand Down

0 comments on commit 6c49a0c

Please sign in to comment.