Skip to content

Commit d97a656

Browse files
Merge branch '4.4' into 5.3
* 4.4: Fix composer.json versions Fix composer.json versions Remove redundant license info [HttpFoundation] Fix isNotModified determination logic Fix Url Validator false positives [Translation] Reverse fallback locales [FrameworkBundle] Fall back to default configuration in debug:config and consistently resolve parameter values allow null for framework.translator.default_path improve failure messages of the CrawlerSelectorTextContains constraint
2 parents 45dd825 + 63f453f commit d97a656

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

HttpCache/HttpCache.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
*
66
* (c) Fabien Potencier <fabien@symfony.com>
77
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
/*
813
* This code is partially based on the Rack-Cache library by Ryan Tomayko,
914
* which is released under the MIT license.
1015
* (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801)
11-
*
12-
* For the full copyright and license information, please view the LICENSE
13-
* file that was distributed with this source code.
1416
*/
1517

1618
namespace Symfony\Component\HttpKernel\HttpCache;
@@ -382,7 +384,7 @@ protected function validate(Request $request, Response $entry, bool $catch = fal
382384

383385
// add our cached last-modified validator
384386
if ($entry->headers->has('Last-Modified')) {
385-
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
387+
$subRequest->headers->set('If-Modified-Since', $entry->headers->get('Last-Modified'));
386388
}
387389

388390
// Add our cached etag validator to the environment.
@@ -391,7 +393,7 @@ protected function validate(Request $request, Response $entry, bool $catch = fal
391393
$cachedEtags = $entry->getEtag() ? [$entry->getEtag()] : [];
392394
$requestEtags = $request->getETags();
393395
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
394-
$subRequest->headers->set('if_none_match', implode(', ', $etags));
396+
$subRequest->headers->set('If-None-Match', implode(', ', $etags));
395397
}
396398

397399
$response = $this->forward($subRequest, $catch, $entry);
@@ -444,8 +446,8 @@ protected function fetch(Request $request, bool $catch = false)
444446
}
445447

446448
// avoid that the backend sends no content
447-
$subRequest->headers->remove('if_modified_since');
448-
$subRequest->headers->remove('if_none_match');
449+
$subRequest->headers->remove('If-Modified-Since');
450+
$subRequest->headers->remove('If-None-Match');
449451

450452
$response = $this->forward($subRequest, $catch);
451453

Tests/HttpCache/HttpCacheTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testRespondsWith304WhenIfNoneMatchMatchesETag()
156156
$this->assertTraceContains('store');
157157
}
158158

159-
public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch()
159+
public function testRespondsWith304WhenIfNoneMatchAndIfModifiedSinceBothMatch()
160160
{
161161
$time = \DateTime::createFromFormat('U', time());
162162

@@ -172,7 +172,7 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch(
172172
$t = \DateTime::createFromFormat('U', time() - 3600);
173173
$this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(\DATE_RFC2822)]);
174174
$this->assertHttpKernelIsCalled();
175-
$this->assertEquals(200, $this->response->getStatusCode());
175+
$this->assertEquals(304, $this->response->getStatusCode());
176176

177177
// only Last-Modified matches
178178
$this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(\DATE_RFC2822)]);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/error-handler": "^4.4|^5.0",
2222
"symfony/event-dispatcher": "^5.0",
2323
"symfony/http-client-contracts": "^1.1|^2",
24-
"symfony/http-foundation": "^5.3",
24+
"symfony/http-foundation": "^5.3.7",
2525
"symfony/polyfill-ctype": "^1.8",
2626
"symfony/polyfill-php73": "^1.9",
2727
"symfony/polyfill-php80": "^1.16",

0 commit comments

Comments
 (0)