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 31fc98c commit 927ed9cCopy full SHA for 927ed9c
1 file changed
lib/protocol/rack/input.rb
@@ -89,7 +89,7 @@ def flush
89
# No-op.
90
end
91
92
- def sysread(size, buffer = nil)
+ def sysread(size, buffer)
93
if @body
94
# User's may forget to call #close...
95
if chunk = @body.read
@@ -100,13 +100,8 @@ def sysread(size, buffer = nil)
100
@closed = true
101
102
103
- if buffer
104
- # If a buffer is provided, we copy the chunk into it:
105
- buffer.replace(chunk)
106
- else
107
- # Otherwise we return the chunk directly:
108
- buffer = chunk
109
- end
+ # The buffer is always provided, and we replace its contents:
+ buffer.replace(chunk)
110
111
return buffer
112
else
0 commit comments