8000 HttpFoundation Request test for #8619 · symfony/symfony@94ea510 · GitHub
[go: up one dir, main page]

Skip to content

Commit 94ea510

Browse files
committed
HttpFoundation Request test for #8619
1 parent e6d983c commit 94ea510

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,28 @@ public function testGetPort()
716716
$port = $request->getPort();
717717

718718
$this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.');
719+
720+
//On
721+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
722+
'HTTP_X_FORWARDED_PROTO' => 'On'
723+
));
724+
$port = $request->getPort();
725+
$this->assertEquals(443, $port, 'With only PROTO set and value is On, getPort() defaults to 443.');
726+
727+
//1
728+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
729+
'HTTP_X_FORWARDED_PROTO' => '1'
730+
));
731+
$port = $request->getPort();
732+
$this->assertEquals(443, $port, 'With only PROTO set and value is 1, getPort() defaults to 443.');
733+
734+
//something-else
735+
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
736+
'HTTP_X_FORWARDED_PROTO' => 'something-else'
737+
));
738+
$port = $request->getPort();
739+
$this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
740+
719741
Request::setTrustedProxies(array());
720742
}
721743

0 commit comments

Comments
 (0)
0