X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FPreprocess.hs;h=74d66531f1d0a80c24a5b66734ca6267f1a821db;hb=b340a77fa7bd051dd13a41d0a5b1ad30220bc6b6;hp=3552e489e23da5494182a034788f90ef5519949d;hpb=a9e9f50818285bf66cd64e5a248175eecb8e1fea;p=Lucu.git diff --git a/Network/HTTP/Lucu/Preprocess.hs b/Network/HTTP/Lucu/Preprocess.hs index 3552e48..74d6653 100644 --- a/Network/HTTP/Lucu/Preprocess.hs +++ b/Network/HTTP/Lucu/Preprocess.hs @@ -1,5 +1,6 @@ +-- #hide module Network.HTTP.Lucu.Preprocess - ( preprocess -- Interaction -> STM () + ( preprocess ) where @@ -70,22 +71,12 @@ preprocess itr case reqMethod req of GET -> return () HEAD -> writeItr itr itrWillDiscardBody True - POST -> ensureHavingBody itr - PUT -> ensureHavingBody itr + POST -> writeItr itr itrRequestHasBody True + PUT -> writeItr itr itrRequestHasBody True _ -> setStatus itr NotImplemented mapM_ (preprocessHeader itr) (reqHeaders req) where - ensureHavingBody itr - = let req = fromJust $ itrRequest itr - in - if getHeader "Content-Length" req == Nothing && - getHeader "Transfer-Encoding" req == Nothing then - - setStatus itr LengthRequired - else - writeItr itr itrRequestHasBody True - setStatus itr status = writeItr itr itrResponse $ Just (Response { resVersion = HttpVersion 1 1 @@ -110,7 +101,9 @@ preprocess itr "content-length" -> if all isDigit value then - writeItr itr itrRequestBodyLength $ Just $ read value + do let len = read value + writeItr itr itrReqChunkLength $ Just len + writeItr itr itrReqChunkRemaining $ Just len else setStatus itr BadRequest