wai-middleware-cache 0.3.0 → 0.3.3
raw patch · 2 files changed
+10/−9 lines, 2 filesdep +binarydep −cereal
Dependencies added: binary
Dependencies removed: cereal
Files
src/Network/Wai/Middleware/Cache.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} +{-# LANGUAGE OverloadedStrings #-} -- | Transparent front cache middleware for 'Network.Wai'. -- @@ -22,22 +22,22 @@ lookupETag ) where -import Prelude hiding (concatMap) - import Control.Exception (Exception) import Numeric (showHex) +import Data.Monoid (mconcat) + import Data.Word (Word8) import Data.Maybe (fromMaybe) import Data.Typeable (Typeable) import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 -import Data.ByteString.Lazy (empty) +import Data.ByteString.Lazy (empty, toChunks) import Data.Digest.Pure.MD5 (MD5Digest) -import Data.Serialize (encode) +import Data.Binary (encode) import Data.Conduit (ResourceT, ($=), ($$), Flush(..)) import qualified Data.Conduit.List as CL @@ -49,7 +49,7 @@ import Network.HTTP.Types (status304) -- | Abstract cache backend. Result may be 'Nothing' you need to respond --- with status @304 - Not Modified@. +-- with status @304 - Not Modified@. type CacheBackend = Application -- ^ Application -> Request -- ^ Request @@ -92,7 +92,8 @@ Nothing -> do digest <- rsrc $= builderToByteStringFlush $= CL.map fromChunk $$ sinkHash - let hash = toHex . encode $ (digest :: MD5Digest) + let hash = toHex . mconcat . toChunks . encode $ + (digest :: MD5Digest) return $ ResponseSource rs (("ETag", hash):rh) rsrc where fromChunk (Chunk a) = a
wai-middleware-cache.cabal view
@@ -1,5 +1,5 @@ name: wai-middleware-cache -version: 0.3.0 +version: 0.3.3 cabal-version: >= 1.8 build-type: Simple stability: Stable @@ -21,9 +21,9 @@ library hs-source-dirs: src build-depends: base >= 4 && < 5, + binary, blaze-builder-conduit >= 0.4, bytestring >= 0.9 && < 0.10, - cereal, conduit >= 0.4 && < 0.5, crypto-conduit, http-types >= 0.6 && < 0.7,