From 14a0ac0496d3d98982c45407948eba5bf915536f Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sun, 20 Dec 2020 19:18:59 +1300 Subject: [PATCH] Cache everything for supported status codes. --- src/Network/URI/Cache.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Network/URI/Cache.hs b/src/Network/URI/Cache.hs index c84e11a..d8b9b50 100644 --- a/src/Network/URI/Cache.hs +++ b/src/Network/URI/Cache.hs @@ -36,11 +36,9 @@ shouldCacheHTTP :: Response b -> Bool -- IETF RFC7234 Section 3 shouldCacheHTTP response = -- Assume GET statusCode (responseStatus response) `Prelude.elem` [200, 201, 404] && -- Supported response code - isNothing (httpCacheDirective response "no-store") && -- Honor no-store - True && -- This is a private cache, don't check for Cache-Control: private - (isJust (lookup hExpires $ responseHeaders response) || -- Support Expires: header - isJust (httpCacheDirective response "max-age") || - isJust (httpCacheDirective response "public")) -- Override directive + isNothing (httpCacheDirective response "no-store") -- Honor no-store + -- This is a private cache, don't check for Cache-Control: private + -- Also, I'll cache anything for supported response codes, regardless of explicit expiry times. uriToString' uri = uriToString id uri "" parseHTTPTime str | ',' `L.elem` str = parseTimeM True defaultTimeLocale rfc822DateFormat str -- 2.30.2