Skip to content

Commit 9f325c7

Browse files
zarqmanioquatix
authored andcommitted
don't buffer unused request bodies
1 parent 789983a commit 9f325c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/async/http/protocol/http1/server.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def each(task: Task.current)
8383
version = request.version
8484

8585
# Same as above:
86-
request = nil unless body
86+
request = nil unless request.body
8787
response = nil
8888

8989
write_body(version, body, head, trailer)
@@ -98,7 +98,7 @@ def each(task: Task.current)
9898
end
9999

100100
# Gracefully finish reading the request body if it was not already done so.
101-
request&.finish
101+
request&.each{}
102102

103103
# This ensures we yield at least once every iteration of the loop and allow other fibers to execute.
104104
task.yield
@@ -109,6 +109,7 @@ def each(task: Task.current)
109109
end
110110
end
111111
end
112+
112113
end
113114
end
114115
end

0 commit comments

Comments
 (0)