@@ -162,7 +162,7 @@ allowInterrupt = unblock $ return ()
162162data Connection = Connection
163163 { connSendMany :: [B.ByteString] -> IO ()
164164 , connSendAll :: B.ByteString -> IO ()
165− , connSendFile :: FilePath -> Integer -> Integer -> IO () -> IO () -- ^ offset, length
165+ , connSendFile :: FilePath -> Integer -> Integer -> IO () -> [ByteString] -> IO () -- ^ offset, length
166166 , connClose :: IO ()
167167 , connRecv :: IO B.ByteString
168168 }
@@ -171,7 +171,7 @@ socketConnection :: Socket -> Connection
171171socketConnection s = Connection
172172 { connSendMany = Sock.sendMany s
173173 , connSendAll = Sock.sendAll s
174− , connSendFile = \fp off len act -> sendfile s fp (PartOfFile off len) act
174+ , connSendFile = \fp off len act hdr -> sendfileWithHeader s fp (PartOfFile off len) act hdr
175175 , connClose = sClose s
176176 , connRecv = Sock.recv s bytesPerRead
177177 }
@@ -586,13 +586,12 @@ sendResponse th req conn r = sendResponse' r
586586 [("Content-Type", "text/plain")]
587587 "File not found"
588588 Right (lengthyHeaders, cl) -> liftIO $ do
589− let headers' = headers version s lengthyHeaders
590− sendHeader $ headers' False
589+ let headers' = L.toChunks . toLazyByteString $ headers version s lengthyHeaders False
591590 T.tickle th
592591 if hasBody s req then do
593592 case mpart of
594− Nothing -> connSendFile conn fp 0 cl (T.tickle th)
595− Just part -> connSendFile conn fp (filePartOffset part) (filePartByteCount part) (T.tickle th)
593+ Nothing -> connSendFile conn fp 0 cl (T.tickle th) headers'
594+ Just part -> connSendFile conn fp (filePartOffset part) (filePartByteCount part) (T.tickle th) headers'
596595 T.tickle th
597596 return isPersist
598597 else