@@ -368,9 +368,7 @@ checkPieces fileLookup indices pieces req maxAge useHash redirectToIndex
368368 checkIndices :: [FilePath] -> Maybe FilePath
369369 checkIndices contents = find (flip elem indices) contents
370370
371− cacheControl = case ccInt of
372− Nothing -> []
373− Just i -> [("Cache-Control", S8.append "max-age=" $ S8.pack $ show i)]
371+ cacheControl = headerCacheControl $ headerExpires []
374372 where
375373 ccInt =
376374 case maxAge of
@@ -380,6 +378,16 @@ checkPieces fileLookup indices pieces req maxAge useHash redirectToIndex
380378 oneYear :: Int
381379 oneYear = 60 * 60 * 24 * 365
382380
381+ headerCacheControl =
382+ case ccInt of
383+ Nothing -> id
384+ Just i -> (:) ("Cache-Control", S8.append "public, max-age=" $ S8.pack $ show i)
385+ headerExpires =
386+ case maxAge of
387+ NoMaxAge -> id
388+ MaxAgeSeconds _ -> id -- FIXME
389+ MaxAgeForever -> (:) ("Expires", "Thu, 31 Dec 2037 23:55:55 GMT")
390+
383391type Listing = (Pieces -> Folder -> IO L.ByteString)
384392
385393