8000 merged branch fturmel/patch-1 (PR #9038) · symfony/symfony@6a17a39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a17a39

Browse files
committed
merged branch fturmel/patch-1 (PR #9038)
This PR was submitted for the 2.3 branch but it was merged into the 2.2 branch instead (closes #9038). Discussion ---------- HttpFoundation Request : unit test to confirm #8619 issue fix Commits ------- ae4925b HttpFoundation RequestTest - Fixed indentation and removed comments 94ea510 HttpFoundation Request test for #8619
2 parents a94c0fd + 32fc4d8 commit 6a17a39

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,25 @@ public function testGetPort()
726726
$port = $request->getPort();
727727

728728
$this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.');
729+
730+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
731+
'HTTP_X_FORWARDED_PROTO' => 'On'
732+
));
733+
$port = $request->getPort();
734+
$this->assertEquals(443, $port, 'With only PROTO set and value is On, getPort() defaults to 443.');
735+
736+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
737+
'HTTP_X_FORWARDED_PROTO' => '1'
738+
));
739+
$port = $request->getPort();
740+
$this->assertEquals(443, $port, 'With only PROTO set and value is 1, getPort() defaults to 443.');
741+
742+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
743+
'HTTP_X_FORWARDED_PROTO' => 'something-else'
744+
));
745+
$port = $request->getPort();
746+
$this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
747+
729748
Request::setTrustedProxies(array());
730749
}
731750

0 commit comments

Comments
 (0)
0