@@ -169,15 +169,15 @@ serveConnection th onException port app conn remoteHost' = do
170 fromClient = enumSocket th bytesPerRead conn
170 fromClient = enumSocket th bytesPerRead conn
171 serveConnection' = do
171 serveConnection' = do
172− (enumeratee, env) <- parseRequest port remoteHost'
172+ (len, env) <- parseRequest port remoteHost'
173 -- Let the application run for as long as it wants
173 -- Let the application run for as long as it wants
174 liftIO $ T.pause th
174 liftIO $ T.pause th
175− res <- E.joinI $ enumeratee $$ app env
175+ res <- E.joinI $ EB.isolate len $$ app env
176 liftIO $ T.resume th
176 liftIO $ T.resume th
177 keepAlive <- liftIO $ sendResponse th env (httpVersion env) conn res
177 keepAlive <- liftIO $ sendResponse th env (httpVersion env) conn res
178 if keepAlive then serveConnection' else return ()
178 if keepAlive then serveConnection' else return ()
180−parseRequest :: Port -> SockAddr -> E.Iteratee S.ByteString IO (E.Enumeratee ByteString ByteString IO a, Request)
180+parseRequest :: Port -> SockAddr -> E.Iteratee S.ByteString IO (Integer, Request)
181parseRequest port remoteHost' = do
181parseRequest port remoteHost' = do
182 headers' <- takeHeaders
182 headers' <- takeHeaders
183 parseRequest' port headers' remoteHost'
183 parseRequest' port headers' remoteHost'
@@ -205,7 +205,7 @@ instance Exception InvalidRequest
205parseRequest' :: Port
205parseRequest' :: Port
206 -> [ByteString]
206 -> [ByteString]
207 -> SockAddr
207 -> SockAddr
208− -> E.Iteratee S.ByteString IO (E.Enumeratee S.ByteString S.ByteString IO a, Request)
208+ -> E.Iteratee S.ByteString IO (Integer, Request)
209parseRequest' _ [] _ = E.throwError $ NotEnoughLines []
209parseRequest' _ [] _ = E.throwError $ NotEnoughLines []
210parseRequest' port (firstLine:otherLines) remoteHost' = do
210parseRequest' port (firstLine:otherLines) remoteHost' = do
211 (method, rpath', gets, httpversion) <- parseFirst firstLine
211 (method, rpath', gets, httpversion) <- parseFirst firstLine
@@ -224,7 +224,7 @@ parseRequest' port (firstLine:otherLines) remoteHost' = do
224 let serverName' = takeUntil 58 host -- ':'
224 let serverName' = takeUntil 58 host -- ':'
225 -- FIXME isolate takes an Integer instead of Int or Int64. If this is a
225 -- FIXME isolate takes an Integer instead of Int or Int64. If this is a
226 -- performance penalty, we may need our own version.
226 -- performance penalty, we may need our own version.
227− return (EB.isolate len, Request
227+ return (len, Request
228 { requestMethod = method
228 { requestMethod = method
229 , httpVersion = httpversion
229 , httpVersion = httpversion
230 , pathInfo = H.decodePathSegments rpath
230 , pathInfo = H.decodePathSegments rpath