wai-extra 1.3.4.4 → 1.3.4.5
raw patch · 2 files changed
+21/−3 lines, 2 filesdep +lifted-basePVP ok
version bump matches the API change (PVP)
Dependencies added: lifted-base
API changes (from Hackage documentation)
Files
Network/Wai/Middleware/RequestLogger.hs view
@@ -34,7 +34,7 @@ import qualified Data.Conduit.List as CL import System.Console.ANSI-import Data.IORef+import Data.IORef.Lifted import System.IO.Unsafe import Data.Default (Default (def))@@ -198,7 +198,24 @@ body <- requestBody req C.$$ CL.consume -- logging the body here consumes it, so fill it back up -- obviously not efficient, but this is the development logger- let req' = req { requestBody = CL.sourceList body }+ --+ -- Note: previously, we simply used CL.sourceList. However,+ -- that meant that you could read the request body in twice.+ -- While that in itself is not a problem, the issue is that,+ -- in production, you wouldn't be able to do this, and+ -- therefore some bugs wouldn't show up during testing. This+ -- implementation ensures that each chunk is only returned+ -- once.+ ichunks <- newIORef body+ let rbody = do+ chunks <- readIORef ichunks+ case chunks of+ [] -> return ()+ x:xs -> do+ writeIORef ichunks xs+ C.yield x+ rbody+ let req' = req { requestBody = rbody } return (req', body) _ -> return (req, [])
wai-extra.cabal view
@@ -1,5 +1,5 @@ Name: wai-extra-Version: 1.3.4.4+Version: 1.3.4.5 Synopsis: Provides some basic WAI handlers and middleware. Description: The goal here is to provide common features without many dependencies. License: MIT@@ -46,6 +46,7 @@ , containers , base64-bytestring , word8+ , lifted-base Exposed-modules: Network.Wai.Handler.CGI Network.Wai.Middleware.AcceptOverride