8000 [HttpFoundation] Do not append "private" to "no-cache" in the Cache-C… · symfony/symfony@1abae71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1abae71

Browse files
committed
[HttpFoundation] Do not append "private" to "no-cache" in the Cache-Control header
1 parent 675bace commit 1abae71

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected function computeCacheControlValue()
288288
}
289289

290290
$header = $this->getCacheControlHeader();
291-
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
291+
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private']) || isset($this->cacheControl['no-cache'])) {
292292
return $header;
293293
}
294294

src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function provideAllPreserveCase()
3636
array('fOo' => 'BAR'),
3737
array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache')),
3838
),
39+
array(
40+
array('fOo' => 'BAR', 'Cache-Control' => array('no-cache')),
41+
array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache')),
42+
),
3943
array(
4044
array('ETag' => 'xyzzy'),
4145
array('ETag' => array('xyzzy'), 'Cache-Control' => array('private, must-revalidate')),
@@ -63,6 +67,14 @@ public function provideAllPreserveCase()
6367
);
6468
}
6569

70+
public function testHeadersArePreserved()
71+
{
72+
$bag1 = new ResponseHeaderBag(array('test'));
73+
$bag2 = new ResponseHeaderBag($bag1->allPreserveCase());
74+
75+
$this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase());
76+
}
77+
6678
public function testCacheControlHeader()
6779
{
6880
$bag = new ResponseHeaderBag(array());

0 commit comments

Comments
 (0)
0