bug #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 | #25543
| License | MIT
| Doc PR | -
Commits
-------
e1591bd
[HttpFoundation] Fix false-positive ConflictingHeadersException
This commit is contained in:
commit
f6756adda8
@ -968,6 +968,26 @@ class RequestTest extends TestCase
|
||||
$request->getClientIps();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getClientIpsWithConflictingHeadersProvider
|
||||
*/
|
||||
public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $httpXForwardedFor)
|
||||
{
|
||||
$request = new Request();
|
||||
|
||||
$server = array(
|
||||
'REMOTE_ADDR' => '88.88.88.88',
|
||||
'HTTP_FORWARDED' => $httpForwarded,
|
||||
'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
|
||||
);
|
||||
|
||||
Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR);
|
||||
|
||||
$request->initialize(array(), array(), array(), array(), array(), $server);
|
||||
|
||||
$this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps());
|
||||
}
|
||||
|
||||
public function getClientIpsWithConflictingHeadersProvider()
|
||||
{
|
||||
// $httpForwarded $httpXForwardedFor
|
||||
|
Reference in New Issue
Block a user