@@ -8,7 +8,7 @@ import Control.Exception.Lifted (throwIO)
88import Control.Monad.IO.Class (MonadIO, liftIO)
99import Data.ByteString (ByteString)
1010import qualified Data.ByteString as S
11−import qualified Data.ByteString.Char8 as B
11+import qualified Data.ByteString.Char8 as B (unpack)
1212import qualified Data.ByteString.Unsafe as SU
1313import qualified Data.CaseInsensitive as CI
1414import Data.Conduit
@@ -30,7 +30,7 @@ maxTotalHeaderLength :: Int
3030maxTotalHeaderLength = 50 * 1024
3131
3232parseRequest :: Connection -> Port -> SockAddr
33− -> Source (ResourceT IO) S.ByteString
33+ -> Source (ResourceT IO) ByteString
3434 -> ResourceT IO (Request, IO (ResumableSource (ResourceT IO) ByteString))
3535parseRequest conn port remoteHost' src1 = do
3636 (src2, headers') <- src1 $$+ takeHeaders
@@ -55,7 +55,7 @@ parseRequest' :: Connection
5555 -> Port
5656 -> [ByteString]
5757 -> SockAddr
58− -> ResumableSource (ResourceT IO) S.ByteString -- FIXME was buffered
58+ -> ResumableSource (ResourceT IO) ByteString -- FIXME was buffered
5959 -> ResourceT IO (Request, IO (ResumableSource (ResourceT IO) ByteString))
6060parseRequest' _ _ [] _ _ = throwIO $ NotEnoughLines []
6161parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
@@ -114,7 +114,7 @@ parseFirst s =
114114 case filter (not . S.null) $ S.splitWith (\c -> c == 32 || c == 9) s of -- ' '
115115 (method:query:http'') -> do
116116 let http' = S.concat http''
117− (hfirst, hsecond) = B.splitAt 5 http'
117+ (hfirst, hsecond) = S.splitAt 5 http'
118118 if hfirst == "HTTP/"
119119 then let (rpath, qstring) = S.breakByte 63 query -- '?'
120120 hv =
@@ -209,6 +209,6 @@ push (THStatus len lines prepend) bs
209209
210210{-# INLINE checkCR #-}
211211checkCR :: ByteString -> Int -> Int
212−checkCR bs pos = if '\r' == B.index bs p then p else pos
212+checkCR bs pos = if 13 == S.index bs p then p else pos -- 13 is CR
213213 where
214214 !p = pos - 1