Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6756ad

Browse filesBrowse 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
Copy full SHA for f6756ad

File tree

Expand file treeCollapse file tree

1 file changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+20Lines changed: 20 additions & 0 deletions
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+
}
990+
971991
public function getClientIpsWithConflictingHeadersProvider()
972992
{
973993
// $httpForwarded $httpXForwardedFor

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.