Skip to content

Commit

Permalink
don't buffer unused request bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
zarqman committed Sep 19, 2023
1 parent b49f02a commit f052feb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/async/http/protocol/http1/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -109,6 +109,7 @@ def each(task: Task.current)
end
end
end

end
end
end
Expand Down

0 comments on commit f052feb

Please sign in to comment.