on master help sign in
Throw ConnectionClosedByPeer exception if the client closed the connection (like in warp-tls)
commit479eb9c4300afde8f73f5dae8c97938c8403d69c authorGiorgio Marinelli <giorgio@marinel.li> dateThu 20 Feb 2020, 18:02 (7 years ago) parent36ec4e6
1 file changed+4−1
warp/Network/Wai/Handler/Warp/Run.hs+4−1
warp/Network/Wai/Handler/Warp/Run.hs+4−1
@@ -62,7 +62,7 @@ socketConnection :: Settings -> Socket -> IO Connection
6262socketConnection set s = do
6363 bufferPool <- newBufferPool
6464 writeBuf <- allocateBuffer bufferSize
65− let sendall = Sock.sendAll s
65+ let sendall = sendAll' s
6666 isH2 <- newIORef False -- HTTP/1.x
6767 return Connection {
6868 connSendMany = Sock.sendMany s
@@ -87,6 +87,9 @@ socketConnection set s = do
8787 , connBufferSize = bufferSize
8888 , connHTTP2 = isH2
8989 }
90+ where
91+ sendAll' sock bs = Sock.sendAll sock bs `E.catch` \(SomeException _) ->
92+ throwIO ConnectionClosedByPeer
9093
9194-- | Run an 'Application' on the given port.
9295-- This calls 'runSettings' with 'defaultSettings'.