X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FPostprocess.hs;h=24a07f18bb7d74af7e9ba7ac6468738633dfc0cf;hb=b340a77fa7bd051dd13a41d0a5b1ad30220bc6b6;hp=260bbcc6bdffb3d42efaad0a2560f88c3d719878;hpb=a44a96d95b5fcbaf24a21c0336046ce0c3bab614;p=Lucu.git diff --git a/Network/HTTP/Lucu/Postprocess.hs b/Network/HTTP/Lucu/Postprocess.hs index 260bbcc..24a07f1 100644 --- a/Network/HTTP/Lucu/Postprocess.hs +++ b/Network/HTTP/Lucu/Postprocess.hs @@ -1,6 +1,7 @@ +-- #hide module Network.HTTP.Lucu.Postprocess - ( postprocess -- Interaction -> STM () - , completeUnconditionalHeaders -- Config -> Response -> IO Response + ( postprocess + , completeUnconditionalHeaders ) where @@ -106,6 +107,10 @@ postprocess itr updateRes itr $ deleteHeader "Content-Length" + cType <- readHeader itr "Content-Type" + when (cType == Nothing) + $ updateRes itr $ setHeader "Content-Type" "application/octet-stream" + if canHaveBody then do teM <- readHeader itr "Transfer-Encoding" if reqVer == HttpVersion 1 1 then @@ -130,10 +135,6 @@ postprocess itr $ Just ("Transfer-Encoding must be `identity' because " ++ "this is an HTTP/1.0 request: " ++ te) - - cType <- readHeader itr "Content-Type" - when (cType == Nothing) - $ updateRes itr $ setHeader "Content-Type" "application/octet-stream" else -- body 関連のヘッダを削除。但し HEAD なら Content-* は殘す do updateRes itr $ deleteHeader "Transfer-Encoding"