From abfd8cff86d05d8c0798f765113964d13be7816e Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 4 Sep 2024 12:48:31 +1200 Subject: [PATCH] Ensure upgrade and tunnel responses correctly exit the request loop. --- lib/async/http/protocol/http1/server.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/async/http/protocol/http1/server.rb b/lib/async/http/protocol/http1/server.rb index 91e1010..19078a6 100644 --- a/lib/async/http/protocol/http1/server.rb +++ b/lib/async/http/protocol/http1/server.rb @@ -71,7 +71,8 @@ def each(task: Task.current) request = nil unless request.body response = nil - body.call(stream) + # We must return here as no further request processing can be done: + return body.call(stream) else write_response(@version, response.status, response.headers) @@ -82,7 +83,8 @@ def each(task: Task.current) request = nil unless request.body response = nil - body.call(stream) + # We must return here as no further request processing can be done: + return body.call(stream) else head = request.head? version = request.version