@@ -15,6 +15,17 @@ import Control.Monad (unless)
15import Data.Function (fix)
15import Data.Function (fix)
16import System.Posix
16import System.Posix
18+-- |Convert ResponseFile type responses into ResponseStream type
20+-- Checks the response type, and if it's a ResponseFile, converts it
21+-- into a ResponseStream. Other response types are passed through
24+-- Converted responses get a Content-Length header.
26+-- Streaming a file will bypass a sendfile system call, and may be
27+-- useful to work around systems without working sendfile
18streamFile :: Middleware
29streamFile :: Middleware
19streamFile app env sendResponse = app env $ \res ->
30streamFile app env sendResponse = app env $ \res ->
20 case res of
31 case res of