diff options
author | Adrian Cochrane <adrian@openwork.nz> | 2020-12-20 19:18:59 +1300 |
---|---|---|
committer | Adrian Cochrane <adrian@openwork.nz> | 2020-12-20 19:18:59 +1300 |
commit | 14a0ac0496d3d98982c45407948eba5bf915536f (patch) | |
tree | 82f06167f70a184ddac60426bb9d62e8c9b7d7e6 | |
parent | ff57d15db3fdae1a9d473e18347d32a624a68cd1 (diff) | |
download | hurl-14a0ac0496d3d98982c45407948eba5bf915536f.tar.gz hurl-14a0ac0496d3d98982c45407948eba5bf915536f.tar.bz2 hurl-14a0ac0496d3d98982c45407948eba5bf915536f.zip |
Cache everything for supported status codes.
-rw-r--r-- | src/Network/URI/Cache.hs | 8 |
1 files 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 |