Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-05-13 09:27:05 +0300
committerGitHub <noreply@github.com>2020-05-13 09:27:05 +0300
commit4fbea316a7eab0104f088a53edd61a70615e355e (patch)
treed008cdd8bb21783958e45671882f5c87686be496 /lib
parentab2df70e3ac0d8216c1986cc64aff83c215f1add (diff)
parent979dd1b6f5d4bd82120a821c8f6b8e7773921b15 (diff)
Merge pull request #20897 from nextcloud/bugfix/httpcache
Proxy server could cache http response when it is not private
Diffstat (limited to 'lib')
-rw-r--r--lib/public/AppFramework/Http/Response.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index a48580c789d..6f418e42553 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -105,12 +105,11 @@ class Response {
* @return $this
* @since 6.0.0 - return value was added in 7.0.0
*/
- public function cacheFor(int $cacheSeconds) {
+ public function cacheFor(int $cacheSeconds, bool $public = false) {
if ($cacheSeconds > 0) {
- $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate');
-
- // Old scool prama caching
- $this->addHeader('Pragma', 'public');
+ $pragma = $public ? 'public' : 'private';
+ $this->addHeader('Cache-Control', $pragma . ', max-age=' . $cacheSeconds . ', must-revalidate');
+ $this->addHeader('Pragma', $pragma);
// Set expires header
$expires = new \DateTime();