@@ -116,14 +116,14 @@ sendResponse settings conn ii th req reqidxhdr src response = do
116 -- and status, the response to HEAD is processed here.
116 -- and status, the response to HEAD is processed here.
118 -- See definition of rsp below for proper body stripping.
118 -- See definition of rsp below for proper body stripping.
119− (ms, mlen) <- sendRsp conn ii ver s hs rsp
119+ (ms, mlen) <- sendRsp conn ii ver s hs rspidxhdr rsp
120 case ms of
120 case ms of
121 Nothing -> return ()
121 Nothing -> return ()
122 Just realStatus -> logger req realStatus mlen
122 Just realStatus -> logger req realStatus mlen
123 T.tickle th
123 T.tickle th
124 return ret
124 return ret
126− _ <- sendRsp conn ii ver s hs RspNoBody
126+ _ <- sendRsp conn ii ver s hs rspidxhdr RspNoBody
127 logger req s Nothing
127 logger req s Nothing
128 T.tickle th
128 T.tickle th
129 return isPersist
129 return isPersist
@@ -196,12 +196,13 @@ sendRsp :: Connection
196 -> H.HttpVersion
196 -> H.HttpVersion
197 -> H.Status
197 -> H.Status
198 -> H.ResponseHeaders
198 -> H.ResponseHeaders
199+ -> IndexedHeader -- Response
200 -> IO (Maybe H.Status, Maybe Integer)
201 -> IO (Maybe H.Status, Maybe Integer)
202----------------------------------------------------------------
203----------------------------------------------------------------
204−sendRsp conn _ ver s hs RspNoBody = do
205+sendRsp conn _ ver s hs _ RspNoBody = do
205 -- Not adding Content-Length.
206 -- Not adding Content-Length.
206 -- User agents treats it as Content-Length: 0.
207 -- User agents treats it as Content-Length: 0.
207 composeHeader ver s hs >>= connSendAll conn
208 composeHeader ver s hs >>= connSendAll conn
@@ -209,7 +210,7 @@ sendRsp conn _ ver s hs RspNoBody = do
210----------------------------------------------------------------
211----------------------------------------------------------------
212−sendRsp conn _ ver s hs (RspBuilder body needsChunked) = do
213+sendRsp conn _ ver s hs _ (RspBuilder body needsChunked) = do
213 header <- composeHeaderBuilder ver s hs needsChunked
214 header <- composeHeaderBuilder ver s hs needsChunked
214 let hdrBdy
215 let hdrBdy
215 | needsChunked = header <> chunkedTransferEncoding body
216 | needsChunked = header <> chunkedTransferEncoding body
@@ -222,7 +223,7 @@ sendRsp conn _ ver s hs (RspBuilder body needsChunked) = do
223----------------------------------------------------------------
224----------------------------------------------------------------
225−sendRsp conn _ ver s hs (RspStream streamingBody needsChunked th) = do
226+sendRsp conn _ ver s hs _ (RspStream streamingBody needsChunked th) = do
226 header <- composeHeaderBuilder ver s hs needsChunked
227 header <- composeHeaderBuilder ver s hs needsChunked
227 (recv, finish) <- newByteStringBuilderRecv $ reuseBufferStrategy
228 (recv, finish) <- newByteStringBuilderRecv $ reuseBufferStrategy
228 $ toBuilderBuffer (connWriteBuffer conn) (connBufferSize conn)
229 $ toBuilderBuffer (connWriteBuffer conn) (connBufferSize conn)
@@ -246,7 +247,7 @@ sendRsp conn _ ver s hs (RspStream streamingBody needsChunked th) = do
247----------------------------------------------------------------
248----------------------------------------------------------------
249−sendRsp conn _ _ _ _ (RspRaw withApp src tickle) = do
250+sendRsp conn _ _ _ _ _ (RspRaw withApp src tickle) = do
250 withApp recv send
251 withApp recv send
251 return (Nothing, Nothing)
252 return (Nothing, Nothing)
@@ -260,8 +261,8 @@ sendRsp conn _ _ _ _ (RspRaw withApp src tickle) = do
261-- Sophisticated WAI applications.
262-- Sophisticated WAI applications.
262-- We respect s0. s0 MUST be a proper value.
263-- We respect s0. s0 MUST be a proper value.
263−sendRsp conn ii ver s0 hs0 (RspFile path (Just part) _ isHead hook) =
264+sendRsp conn ii ver s0 hs0 rspidxhdr (RspFile path (Just part) _ isHead hook) =
264− sendRspFile2XX conn ii ver s0 hs path beg len isHead hook
265+ sendRspFile2XX conn ii ver s0 hs rspidxhdr path beg len isHead hook
266 beg = filePartOffset part
267 beg = filePartOffset part
267 len = filePartByteCount part
268 len = filePartByteCount part
@@ -271,17 +272,17 @@ sendRsp conn ii ver s0 hs0 (RspFile path (Just part) _ isHead hook) =
272-- Simple WAI applications.
273-- Simple WAI applications.
273-- Status is ignored
274-- Status is ignored
274−sendRsp conn ii ver _ hs0 (RspFile path Nothing idxhdr isHead hook) = do
275+sendRsp conn ii ver _ hs0 rspidxhdr (RspFile path Nothing reqidxhdr isHead hook) = do
275 efinfo <- E.try $ getFileInfo ii path
276 efinfo <- E.try $ getFileInfo ii path
276 case efinfo of
277 case efinfo of
277 Left (_ex :: E.IOException) ->
278 Left (_ex :: E.IOException) ->
278#ifdef WARP_DEBUG
279#ifdef WARP_DEBUG
279 print _ex >>
280 print _ex >>
281− sendRspFile404 conn ii ver hs0
282+ sendRspFile404 conn ii ver hs0 rspidxhdr
282− Right finfo -> case conditionalRequest finfo hs0 idxhdr of
283+ Right finfo -> case conditionalRequest finfo hs0 rspidxhdr reqidxhdr of
283− WithoutBody s -> sendRsp conn ii ver s hs0 RspNoBody
284+ WithoutBody s -> sendRsp conn ii ver s hs0 rspidxhdr RspNoBody
284− WithBody s hs beg len -> sendRspFile2XX conn ii ver s hs path beg len isHead hook
285+ WithBody s hs beg len -> sendRspFile2XX conn ii ver s hs rspidxhdr path beg len isHead hook
286----------------------------------------------------------------
287----------------------------------------------------------------
@@ -290,14 +291,15 @@ sendRspFile2XX :: Connection
290 -> H.HttpVersion
291 -> H.HttpVersion
291 -> H.Status
292 -> H.Status
292 -> H.ResponseHeaders
293 -> H.ResponseHeaders
293 -> FilePath
295 -> FilePath
294 -> Integer
296 -> Integer
295 -> Integer
297 -> Integer
298 -> IO (Maybe H.Status, Maybe Integer)
300 -> IO (Maybe H.Status, Maybe Integer)
299−sendRspFile2XX conn ii ver s hs path beg len isHead hook
301+sendRspFile2XX conn ii ver s hs rspidxhdr path beg len isHead hook
300− | isHead = sendRsp conn ii ver s hs RspNoBody
302+ | isHead = sendRsp conn ii ver s hs rspidxhdr RspNoBody
301 | otherwise = do
303 | otherwise = do
302 lheader <- composeHeader ver s hs
304 lheader <- composeHeader ver s hs
303 (mfd, fresher) <- getFd ii path
305 (mfd, fresher) <- getFd ii path
@@ -310,8 +312,9 @@ sendRspFile404 :: Connection
310 -> InternalInfo
312 -> InternalInfo
311 -> H.HttpVersion
313 -> H.HttpVersion
312 -> H.ResponseHeaders
314 -> H.ResponseHeaders
313 -> IO (Maybe H.Status, Maybe Integer)
316 -> IO (Maybe H.Status, Maybe Integer)
314−sendRspFile404 conn ii ver hs0 = sendRsp conn ii ver s hs (RspBuilder body True)
317+sendRspFile404 conn ii ver hs0 rspidxhdr = sendRsp conn ii ver s hs rspidxhdr (RspBuilder body True)
316 s = H.notFound404
319 s = H.notFound404
317 hs = replaceHeader H.hContentType "text/plain; charset=utf-8" hs0
320 hs = replaceHeader H.hContentType "text/plain; charset=utf-8" hs0