@@ -333,9 +333,14 @@ serveConnection conn ii1 origAddr transport settings app = do
333333 writeIORef istatus True
334334 leftoverSource src bs
335335 addr <- getProxyProtocolAddr src
336− http1 True addr istatus src `E.catch` \e -> do
337− sendErrorResponse addr istatus e
338− throwIO (e :: SomeException)
336+ http1 True addr istatus src `E.catch` \e ->
337+ case fromException e of
338+ -- See comment below referencing
339+ -- https://github.com/yesodweb/wai/issues/618
340+ Just NoKeepAliveRequest -> return ()
341+ Nothing -> do
342+ sendErrorResponse addr istatus e
343+ throwIO e
339344 where
340345 getProxyProtocolAddr src =
341346 case settingsProxyProtocol settings of
@@ -413,7 +418,7 @@ serveConnection conn ii1 origAddr transport settings app = do
413418 -- request headers, no data is available, recvRequest will
414419 -- throw a NoKeepAliveRequest exception, which we catch here
415420 -- and ignore. See: https://github.com/yesodweb/wai/issues/618
416− when keepAlive $ http1 False addr istatus src `E.catch` \NoKeepAliveRequest -> return ()
421+ when keepAlive $ http1 False addr istatus src
417422
418423 processRequest istatus src req mremainingRef idxhdr nextBodyFlush ii = do
419424 -- Let the application run for as long as it wants