Skip to content

Commit 07708c6

Browse files
Merge branch '3.0' into 3.1
* 3.0: [HttpKernel] fixed internal subrequests having an if-modified-since-header [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener [Validator] Added additional MasterCard range to the CardSchemeValidator Make the exception message more clear. [Form] fixed bug - name in ButtonBuilder [DoctrineBridge] added missing error code for constraint. [ClassLoader] Fix declared classes being computed when not needed [varDumper] Fix missing usage of ExceptionCaster::$traceArgs
2 parents a6215a1 + e306e61 commit 07708c6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Fragment/InlineFragmentRenderer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ protected function createSubRequest($uri, Request $request)
129129
}
130130

131131
$server['REMOTE_ADDR'] = '127.0.0.1';
132+
unset($server['HTTP_IF_MODIFIED_SINCE']);
133+
unset($server['HTTP_IF_NONE_MATCH']);
132134

133135
$subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server);
134136
if ($request->headers->has('Surrogate-Capability')) {

Tests/Fragment/InlineFragmentRendererTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled()
226226

227227
Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, $trustedHeaderName);
228228
}
229+
230+
public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest()
231+
{
232+
$expectedSubRequest = Request::create('/');
233+
if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) {
234+
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
235+
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
236+
}
237+
238+
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
239+
$request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*'));
240+
$strategy->render('/', $request);
241+
}
229242
}
230243

231244
class Bar

0 commit comments

Comments
 (0)