wai 3.2.1.2 → 3.2.2
raw patch · 4 files changed
+23/−8 lines, 4 files
Files
- ChangeLog.md +4/−0
- Network/Wai.hs +9/−6
- Network/Wai/Internal.hs +9/−1
- wai.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.2.2++* Deprecate `requestBody` in favor of the more clearly named `getRequestBodyChunk`. [#726](https://github.com/yesodweb/wai/pull/726)+ ## 3.2.1.2 * Remove dependency on blaze-builder [#683](https://github.com/yesodweb/wai/pull/683)
Network/Wai.hs view
@@ -4,10 +4,11 @@ protocol between web servers and web applications. The overriding design principles here are performance and generality. To-address performance, this library is built on top of the conduit package and-bytestring's Builder type. The advantages of conduits over lazy IO have been-debated elsewhere and so will not be addressed here. However, helper functions-like 'responseLBS' allow you to continue using lazy IO if you so desire.+address performance, this library uses a streaming interface for request and+response bodies, paired with bytestring's 'Builder' type. The advantages of a+streaming API over lazy IO have been debated elsewhere and so will not be+addressed here. However, helper functions like 'responseLBS' allow you to+continue using lazy IO if you so desire. Generality is achieved by removing many variables commonly found in similar projects that are not universal to all servers. The goal is that the 'Request'@@ -32,6 +33,8 @@ [wai-test] <http://hackage.haskell.org/package/wai-test> -}+-- Ignore deprecations, because this module needs to use the deprecated requestBody to construct a response.+{-# OPTIONS_GHC -fno-warn-deprecations #-} module Network.Wai ( -- * Types@@ -324,7 +327,7 @@ loop id where loop front = do- bs <- requestBody req+ bs <- getRequestBodyChunk req if B.null bs then return $ front LI.Empty else loop (front . LI.Chunk bs)@@ -338,7 +341,7 @@ loop where loop = unsafeInterleaveIO $ do- bs <- requestBody req+ bs <- getRequestBodyChunk req if B.null bs then return LI.Empty else do
Network/Wai/Internal.hs view
@@ -17,6 +17,7 @@ -- | Information on the request sent by the client. This abstracts away the -- details of the underlying implementation.+{-# DEPRECATED requestBody "requestBody's name is misleading because it only gets a partial chunk of the body. Use getRequestBodyChunk instead." #-} data Request = Request { -- | Request method such as GET. requestMethod :: H.Method@@ -62,7 +63,7 @@ -- | Parsed query string information. , queryString :: H.Query -- | Get the next chunk of the body. Returns 'B.empty' when the- -- body is fully consumed.+ -- body is fully consumed. Since 3.2.2, this is deprecated in favor of 'getRequestBodyChunk'. , requestBody :: IO B.ByteString -- | A location for arbitrary data to be shared by applications and middleware. , vault :: Vault@@ -89,6 +90,13 @@ , requestHeaderUserAgent :: Maybe B.ByteString } deriving (Typeable)++-- | Get the next chunk of the body. Returns 'B.empty' when the+-- body is fully consumed.+--+-- @since 3.2.2+getRequestBodyChunk :: Request -> IO B.ByteString+getRequestBodyChunk = requestBody instance Show Request where show Request{..} = "Request {" ++ intercalate ", " [a ++ " = " ++ b | (a,b) <- fields] ++ "}"
wai.cabal view
@@ -1,5 +1,5 @@ Name: wai-Version: 3.2.1.2+Version: 3.2.2 Synopsis: Web Application Interface. Description: Provides a common protocol for communication between web applications and web servers. .