Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Disallow reading from a closed ResponseStream #144

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

omus
Copy link
Contributor

@omus omus commented Jan 18, 2017

Closing a ResponseStream would still allow you to continue reading content from the buffer. I've updated the code to work similarly to how IOStream's behave.

@codecov-io
Copy link

codecov-io commented Jan 18, 2017

Codecov Report

Merging #144 into master will decrease coverage by 0.74%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
- Coverage   70.17%   69.42%   -0.75%     
==========================================
  Files           4        4              
  Lines         523      520       -3     
==========================================
- Hits          367      361       -6     
- Misses        156      159       +3
Impacted Files Coverage Δ
src/streaming.jl 74.59% <100%> (-4.41%) ⬇️
src/Requests.jl 60% <0%> (-1.23%) ⬇️
src/multipart.jl 61.73% <0%> (+2.6%) ⬆️

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 c2c07cd...7cafa47. Read the comment docs.

@aviks
Copy link
Member

aviks commented Jul 14, 2017

@omus should we merge this?

@omus
Copy link
Contributor Author

omus commented Jul 14, 2017

@aviks I'm not sure that this should be the behaviour anymore based upon JuliaWeb/HTTP.jl#45 (comment). @samoconnor can you elaborate on why you want to be able to read from the buffer when the socket has been closed?

@samoconnor
Copy link
Contributor

Hi @aviks, perhaps there is confusion about the reader closing the stream vs the server closing the stream.

If the server has closed the stream (or the connection was unexpectedly lost), the reader should be able to continue to read whatever was received from the buffer until there is nothing left to read.

If the reader calls close on the stream, that indicates that they do not intend to read anything else from the stream, I think any subsequent calls to read or eof for that stream should result in an exception e.g. "ERROR: Attempted access to closed stream".

Of course, if this assumes a uni-directional stream. If the stream is read/write, then there needs to be a way to close the write half without closing the read half (i.e. shutdown(socket, SHUT_WR)) so that the writer can signal that they have finished sending a request, but can still receive a response from the read half of the stream.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants