wai-app-static 3.1.7.2 → 3.1.7.3
raw patch · 3 files changed
+33/−5 lines, 3 filesdep +base64-bytestringdep +cryptohash-md5dep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: base64-bytestring, cryptohash-md5
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- WaiAppStatic/Storage/Embedded/Runtime.hs +10/−0
- WaiAppStatic/Storage/Filesystem.hs +10/−0
- wai-app-static.cabal +13/−5
WaiAppStatic/Storage/Embedded/Runtime.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | Lookup files stored in memory instead of from the filesystem. module WaiAppStatic.Storage.Embedded.Runtime ( -- * Settings@@ -15,8 +16,13 @@ import qualified Data.Text as T import Data.Ord import qualified Data.ByteString as S+#ifdef MIN_VERSION_cryptonite import Crypto.Hash (hash, MD5, Digest) import Data.ByteArray.Encoding+#else+import Crypto.Hash.MD5 (hash)+import Data.ByteString.Base64 (encode)+#endif import WaiAppStatic.Storage.Filesystem (defaultFileServerSettings) import System.FilePath (isPathSeparator) @@ -94,4 +100,8 @@ } runHash :: ByteString -> ByteString+#ifdef MIN_VERSION_cryptonite runHash = convertToBase Base64 . (hash :: S.ByteString -> Digest MD5)+#else+runHash = encode . hash+#endif
WaiAppStatic/Storage/Filesystem.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE BangPatterns #-}@@ -25,8 +26,13 @@ import Network.Mime import System.PosixCompat.Files (fileSize, getFileStatus, modificationTime, isRegularFile) import Data.Maybe (catMaybes)+#ifdef MIN_VERSION_cryptonite import Data.ByteArray.Encoding import Crypto.Hash (hashlazy, MD5, Digest)+#else+import Data.ByteString.Base64 (encode)+import Crypto.Hash.MD5 (hashlazy)+#endif import qualified Data.ByteString.Lazy as BL (hGetContents) import qualified Data.Text as T @@ -122,8 +128,12 @@ hashFile :: FilePath -> IO ByteString hashFile fp = withBinaryFile fp ReadMode $ \h -> do f <- BL.hGetContents h+#ifdef MIN_VERSION_cryptonite let !hash = hashlazy f :: Digest MD5 return $ convertToBase Base64 hash+#else+ return . encode . hashlazy $ f+#endif hashFileIfExists :: ETagLookup hashFileIfExists fp = do
wai-app-static.cabal view
@@ -1,5 +1,5 @@ name: wai-app-static-version: 3.1.7.2+version: 3.1.7.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -24,9 +24,13 @@ Description: print debug info Default: False +Flag cryptonite+ Description: Use the cryptonite library for MD5 computation+ Default: True+ library default-language: Haskell2010- build-depends: base >= 4 && < 5+ build-depends: base >= 4.12 && < 5 , wai >= 3.0 && < 3.3 , bytestring >= 0.10.4 , http-types >= 0.7@@ -38,8 +42,6 @@ , old-locale >= 1.0.0.2 , file-embed >= 0.0.3.1 , text >= 0.7- , cryptonite >= 0.6- , memory >= 0.7 , http-date , blaze-html >= 0.5 , blaze-markup >= 0.5.1@@ -48,9 +50,15 @@ , template-haskell >= 2.7 , zlib >= 0.5 , filepath- , wai-extra >= 3.0 && < 3.1+ , wai-extra >= 3.0 && < 3.2 , optparse-applicative >= 0.7 , warp >= 3.0.11 && < 3.4+ if flag(cryptonite)+ build-depends: cryptonite >= 0.6+ , memory >= 0.7+ else+ build-depends: base64-bytestring >= 0.1+ , cryptohash-md5 >= 0.11.101 exposed-modules: Network.Wai.Application.Static WaiAppStatic.Storage.Filesystem