From 9f325c719c1e55494d28d57d595971580646d7c0 Mon Sep 17 00:00:00 2001 From: thomas morgan Date: Mon, 18 Sep 2023 17:48:36 -0600 Subject: [PATCH] don't buffer unused request bodies --- lib/async/http/protocol/http1/server.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/async/http/protocol/http1/server.rb b/lib/async/http/protocol/http1/server.rb index f5d9a168..23e1160b 100644 --- a/lib/async/http/protocol/http1/server.rb +++ b/lib/async/http/protocol/http1/server.rb @@ -83,7 +83,7 @@ def each(task: Task.current) version = request.version # Same as above: - request = nil unless body + request = nil unless request.body response = nil write_body(version, body, head, trailer) @@ -98,7 +98,7 @@ def each(task: Task.current) end # Gracefully finish reading the request body if it was not already done so. - request&.finish + request&.each{} # This ensures we yield at least once every iteration of the loop and allow other fibers to execute. task.yield @@ -109,6 +109,7 @@ def each(task: Task.current) end end end + end end end