wai-app-static 3.1.9.1 → 3.2.1
raw patch · 7 files changed
Files
- ChangeLog.md +6/−3
- WaiAppStatic/CmdLine.hs +1/−1
- WaiAppStatic/Storage/Embedded/Runtime.hs +14/−2
- WaiAppStatic/Storage/Filesystem.hs +10/−0
- test/tests.hs +6/−0
- tests.hs +0/−6
- wai-app-static.cabal +3/−4
ChangeLog.md view
@@ -1,9 +1,12 @@ # wai-app-static changelog -## 3.1.9.1+## 3.2.1 -* Backported a patch to not need `crypton` as a dependency.- Instead, just depend on `base64-bytestring` and `cryptohash-md5`.+* Removing the dependency to "crypton".++## 3.2.0++* Using "ram" instead of "memory". ## 3.1.9
WaiAppStatic/CmdLine.hs view
@@ -132,7 +132,7 @@ port (if noindex then "no" else show index) let middle =- gzip def{gzipFiles = GzipCompress}+ gzip defaultGzipSettings{gzipFiles = GzipCompress} . (if verbose then logStdout else id) . middleware clArgs runSettings
WaiAppStatic/Storage/Embedded/Runtime.hs view
@@ -17,8 +17,13 @@ import qualified Data.Text as T import qualified Network.Wai as W import WaiAppStatic.Types+#ifdef MIN_VERSION_crypton+import Crypto.Hash (hash, MD5, Digest)+import Data.ByteArray.Encoding+#else import Crypto.Hash.MD5 (hash) import Data.ByteString.Base64 (encode)+#endif import System.FilePath (isPathSeparator) import WaiAppStatic.Storage.Filesystem (defaultFileServerSettings) @@ -57,7 +62,7 @@ { fileGetSize = fromIntegral $ S.length bs , fileToResponse = \s h -> W.responseBuilder s h $ byteString bs , fileName = name- , fileGetHash = return $ Just $ encode $ hash bs+ , fileGetHash = return $ Just $ runHash bs , fileGetModified = Nothing } @@ -95,6 +100,13 @@ { fileGetSize = fromIntegral $ S.length bs , fileToResponse = \s h -> W.responseBuilder s h $ byteString bs , fileName = name- , fileGetHash = return $ Just $ encode $ hash bs+ , fileGetHash = return $ Just $ runHash bs , fileGetModified = Nothing }++runHash :: ByteString -> ByteString+#ifdef MIN_VERSION_crypton+runHash = convertToBase Base64 . (hash :: S.ByteString -> Digest MD5)+#else+runHash = encode . hash+#endif
WaiAppStatic/Storage/Filesystem.hs view
@@ -37,8 +37,13 @@ import Util import WaiAppStatic.Listing import WaiAppStatic.Types+#ifdef MIN_VERSION_crypton+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 @@ -152,8 +157,13 @@ hashFile :: FilePath -> IO ByteString hashFile fp = withBinaryFile fp ReadMode $ \h -> do f <- BL.hGetContents h+#ifdef MIN_VERSION_crypton+ let !hash = hashlazy f :: Digest MD5+ return $ convertToBase Base64 hash+#else let !hash = hashlazy f return . encode $ hash+#endif hashFileIfExists :: ETagLookup hashFileIfExists fp = do
+ test/tests.hs view
@@ -0,0 +1,6 @@+import Test.Hspec+import WaiAppEmbeddedTest (embSpec)+import WaiAppStaticTest (spec)++main :: IO ()+main = hspec $ spec >> embSpec
− tests.hs
@@ -1,6 +0,0 @@-import Test.Hspec-import WaiAppEmbeddedTest (embSpec)-import WaiAppStaticTest (spec)--main :: IO ()-main = hspec $ spec >> embSpec
wai-app-static.cabal view
@@ -1,5 +1,5 @@ name: wai-app-static-version: 3.1.9.1+version: 3.2.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -14,9 +14,7 @@ Extra-source-files: images/folder.png images/haskell.png- test/*.hs test/a/b- tests.hs README.md ChangeLog.md @@ -79,7 +77,7 @@ other-modules: EmbeddedTestEntries , WaiAppEmbeddedTest , WaiAppStaticTest- main-is: ../tests.hs+ main-is: tests.hs type: exitcode-stdio-1.0 build-depends: base >= 4 && < 5@@ -103,3 +101,4 @@ source-repository head type: git location: https://github.com/yesodweb/wai.git+ subdir: wai-app-static