Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensuring to receive 4 bytes. #991

Merged
merged 3 commits into from
May 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = do
bs0 <- connRecv conn
if S.length bs0 >= 4
then return bs0
else loop bs0
loop bs0 = do
bs1 <- connRecv conn
let bs = bs0 `S.append` bs1
if S.length bs >= 4
then return bs
else loop bs

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