10000 bug #25623 [HttpFoundation] Fix false-positive ConflictingHeadersExce… · dunglas/symfony@f6756ad · GitHub
[go: up one dir, main page]

Skip to content

Commit f6756ad

Browse files
bug symfony#25623 [HttpFoundation] Fix false-positive ConflictingHeadersException (nicolas-grekas)
This PR was merged into the 3.3 branch. Discussion ---------- [HttpFoundation] Fix false-positive ConflictingHeadersException | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#25543 | License | MIT | Doc PR | - Commits ------- e1591bd [HttpFoundation] Fix false-positive ConflictingHeadersException
2 parents f20515a + e1591bd commit f6756ad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,26 @@ public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXFor
968968
$request->getClientIps();
969969
}
970970

971+
/**
972+
* @dataProvider getClientIpsWithConflictingHeadersProvider
973+
*/
974+
public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $httpXForwardedFor)
975+
{
976+
$request = new Request();
977+
978+
$server = array(
979+
'REMOTE_ADDR' => '88.88.88.88',
980+
'HTTP_FORWARDED' => $httpForwarded,
981+
'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
982+
);
983+
984+
Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR);
985+
986+
$request->initialize(array(), array(), array(), array(), array(), $server);
987+
988+
$this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps());
989+
}
4AC4 990+
971991
public function getClientIpsWithConflictingHeadersProvider()
972992
{
973993
// $httpForwarded $httpXForwardedFor

0 commit comments

Comments
 (0)
0