Skip to content

Commit

Permalink
Merge PR #991
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed May 23, 2024
2 parents 55adf23 + 4247e5e commit 85ad932
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions warp/Network/Wai/Handler/Warp/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,27 @@ serveConnection conn ii th origAddr transport settings app = do
if isHTTP2 transport
then return (True, "")
else do
bs0 <- connRecv conn
if S.length bs0 >= 4 && "PRI " `S.isPrefixOf` bs0
bs0 <- recv4 ""
if "PRI " `S.isPrefixOf` bs0
then return (True, bs0)
else return (False, bs0)
if settingsHTTP2Enabled settings && h2
then do
http2 settings ii conn transport app origAddr th bs
else do
http1 settings ii conn transport app origAddr th bs
where
recv4 bs0 = do
bs1 <- connRecv conn
if S.null bs1 then
return bs0
else do
-- In the case where bs0 is "", (<>) is called unnecessarily.
-- But we adopt this logic for simplicity.
let bs2 = bs0 <> bs1
if S.length bs2 >= 4
then return bs2
else recv4 bs2

-- | Set flag FileCloseOnExec flag on a socket (on Unix)
--
Expand Down

0 comments on commit 85ad932

Please sign in to comment.