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

Do not call close() on the response_stream #752

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

c42f
Copy link
Contributor

@c42f c42f commented Sep 8, 2021

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

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-commenter
Copy link

codecov-commenter commented Sep 8, 2021

Codecov Report

Merging #752 (7b6722f) into master (cfcc595) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #752      +/-   ##
==========================================
- Coverage   76.84%   76.84%   -0.01%     
==========================================
  Files          38       38              
  Lines        2514     2513       -1     
==========================================
- Hits         1932     1931       -1     
  Misses        582      582              
Impacted Files Coverage Δ
src/StreamRequest.jl 95.45% <ø> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfcc595...7b6722f. Read the comment docs.

Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; I'm disappointed in the testing situation. I thought using the pie-socket site for the websocket tests would work well, but the failures in the CI here seem like random failures.

@c42f
Copy link
Contributor Author

c42f commented Sep 8, 2021

Downloads.jl uses httpbingo.julialang.org for testing, but unfortunately I don't think that supports websockets.

Are we happy to merge right away, even though this is arguably breaking?

@quinnj
Copy link
Member

quinnj commented Sep 8, 2021

Yeah, fine by me

@c42f c42f merged commit 03749a4 into master Sep 8, 2021
@c42f c42f deleted the cjf/no-close-response-stream branch September 8, 2021 06:30
@omus
Copy link
Contributor

omus commented Sep 22, 2021

Can we get a release that includes this fix?

@fredrikekre
Copy link
Member

#769

bors bot added a commit to JuliaCloud/AWS.jl that referenced this pull request Sep 28, 2021
467: Always close the `response_stream` after `HTTP.request` r=mattBrzezinski a=nickrobinson251

- We need to explicitly close the `response_stream`
  (`HTTP.request` no longer closes it for us)
  in HTTP.jl v0.9.15+ (see JuliaWeb/HTTP.jl#752)
- Since `close` is safe to call multiple times,
  this should be compatible with old HTTP.jl versions. 
- Should fix issue #466 (and JuliaCloud/AWSS3.jl#215)
- Also since we're fixing this here, we can close JuliaWeb/HTTP.jl#772

~TODO: add test... i just need to recreate the issue using AWS.jl explicitly (rather than AWSS3)~ done.

Co-authored-by: Nick Robinson <nicholas.robinson@invenialabs.co.uk>
Co-authored-by: Nick Robinson <npr251@gmail.com>
bors bot added a commit to JuliaCloud/AWS.jl that referenced this pull request Sep 28, 2021
467: Always close the `response_stream` after `HTTP.request` r=mattBrzezinski a=nickrobinson251

- We need to explicitly close the `response_stream`
  (`HTTP.request` no longer closes it for us)
  in HTTP.jl v0.9.15+ (see JuliaWeb/HTTP.jl#752)
- Since `close` is safe to call multiple times,
  this should be compatible with old HTTP.jl versions. 
- Should fix issue #466 (and JuliaCloud/AWSS3.jl#215)
- Also since we're fixing this here, we can close JuliaWeb/HTTP.jl#772

~TODO: add test... i just need to recreate the issue using AWS.jl explicitly (rather than AWSS3)~ done.

Co-authored-by: Nick Robinson <nicholas.robinson@invenialabs.co.uk>
Co-authored-by: Nick Robinson <npr251@gmail.com>
fredrikekre added a commit that referenced this pull request Sep 29, 2021
fredrikekre added a commit that referenced this pull request Sep 29, 2021
c42f added a commit that referenced this pull request Oct 5, 2021
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
quinnj added a commit that referenced this pull request Dec 15, 2021
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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

response_stream breaks with IOBuffer()
5 participants