Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of unconsumed request bodies at end of http1 requests #138

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading