Repository navigation
Release a partially read HTTP/1 request body after the response - #256
Closed
andrewfader wants to merge 1 commit into
Closed
andrewfader wants to merge 1 commit into
andrewfader wants to merge 1 commit into
Conversation
Signed-off-by: Andrew Fader <fader@yagni.co>
Member
|
If you partially read an input body, you must either (1) completely read it or (2) close it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an application reads part of an HTTP/1 request body and then responds without reading the rest (for example, rejecting an upload),
Finishable#waitwaits for that body to close, with no timeout. The connection hangs until the client goes away. See #213.This changes
waitto release a partially read body after the response is sent, the same way it already handles an unread one:discardit when the connection is persistent, otherwisecloseit. Test added.This breaks 2 existing tests, both the shared "an echo client" example:
test/protocol/http/body/stream.rbandtest/protocol/http/body/streamable.rb(HTTP/1). That app closes its response and then keeps reading the request body in another task, which this change discards out from under it, so the tests time out. Opening as a draft to ask which layer you'd rather fix this in: async-http'sFinishablehere, or protocol-rack's response handling (socketry/protocol-rack#41).