on master help sign in
Merge pull request #413 from mschristiansen/break
48e9a9aMichael Snoyman
wai-extra/Network/Wai/Middleware/Gzip.hs+2−1
@@ -42,6 +42,7 @@ import Data.Function (fix)
42import Control.Exception (throwIO)
42import Control.Exception (throwIO)
43import qualified System.IO as IO
43import qualified System.IO as IO
44import Data.ByteString.Lazy.Internal (defaultChunkSize)
44import Data.ByteString.Lazy.Internal (defaultChunkSize)
45+import Data.Word8 (_semicolon)
45
46
46data GzipSettings = GzipSettings
47data GzipSettings = GzipSettings
47 { gzipFiles :: GzipFiles
48 { gzipFiles :: GzipFiles
@@ -58,7 +59,7 @@ defaultCheckMime :: S.ByteString -> Bool
58defaultCheckMime bs =
59defaultCheckMime bs =
59 S8.isPrefixOf "text/" bs || bs' `Set.member` toCompress
60 S8.isPrefixOf "text/" bs || bs' `Set.member` toCompress
60 where
61 where
61− bs' = fst $ S.breakByte 59 bs -- semicolon
62+ bs' = fst $ S.break (== _semicolon) bs
62 toCompress = Set.fromList
63 toCompress = Set.fromList
63 [ "application/json"
64 [ "application/json"
64 , "application/javascript"
65 , "application/javascript"
wai-extra/Network/Wai/Middleware/HttpAuth.hs+1−1
@@ -109,7 +109,7 @@ extractBasicAuth bs =
109 where
109 where
110 extract encoded =
110 extract encoded =
111 let raw = decodeLenient encoded
111 let raw = decodeLenient encoded
112− (username, password') = S.breakByte _colon raw
112+ (username, password') = S.break (== _colon) raw
113 in ((username,) . snd) <$> S.uncons password'
113 in ((username,) . snd) <$> S.uncons password'
114
114
115-- | Extract bearer authentication data from __Authorization__ header
115-- | Extract bearer authentication data from __Authorization__ header