From: PHO Date: Tue, 20 Dec 2011 01:59:01 +0000 (+0900) Subject: rename: reqMustHaveBody --> reqHasBody X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=commitdiff_plain;h=742b0cae221f12eafbf1379b91c473b059efa7d8 rename: reqMustHaveBody --> reqHasBody --- diff --git a/Network/HTTP/Lucu/Preprocess.hs b/Network/HTTP/Lucu/Preprocess.hs index 1915b1b..0848f15 100644 --- a/Network/HTTP/Lucu/Preprocess.hs +++ b/Network/HTTP/Lucu/Preprocess.hs @@ -196,7 +196,7 @@ examineBodyLength ∷ State AugmentedRequest () examineBodyLength = do req ← gets arRequest len ← gets arReqBodyLength - if reqMustHaveBody req then + if reqHasBody req then -- POST and PUT requests must have an entity body. when (isNothing len) $ setStatus LengthRequired diff --git a/Network/HTTP/Lucu/Request.hs b/Network/HTTP/Lucu/Request.hs index 2fcfc91..b6ffedb 100644 --- a/Network/HTTP/Lucu/Request.hs +++ b/Network/HTTP/Lucu/Request.hs @@ -10,7 +10,7 @@ module Network.HTTP.Lucu.Request ( Method(..) , Request(..) - , reqMustHaveBody + , reqHasBody ) where import Control.Applicative @@ -55,10 +55,10 @@ instance HasHeaders Request where {-# INLINE setHeaders #-} setHeaders req hdr = req { reqHeaders = hdr } --- |Returns 'True' iff the 'Request' must have an entity body. -reqMustHaveBody ∷ Request → Bool -{-# INLINEABLE reqMustHaveBody #-} -reqMustHaveBody (reqMethod → m) +-- |Returns 'True' iff the 'Request' would have an entity body. +reqHasBody ∷ Request → Bool +{-# INLINEABLE reqHasBody #-} +reqHasBody (reqMethod → m) | m ≡ POST = True | m ≡ PUT = True | otherwise = False diff --git a/Network/HTTP/Lucu/RequestReader.hs b/Network/HTTP/Lucu/RequestReader.hs index 91aa86d..062ffe2 100644 --- a/Network/HTTP/Lucu/RequestReader.hs +++ b/Network/HTTP/Lucu/RequestReader.hs @@ -151,7 +151,7 @@ acceptRequestForResource ctx@(Context {..}) ar@(AugmentedRequest {..}) input rsr #endif tid ← spawnRsrc rsrcDef ni enqueue ctx ni - if reqMustHaveBody arRequest then + if reqHasBody arRequest then waitForReceiveBodyReq ctx ni tid input else acceptRequest ctx input diff --git a/Network/HTTP/Lucu/Resource/Internal.hs b/Network/HTTP/Lucu/Resource/Internal.hs index 1993eb2..b13d3a9 100644 --- a/Network/HTTP/Lucu/Resource/Internal.hs +++ b/Network/HTTP/Lucu/Resource/Internal.hs @@ -302,7 +302,7 @@ getChunk' n | n < 0 = fail ("getChunk: n must not be negative: " ⧺ show n) | n ≡ 0 = return (∅) | otherwise = do req ← getRequest - if reqMustHaveBody req then + if reqHasBody req then askForInput =≪ getInteraction else driftTo DecidingHeader *> return (∅)