wai-extra 0.3.2 → 0.3.2.1
raw patch · 3 files changed
+20/−8 lines, 3 files
Files
- Network/Wai/Middleware/Gzip.hs +4/−1
- Network/Wai/Parse.hs +15/−6
- wai-extra.cabal +1/−1
Network/Wai/Middleware/Gzip.hs view
@@ -55,7 +55,10 @@ f' s hs = joinI $ compress $$ f s hs' where- hs' = ("Content-Encoding", "gzip") : hs+ -- Remove Content-Length header, since we will certainly have a+ -- different length after gzip compression.+ hs' = ("Content-Encoding", "gzip") : filter notLength hs+ notLength (x, _) = x /= "content-length" splitCommas :: String -> [String] splitCommas [] = []
Network/Wai/Parse.hs view
@@ -164,18 +164,27 @@ bs <- E.consume return (parseQueryString $ S.concat bs, []) Just (Just bound) -> -- multi-part- let bound' = S8.pack "--" `S.append` bound- in parsePieces sink bound'+ let bound'' = S8.pack "--" `S.append` bound+ in parsePieces sink bound'' where urlenc = S8.pack "application/x-www-form-urlencoded"- formBound = S8.pack "multipart/form-data; boundary="+ formBound = S8.pack "multipart/form-data;"+ bound' = "boundary="+ boundary s =+ if "multipart/form-data;" `S.isPrefixOf` s+ then+ let s' = S.dropWhile (== 32) $ S.drop (S.length formBound) s+ in if bound' `S.isPrefixOf` s'+ then Just $ S.drop (S.length bound') s'+ else Nothing+ else Nothing ctype = do ctype' <- lookup "Content-Type" $ requestHeaders req if urlenc `S.isPrefixOf` ctype' then Just Nothing- else if formBound `S.isPrefixOf` ctype'- then Just $ Just $ S.drop (S.length formBound) ctype'- else Nothing+ else case boundary ctype' of+ Just x -> Just $ Just x+ Nothing -> Nothing takeLine :: Iteratee S.ByteString IO (Maybe S.ByteString) takeLine = do
wai-extra.cabal view
@@ -1,5 +1,5 @@ Name: wai-extra-Version: 0.3.2+Version: 0.3.2.1 Synopsis: Provides some basic WAI handlers and middleware. Description: The goal here is to provide common features without many dependencies. License: BSD3