on master help sign in
Merge commit 'bc5e1' into beta
2011bd0Michael Snoyman
warp/Network/Wai/Handler/Warp.hs+5−6
@@ -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
168 }
168 }
@@ -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
177 }
177 }
@@ -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
596 else
595 else
warp/warp.cabal+1−1
@@ -26,7 +26,7 @@ Library
26 , blaze-builder-conduit >= 0.5 && < 0.6
26 , blaze-builder-conduit >= 0.5 && < 0.6
27 , lifted-base >= 0.1 && < 0.2
27 , lifted-base >= 0.1 && < 0.2
28 , blaze-builder >= 0.2.1.4 && < 0.4
28 , blaze-builder >= 0.2.1.4 && < 0.4
29− , simple-sendfile >= 0.2.2 && < 0.3
29+ , simple-sendfile >= 0.2.4 && < 0.3
30 , http-types >= 0.6 && < 0.7
30 , http-types >= 0.6 && < 0.7
31 , case-insensitive >= 0.2
31 , case-insensitive >= 0.2
32 , unix-compat >= 0.2
32 , unix-compat >= 0.2