warp 3.3.2 → 3.3.3
raw patch · 3 files changed
+27/−13 lines, 3 files
Files
- ChangeLog.md +5/−0
- Network/Wai/Handler/Warp/HTTP2.hs +21/−12
- warp.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+## 3.3.3++* Calling setOnException in HTTP/2.+ [#771](https://github.com/yesodweb/wai/pull/771)+ ## 3.3.2 * Fixing a bug of HTTP/2 without fd cache.
Network/Wai/Handler/Warp/HTTP2.hs view
@@ -6,6 +6,7 @@ module Network.Wai.Handler.Warp.HTTP2 (http2) where +import qualified Data.IORef as I import qualified Control.Exception as E import qualified Network.HTTP2.Server as H2 import Network.Socket (SockAddr)@@ -37,21 +38,29 @@ http2server h2req aux response = do req <- toWAIRequest h2req aux- ResponseReceived <- app req $ \rsp -> do+ ref <- I.newIORef Nothing+ eResponseReceived <- E.try $ app req $ \rsp -> do h2rsp <- fromResponse settings ii req rsp pps <- fromPushPromises ii req- ex <- E.try $ response h2rsp pps- case ex of- Right () -> do- logResponse h2rsp req- mapM_ (logPushPromise req) pps- Left e@(E.SomeException _)- -- killed by the local worker manager- | Just E.ThreadKilled <- E.fromException e -> return ()- -- killed by the local timeout manager- | Just T.TimeoutThread <- E.fromException e -> return ()- | otherwise -> S.settingsOnException settings (Just req) e+ I.writeIORef ref $ Just (h2rsp, pps)+ _ <- response h2rsp pps return ResponseReceived+ case eResponseReceived of+ Right ResponseReceived -> do+ Just (h2rsp, pps) <- I.readIORef ref+ logResponse h2rsp req+ mapM_ (logPushPromise req) pps+ Left e@(E.SomeException _)+ -- killed by the local worker manager+ | Just E.ThreadKilled <- E.fromException e -> return ()+ -- killed by the local timeout manager+ | Just T.TimeoutThread <- E.fromException e -> return ()+ | otherwise -> do+ S.settingsOnException settings (Just req) e+ let ersp = S.settingsOnExceptionResponse settings e+ h2rsp' <- fromResponse settings ii req ersp+ _ <- response h2rsp' []+ logResponse h2rsp' req return () toWAIRequest h2req aux = toRequest ii settings addr hdr bdylen bdy th
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 3.3.2+Version: 3.3.3 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE