Skip to content

Commit 1c31a3c

Browse files
committed
http/h2_connection: When looking for preface, return nil if socket was closed before peer sent anything
1 parent 79815ee commit 1c31a3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

http/h2_connection.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ local function socket_has_preface(socket, unget, timeout)
7070
local ok, err, errno = socket:xread(#bytes-#preface, deadline and (deadline-monotime()))
7171
if ok == nil then
7272
if err == nil then
73+
if #bytes == 0 then
74+
-- client immediately closed
75+
return
76+
end
7377
is_h2 = false
7478
break
7579
else

0 commit comments

Comments
 (0)