on master help sign in
Fix ResourceT change.

We need to make sure that runResourceT isn't called until after the response body is sent.

commitf1ccbe83d56a5ed87cf45eae80ce4f6d347384f9 authorMichael Snoyman <michael@snoyman.com> dateSun 30 Sep 2012, 02:33 (14 years ago) parentc82539f
1 file changed+4−3
warp/Network/Wai/Handler/Warp/Run.hs+4−3
warp/Network/Wai/Handler/Warp/Run.hs+4−3
@@ -177,10 +177,11 @@ serveConnection settings cleaner port app conn remoteHost' =
177177 Nothing -> do
178178 -- Let the application run for as long as it wants
179179 liftIO $ T.pause th
180− res <- lift $ runResourceT $ app env
180+ keepAlive <- lift $ runResourceT $ do
181+ res <- app env
181182
182− liftIO $ T.resume th
183− keepAlive <- sendResponse cleaner env conn res
183+ liftIO $ T.resume th
184+ sendResponse cleaner env conn res
184185
185186 -- flush the rest of the request body
186187 requestBody env $$ CL.sinkNull