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()
This commit is contained in:
Christophe Coevoet 2015-08-03 19:22:19 +02:00
commit 328ec0133e
2 changed files with 17 additions and 1 deletions

View File

@ -587,7 +587,7 @@ class Response
*/
public function mustRevalidate()
{
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate');
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
}
/**

View File

@ -92,6 +92,22 @@ class ResponseTest extends ResponseTestCase
$this->assertFalse($response->mustRevalidate());
}
public function testMustRevalidateWithMustRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'must-revalidate');
$this->assertTrue($response->mustRevalidate());
}
public function testMustRevalidateWithProxyRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'proxy-revalidate');
$this->assertTrue($response->mustRevalidate());
}
public function testSetNotModified()
{
$response = new Response();