瀏覽代碼

LibWeb/Fetch: Don’t cache redirects

This change disables caching for 301, 302, 303, 307, and 308 responses.
This is just for now, ad-hoc — not adhering to any particular spec.
Fixes https://github.com/LadybirdBrowser/ladybird/issues/863
sideshowbarker 1 年之前
父節點
當前提交
f735c464d3
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp

+ 4 - 0
Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp

@@ -1459,6 +1459,10 @@ private:
             // FIXME: Implement must-understand cache directive
             // FIXME: Implement must-understand cache directive
         }
         }
 
 
+        // FIXME: This is just for now, ad-hoc — not adhering to any particular spec.
+        if (response.status() == 301 || response.status() == 302 || response.status() == 303 || response.status() == 307 || response.status() == 308)
+            return false;
+
         // - the no-store cache directive is not present in the response (see Section 5.2.2.5);
         // - the no-store cache directive is not present in the response (see Section 5.2.2.5);
         if (request.cache_mode() == Infrastructure::Request::CacheMode::NoStore)
         if (request.cache_mode() == Infrastructure::Request::CacheMode::NoStore)
             return false;
             return false;