X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FPreprocess.hs;h=5e1d095151fb16b9a59e86730af5946971317638;hp=c1f1a8b8dacc9c8e91cc21907f3053c3a55a7cda;hb=858129cb755aa09da2b7bd758efb8519f2c89103;hpb=5b255535f2c7d2a6d4622ad164b31e63746b906e diff --git a/Network/HTTP/Lucu/Preprocess.hs b/Network/HTTP/Lucu/Preprocess.hs index c1f1a8b..5e1d095 100644 --- a/Network/HTTP/Lucu/Preprocess.hs +++ b/Network/HTTP/Lucu/Preprocess.hs @@ -51,7 +51,8 @@ import GHC.Conc (unsafeIOToSTM) preprocess :: Interaction -> STM () preprocess itr - = do req <- readItr itr itrRequest fromJust + = itr `seq` + do req <- readItr itr itrRequest fromJust let reqVer = reqVersion req @@ -80,14 +81,16 @@ preprocess itr where setStatus :: StatusCode -> STM () setStatus status - = updateItr itr itrResponse - $ \ res -> res { - resStatus = status - } + = status `seq` + updateItr itr itrResponse + $! \ res -> res { + resStatus = status + } completeAuthority :: Request -> STM () completeAuthority req - = when (uriAuthority (reqURI req) == Nothing) + = req `seq` + when (uriAuthority (reqURI req) == Nothing) $ if reqVersion req == HttpVersion 1 0 then -- HTTP/1.0 なので Config から補完 do let conf = itrConfig itr @@ -120,24 +123,27 @@ preprocess itr updateAuthority :: String -> String -> STM () updateAuthority host portStr - = updateItr itr itrRequest - $ \ (Just req) -> Just req { - reqURI = let uri = reqURI req - in uri { - uriAuthority = Just URIAuth { - uriUserInfo = "" - , uriRegName = host - , uriPort = portStr - } - } - } + = host `seq` portStr `seq` + updateItr itr itrRequest + $! \ (Just req) -> Just req { + reqURI = let uri = reqURI req + in uri { + uriAuthority = Just URIAuth { + uriUserInfo = "" + , uriRegName = host + , uriPort = portStr + } + } + } + preprocessHeader :: Interaction -> (String, String) -> STM () preprocessHeader itr (name, value) - = case map toLower name of + = itr `seq` name `seq` value `seq` + case map toLower name of "expect" - -> if value `noCaseEq` "100-continue" then + -> if value `noCaseEq'` "100-continue" then writeItr itr itrExpectedContinue True else setStatus ExpectationFailed