on master help sign in
Removing takeUntil.
940779fKazu Yamamoto
warp/Network/Wai/Handler/Warp/Request.hs+4−9
@@ -2,7 +2,10 @@
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE CPP #-}
3{-# LANGUAGE CPP #-}
4
4
5−module Network.Wai.Handler.Warp.Request where
5+module Network.Wai.Handler.Warp.Request (
6+ recvRequest
7+ , takeHeaders
8+ ) where
6
9
7import Control.Applicative
10import Control.Applicative
8import Control.Exception.Lifted (throwIO)
11import Control.Exception.Lifted (throwIO)
@@ -15,7 +18,6 @@ import qualified Data.CaseInsensitive as CI
15import Data.Conduit
18import Data.Conduit
16import qualified Data.IORef as I
19import qualified Data.IORef as I
17import Data.Monoid (mempty)
20import Data.Monoid (mempty)
18−import Data.Word (Word8)
19import qualified Network.HTTP.Types as H
21import qualified Network.HTTP.Types as H
20import Network.Socket (SockAddr)
22import Network.Socket (SockAddr)
21import Network.Wai
23import Network.Wai
@@ -114,13 +116,6 @@ recvRequest' conn timeoutHandle (firstLine:otherLines) remoteHost' src = do
114#endif
116#endif
115 }, getSource)
117 }, getSource)
116
118
117−{-# INLINE takeUntil #-}
118−takeUntil :: Word8 -> ByteString -> ByteString
119−takeUntil c bs =
120− case S.elemIndex c bs of
121− Just !idx -> SU.unsafeTake idx bs
122− Nothing -> bs
123−
124{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
119{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
125parseFirst :: ByteString
120parseFirst :: ByteString
126 -> IO (ByteString, ByteString, ByteString, H.HttpVersion)
121 -> IO (ByteString, ByteString, ByteString, H.HttpVersion)