X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FPreprocess.hs;h=802338c46dddbf7df1fb9fbe06c25620f5aa6075;hb=34b0ad7f2ffc5e7ca67fa3468d01c5551edc8a8b;hp=d951f6ae15bbba050036b5648d22f6bb8e3ca2bc;hpb=e624f0db8c4610b36da9e4463a656e0cb8a104dd;p=Lucu.git diff --git a/Network/HTTP/Lucu/Preprocess.hs b/Network/HTTP/Lucu/Preprocess.hs index d951f6a..802338c 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,28 +71,17 @@ 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 - , resStatus = status - , resHeaders = [] - }) + = updateItr itr itrResponse + $ \ res -> res { + resStatus = status + } preprocessHeader itr (name, value) = case map toLower name of