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