@@ -94,14 +94,14 @@ parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
94 , vault = mempty
94 , vault = mempty
95 }, getSource)
95 }, getSource)
97−
97+{-# INLINE takeUntil #-}
98takeUntil :: Word8 -> ByteString -> ByteString
98takeUntil :: Word8 -> ByteString -> ByteString
99takeUntil c bs =
99takeUntil c bs =
100 case S.elemIndex c bs of
100 case S.elemIndex c bs of
101 Just !idx -> SU.unsafeTake idx bs
101 Just !idx -> SU.unsafeTake idx bs
102 Nothing -> bs
102 Nothing -> bs
103−{-# INLINE takeUntil #-}
104+{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
105parseFirst :: ByteString
105parseFirst :: ByteString
106 -> ResourceT IO (ByteString, ByteString, ByteString, H.HttpVersion)
106 -> ResourceT IO (ByteString, ByteString, ByteString, H.HttpVersion)
107parseFirst s =
107parseFirst s =
@@ -118,7 +118,6 @@ parseFirst s =
118 in return (method, rpath, qstring, hv)
118 in return (method, rpath, qstring, hv)
119 else throwIO NonHttp
119 else throwIO NonHttp
120 _ -> throwIO $ BadFirstLine $ B.unpack s
120 _ -> throwIO $ BadFirstLine $ B.unpack s
121−{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
123parseHeaderNoAttr :: ByteString -> H.Header
122parseHeaderNoAttr :: ByteString -> H.Header
124parseHeaderNoAttr s =
123parseHeaderNoAttr s =
@@ -134,6 +133,7 @@ data THStatus = THStatus
134 BSEndoList -- previously parsed lines
133 BSEndoList -- previously parsed lines
135 BSEndo -- bytestrings to be prepended
134 BSEndo -- bytestrings to be prepended
136+{-# INLINE takeHeaders #-}
137takeHeaders :: Sink ByteString (ResourceT IO) [ByteString]
137takeHeaders :: Sink ByteString (ResourceT IO) [ByteString]
138takeHeaders =
138takeHeaders =
139 await >>= maybe (throwIO ConnectionClosedByPeer) (push (THStatus 0 id id))
139 await >>= maybe (throwIO ConnectionClosedByPeer) (push (THStatus 0 id id))
@@ -199,12 +199,11 @@ takeHeaders =
199 let c = S.index bs (nl + 1)
199 let c = S.index bs (nl + 1)
200 in Just (nl, c == 32 || c == 9)
200 in Just (nl, c == 32 || c == 9)
201 else Just (nl, False)
201 else Just (nl, False)
202−{-# INLINE takeHeaders #-}
203+{-# INLINE checkCR #-}
204checkCR :: ByteString -> Int -> Int
204checkCR :: ByteString -> Int -> Int
205checkCR bs pos =
205checkCR bs pos =
206 let !p = pos - 1
206 let !p = pos - 1
207 in if '\r' == B.index bs p
207 in if '\r' == B.index bs p
210−{-# INLINE checkCR #-}