8000 bug #15263 [HttpFoundation] fixed the check of 'proxy-revalidate' in … · symfony/symfony@328ec01 · GitHub
[go: up one dir, main page]

Skip to content

Commit 328ec01

Browse files
committed
bug #15263 [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate() (axiac)
This PR was squashed before being merged into the 2.3 branch (closes #15263). Discussion ---------- [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate() | Q | A | ------------- | --- | Fixed tickets | #15262 | License | MIT 'proxy-revalidate' is not a header on its own but a 'Cache-Control' directive See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 Commits ------- 6c22f0a [HttpFoundation] fixed the check of 'proxy-revalidate' in Response::mustRevalidate()
2 parents e5909be + 6c22f0a commit 328ec01

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ public function setPublic()
587587
*/
588588
public function mustRevalidate()
589589
{
590-
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate');
590+
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
591591
}
592592

593593
/**

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ public function testMustRevalidate()
9292
$this->assertFalse($response->mustRevalidate());
9393
}
9494

95+
public function testMustRevalidateWithMustRevalidateCacheControlHeader()
96+
{
97+
$response = new Response();
98+
$response->headers->set('cache-control', 'must-revalidate');
99+
100+
$this->assertTrue($response->mustRevalidate());
101+
}
102+
103+
public function testMustRevalidateWithProxyRevalidateCacheControlHeader()
104+
{
105+
$response = new Response();
106+
$response->headers->set('cache-control', 'proxy-revalidate');
107+
108+
$this->assertTrue($response->mustRevalidate());
109+
}
110+
95111
public function testSetNotModified()
96112
{
97113
$response = new Response();

0 commit comments

Comments
 (0)
0