@@ -167,7 +167,7 @@ sendResponse conn ii req reqidxhdr src response = do
167167 T.tickle th
168168 return ret
169169 else do
170− sendResponseNoBody conn ver s hs response
170+ sendResponseNoBody conn ver s hs
171171 T.tickle th
172172 return isPersist
173173 where
@@ -196,7 +196,7 @@ sendResponse conn ii req reqidxhdr src response = do
196196
197197data Rsp = RspFile FilePath (Maybe FilePart) (Maybe HeaderValue) (IO ())
198198 | RspBuilder Builder Bool
199− | RspStream ((Maybe Builder -> IO ()) -> IO ()) Bool T.Handle
199+ | RspStream StreamingBody Bool T.Handle
200200 | RspRaw (IO ByteString -> (ByteString -> IO ()) -> IO ()) (IO ByteString) (IO ())
201201
202202----------------------------------------------------------------
@@ -250,9 +250,7 @@ sendRsp conn ver s hs (RspStream withBodyFlush needsChunked th) = do
250250 loop
251251 loop
252252 addChunk header
253− withBodyFlush $ \mbuilder -> addChunk $ case mbuilder of
254− Nothing -> flush
255− Just builder -> chunkedTransferEncoding builder
253+ withBodyFlush (addChunk . chunkedTransferEncoding) (addChunk flush)
256254 when needsChunked $ addChunk chunkedTransferTerminator
257255 mbs <- finish
258256 maybe (return ()) (connSink conn th) mbs
@@ -274,22 +272,8 @@ sendResponseNoBody :: Connection
274272 -> H.HttpVersion
275273 -> H.Status
276274 -> H.ResponseHeaders
277− -> Response
278275 -> IO ()
279−sendResponseNoBody conn ver s hs (ResponseStream _ _ withBodyFlush) = do
280− -- Allow the application to free resources
281− withBodyFlush $ const $ return ()
282−
283− composeHeader ver s hs >>= connSendAll conn
284−sendResponseNoBody conn ver s hs (ResponseRaw withRaw _) = do
285− -- Allow the application to free resources
286− withRaw (return S.empty) (const $ return ())
287−
288− composeHeader ver s hs >>= connSendAll conn
289−sendResponseNoBody conn ver s hs ResponseBuilder{} =
290− composeHeader ver s hs >>= connSendAll conn
291−sendResponseNoBody conn ver s hs ResponseFile{} =
292− composeHeader ver s hs >>= connSendAll conn
276+sendResponseNoBody conn ver s hs = composeHeader ver s hs >>= connSendAll conn
293277
294278----------------------------------------------------------------
295279----------------------------------------------------------------