X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FPreprocess.hs;h=7f386a7589ce4580bf6f23b3c61878914ba6822b;hp=ef6689892ca753f23909fe467932ef470589b669;hb=3d017dd65ddede9a11c5b7a34a91e04340e67bc4;hpb=e1e74c8f81ccbc57bf5a09987b0a9dd42648f020 diff --git a/Network/HTTP/Lucu/Preprocess.hs b/Network/HTTP/Lucu/Preprocess.hs index ef66898..7f386a7 100644 --- a/Network/HTTP/Lucu/Preprocess.hs +++ b/Network/HTTP/Lucu/Preprocess.hs @@ -5,8 +5,8 @@ module Network.HTTP.Lucu.Preprocess import Control.Concurrent.STM import Control.Monad -import Data.ByteString.Base (ByteString) -import qualified Data.ByteString.Char8 as C8 +import qualified Data.ByteString as Strict (ByteString) +import qualified Data.ByteString.Char8 as C8 hiding (ByteString) import Data.Char import Data.Maybe import Network.HTTP.Lucu.Config @@ -75,7 +75,7 @@ preprocess itr PUT -> writeItr itr itrRequestHasBody True _ -> setStatus NotImplemented - preprocessHeader itr req + preprocessHeader req where setStatus :: StatusCode -> STM () setStatus status @@ -94,7 +94,7 @@ preprocess itr do let conf = itrConfig itr host = cnfServerHost conf port = case cnfServerPort conf of - PortNumber n -> Just $ fromIntegral n + PortNumber n -> Just (fromIntegral n :: Int) _ -> Nothing portStr = case port of @@ -115,11 +115,11 @@ preprocess itr Nothing -> setStatus BadRequest - parseHost :: ByteString -> (ByteString, ByteString) + parseHost :: Strict.ByteString -> (Strict.ByteString, Strict.ByteString) parseHost = C8.break (== ':') - updateAuthority :: ByteString -> ByteString -> STM () + updateAuthority :: Strict.ByteString -> Strict.ByteString -> STM () updateAuthority host portStr = host `seq` portStr `seq` updateItr itr itrRequest @@ -135,9 +135,9 @@ preprocess itr } - preprocessHeader :: Interaction -> Request -> STM () - preprocessHeader itr req - = itr `seq` req `seq` + preprocessHeader :: Request -> STM () + preprocessHeader req + = req `seq` do case getHeader (C8.pack "Expect") req of Nothing -> return () Just value -> if value `noCaseEq` C8.pack "100-continue" then