Skip to content
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

[stable18] Proxy server could cache http response when it is not private #20955

Merged
merged 2 commits into from May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/public/AppFramework/Http/Response.php
Expand Up @@ -106,11 +106,11 @@ public function __construct() {
* @since 6.0.0 - return value was added in 7.0.0
*/
public function cacheFor(int $cacheSeconds) {
if($cacheSeconds > 0) {
$this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate');
if ($cacheSeconds > 0) {
$this->addHeader('Cache-Control', 'private, max-age=' . $cacheSeconds . ', must-revalidate');

// Old scool prama caching
$this->addHeader('Pragma', 'public');
$this->addHeader('Pragma', 'private');

// Set expires header
$expires = new \DateTime();
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/AppFramework/Http/ResponseTest.php
Expand Up @@ -268,7 +268,7 @@ public function testChainability() {
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus());
$this->assertEquals('hi', $this->childResponse->getEtag());
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
$this->assertEquals('max-age=33, must-revalidate',
$this->assertEquals('private, max-age=33, must-revalidate',
$headers['Cache-Control']);

}
Expand Down