Skip to content

ResponseHeaderBag #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
3 commits merged into from
Feb 22, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[HttpFoundation] updated ResponseHeaderBag to compute Cache-Control w…
…henever any of the headers it considers changes
  • Loading branch information
kriswallsmith committed Feb 22, 2011
commit a0bae94f882966cc60707b8a0b55ca1cd6e6029c
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function set($key, $values, $replace = true)
parent::set($key, $values, $replace);

// ensure the cache-control header has sensible defaults
if ('cache-control' === strtr(strtolower($key), '_', '-')) {
if (in_array(strtr(strtolower($key), '_', '-'), array('cache-control', 'etag', 'last-modified', 'expires'))) {
$computed = $this->computeCacheControlValue();
$this->headers['cache-control'] = array($computed);
$this->computedCacheControl = $this->parseCacheControl($computed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@ public function testCacheControlHeader()

$bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100'));
$this->assertEquals('max-age=100, public', $bag->get('Cache-Control'));

$bag = new ResponseHeaderBag();
$bag->set('Last-Modified', 'abcde');
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy