on master help sign in
don't send response in the case of ConnectionClosedByPeer.
commit2936c257fc729ed10fb3c882fe03d4a73d07a6f8 authorKazu Yamamoto <kazu@iij.ad.jp> dateFri 4 Dec 2015, 14:59 (11 years ago) parent82ee2ab
1 file changed+6−1
warp/Network/Wai/Handler/Warp/Run.hs+6−1
warp/Network/Wai/Handler/Warp/Run.hs+6−1
@@ -2,6 +2,7 @@
22{-# LANGUAGE OverloadedStrings #-}
33{-# LANGUAGE ScopedTypeVariables #-}
44{-# LANGUAGE TupleSections #-}
5+{-# LANGUAGE PatternGuards #-}
56{-# OPTIONS_GHC -fno-warn-deprecations #-}
67
78module Network.Wai.Handler.Warp.Run where
@@ -445,9 +446,13 @@ serveHTTP2 app2 app conn ii origAddr transport settings = do
445446
446447 th = threadHandle ii
447448
449+ shouldSendErrorResponse se
450+ | Just ConnectionClosedByPeer <- fromException se = False
451+ | otherwise = True
452+
448453 sendErrorResponse addr istatus e = do
449454 status <- readIORef istatus
450− when status $ void $
455+ when (shouldSendErrorResponse e && status) $ void $
451456 sendResponse settings conn ii (dummyreq addr) defaultIndexRequestHeader (return S.empty) (errorResponse e)
452457
453458 dummyreq addr = defaultRequest { remoteHost = addr }