Clean up the `cache-control` processing in RequestHandler::sendPsr7Response()
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 11:32:06 +0000 (13:32 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 11:32:06 +0000 (13:32 +0200)
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 2b97fac1f6e516523be27f6580a210edede5d921..61c1069c0c652d5c5f913ab6c4db0e27cde002fa 100644 (file)
@@ -158,7 +158,9 @@ class RequestHandler extends SingletonFactory
     {
         // Storing responses in a shared cache is unsafe, because they all contain session specific information.
         // Add the 'private' value to the cache-control header and remove any 'public' value.
-        $cacheControl = [];
+        $cacheControl = [
+            'private',
+        ];
         foreach ($this->splitCacheControl($response->getHeader('cache-control')) as $value) {
             [$field] = \explode('=', $value, 2);
 
@@ -174,7 +176,6 @@ class RequestHandler extends SingletonFactory
 
             $cacheControl[] = $value;
         }
-        $cacheControl[] = 'private';
 
         $response = $response->withHeader(
             'cache-control',