8000 leave cache-control no-cache as is by ewgRa · Pull Request #16307 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

leave cache-control no-cache as is #16307

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

Closed
wants to merge 3 commits into from
Closed
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
leave cache-control no-cache as is (#16171)
  • Loading branch information
ewgRa committed Oct 21, 2015
commit 65ce43da210ac94ad639a127e0aa7c58c80f573e
8 changes: 2 additions & 6 deletions src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,8 @@ protected function computeCacheControlValue()
}

$header = $this->getCacheControlHeader();
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
return $header;
}

// public if s-maxage is defined, private otherwise
if (!isset($this->cacheControl['s-maxage'])) {
// private, if s-maxage is not defined, public/private is not set, and this is not "no-cache"
if (!isset($this->cacheControl['s-maxage']) && !isset($this->cacheControl['public']) && !isset($this->cacheControl['private']) && !isset($this->cacheControl['no-cache'])) {
return $header.', private';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function provideAllPreserveCase()
array('fOo' => 'BAR'),
array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache')),
),
array(
array('fOo' => 'BAR', 'Cache-Control' => array('no-cache')),
array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache')),
),
array(
array('ETag' => 'xyzzy'),
array('ETag' => array('xyzzy'), 'Cache-Control' => array('private, must-revalidate')),
Expand Down Expand Up @@ -142,6 +146,15 @@ public function testReplace()
$bag->replace(array('Cache-Control' => 'public'));
$this->assertEquals('public', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('public'));

$bag = new ResponseHeaderBag(array('Etag' => 'aaaa'));
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('private'));
$this->assertTrue($bag->hasCacheControlDirective('must-revalidate'));

$bag->replace(array());
$this->assertEquals('no-cache', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('no-cache'));
}

public function testReplaceWithRemove()
Expand Down
0