We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8046af7 commit 4764c5aCopy full SHA for 4764c5a
lib/protocol/http/body/stream.rb
@@ -19,6 +19,7 @@ def initialize(input = nil, output = Buffered.new)
19
# Will hold remaining data in `#read`.
20
@buffer = nil
21
@closed = false
22
+ @closed_read = false
23
end
24
25
attr :input
@@ -146,6 +147,7 @@ def flush
146
147
148
149
def close_read
150
+ @closed_read = true
151
@input&.close
152
@input = nil
153
@@ -181,8 +183,7 @@ def empty?
181
183
def read_next
182
184
if @input
185
return @input.read
- else
- @input = nil
186
+ elsif @closed_read
187
raise IOError, "Stream is not readable, input has been closed!"
188
189
0 commit comments