@@ -162,7 +162,7 @@ allowInterrupt = unblock $ return ()
162data Connection = Connection
162data Connection = Connection
163 { connSendMany :: [B.ByteString] -> IO ()
163 { connSendMany :: [B.ByteString] -> IO ()
164 , connSendAll :: B.ByteString -> IO ()
164 , connSendAll :: B.ByteString -> IO ()
165− , connSendFile :: FilePath -> Integer -> Integer -> IO () -> IO () -- ^ offset, length
165+ , connSendFile :: FilePath -> Integer -> Integer -> IO () -> [ByteString] -> IO () -- ^ offset, length
166 , connClose :: IO ()
166 , connClose :: IO ()
167 , connRecv :: IO B.ByteString
167 , connRecv :: IO B.ByteString
@@ -171,7 +171,7 @@ socketConnection :: Socket -> Connection
171socketConnection s = Connection
171socketConnection s = Connection
172 { connSendMany = Sock.sendMany s
172 { connSendMany = Sock.sendMany s
173 , connSendAll = Sock.sendAll s
173 , 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
175 , connClose = sClose s
175 , connClose = sClose s
176 , connRecv = Sock.recv s bytesPerRead
176 , connRecv = Sock.recv s bytesPerRead
@@ -584,13 +584,12 @@ sendResponse th req conn r = sendResponse' r
584 [("Content-Type", "text/plain")]
584 [("Content-Type", "text/plain")]
585 "File not found"
585 "File not found"
586 Right (lengthyHeaders, cl) -> liftIO $ do
586 Right (lengthyHeaders, cl) -> liftIO $ do
587− let headers' = headers version s lengthyHeaders
587+ let headers' = L.toChunks . toLazyByteString $ headers version s lengthyHeaders False
588− sendHeader $ headers' False
589 T.tickle th
588 T.tickle th
590 if hasBody s req then do
589 if hasBody s req then do
591 case mpart of
590 case mpart of
592− Nothing -> connSendFile conn fp 0 cl (T.tickle th)
591+ Nothing -> connSendFile conn fp 0 cl (T.tickle th) headers'
593− Just part -> connSendFile conn fp (filePartOffset part) (filePartByteCount part) (T.tickle th)
592+ Just part -> connSendFile conn fp (filePartOffset part) (filePartByteCount part) (T.tickle th) headers'
594 T.tickle th
593 T.tickle th
595 return isPersist
594 return isPersist