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 960faef

Browse filesBrowse files
mpdudestof
authored andcommitted
Avoid empty \"If-Modified-Since\" header in validation request
1 parent 8a68d2d commit 960faef
Copy full SHA for 960faef

File tree

2 files changed

+4
-1
lines changed
Filter options

2 files changed

+4
-1
lines changed

‎src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,9 @@ protected function validate(Request $request, Response $entry, $catch = false)
352352
}
353353

354354
// add our cached last-modified validator
355-
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
355+
if ($entry->headers->has('Last-Modified')) {
356+
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
357+
}
356358

357359
// Add our cached etag validator to the environment.
358360
// We keep the etags from the client to handle the case when the client

‎src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@ public function testValidatesCachedResponsesUseSameHttpMethod()
859859
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
860860
{
861861
$this->setNextResponse(200, [], 'Hello World', function ($request, $response) {
862+
$this->assertFalse($request->headers->has('If-Modified-Since'));
862863
$response->headers->set('Cache-Control', 'public');
863864
$response->headers->set('ETag', '"12345"');
864865
if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) {

0 commit comments

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