Do not call close() on the response_stream#775
Merged
Conversation
This allows a plain `IOBuffer` to be used with `response_stream`. It seems unnecessary to be calling `close(response_stream)` inside HTTP.request() - given that HTTP.request is a blocking operation, the caller can easily close the stream themselves after `HTTP.request()` returns. This could be considered a breaking change for users who use the internal IO type Base.BufferStream with the response_stream keyword. Fixes #543
Codecov Report
@@ Coverage Diff @@
## master #775 +/- ##
==========================================
- Coverage 76.84% 76.84% -0.01%
==========================================
Files 39 39
Lines 2501 2500 -1
==========================================
- Hits 1922 1921 -1
Misses 579 579
Continue to review full report at Codecov.
|
Member
|
I resolved the conflict here; once/if tests pass, I'll merge as we prepare for a 1.0 release. |
Contributor
Author
|
Thanks for pushing this through! |
quinnj
added a commit
that referenced
this pull request
Mar 10, 2022
This allows a plain `IOBuffer` to be used with `response_stream`. It seems unnecessary to be calling `close(response_stream)` inside HTTP.request() - given that HTTP.request is a blocking operation, the caller can easily close the stream themselves after `HTTP.request()` returns. This could be considered a breaking change for users who use the internal IO type Base.BufferStream with the response_stream keyword. Fixes #543 Co-authored-by: Jacob Quinn <quinn.jacobd@gmail.com>
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.
This PR re-proposes #752.
This was too breaking for the stable release series as was discovered in #773 (comment), so needs to be part of a breaking release (I have added a
breakinglabel for this purpose).However I still think this is the correct behavior:
HTTP.request()doesn't really own the response stream, and closing it inside the request handler doesn't bring additional functionality becauseHTTP.requestis a blocking operation - the caller should easily be able to close the stream themselves:This argument applies to either
closeor the newclosewrite.The
close()was added in 422c8f5 but it's not really clear why. Additional discussion can be found in #543.Original description from #752
This allows a plain
IOBufferto be used withresponse_stream.It seems unnecessary to be calling
close(response_stream)insideHTTP.request() - given that HTTP.request is a blocking operation, the
caller can easily close the stream themselves after
HTTP.request()returns.
This could be considered a breaking change for users who use the
internal IO type Base.BufferStream with the response_stream keyword.
Fixes #543