on master help sign in
If the first line is really invalid, don't send an error response.

This is to pass `h2spec http2/3.5`.

commit89635f78cf041e01e1b8238c1233f39682059c00 authorKazu Yamamoto <kazu@iij.ad.jp> dateFri 28 Jun 2019, 08:51 (7 years ago) parentf782732
1 file changed+11−7
warp/Network/Wai/Handler/Warp/Run.hs+11−7
warp/Network/Wai/Handler/Warp/Run.hs+11−7
@@ -6,6 +6,7 @@
66{-# LANGUAGE RecordWildCards #-}
77{-# LANGUAGE ScopedTypeVariables #-}
88{-# LANGUAGE TupleSections #-}
9+{-# LANGUAGE ViewPatterns #-}
910{-# OPTIONS_GHC -fno-warn-deprecations #-}
1011
1112module Network.Wai.Handler.Warp.Run where
@@ -343,13 +344,16 @@ serveConnection conn ii th origAddr transport settings app = do
343344 leftoverSource src bs
344345 addr <- getProxyProtocolAddr src
345346 http1 True addr istatus src `E.catch` \e ->
346− case fromException e of
347− -- See comment below referencing
348− -- https://github.com/yesodweb/wai/issues/618
349− Just NoKeepAliveRequest -> return ()
350− Nothing -> do
351− _ <- sendErrorResponse (dummyreq addr) istatus e
352− throwIO e
347+ case () of
348+ ()
349+ -- See comment below referencing
350+ -- https://github.com/yesodweb/wai/issues/618
351+ | Just NoKeepAliveRequest <- fromException e -> return ()
352+ -- No valid request
353+ | Just (BadFirstLine _) <- fromException e -> return ()
354+ | otherwise -> do
355+ _ <- sendErrorResponse (dummyreq addr) istatus e
356+ throwIO e
353357
354358 where
355359 getProxyProtocolAddr src =