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
PUT -> writeItr itr itrRequestHasBody True
_ -> setStatus NotImplemented
- preprocessHeader itr req
+ preprocessHeader req
where
setStatus :: StatusCode -> STM ()
setStatus status
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
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
}
- 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