From f735c464d3fe02ac43a1fa46c82ae9a3bb5de8b1 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Tue, 30 Jul 2024 18:36:57 +0900 Subject: [PATCH] =?UTF-8?q?LibWeb/Fetch:=20Don=E2=80=99t=20cache=20redirec?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index a5c39823126..94139797ef8 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1459,6 +1459,10 @@ private: // 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); if (request.cache_mode() == Infrastructure::Request::CacheMode::NoStore) return false;