зеркало из https://github.com/github/ruby.git
webrick/httpresponse: make ChunkedWrapper copy_stream-compatible
The .write method needs to return the number of bytes written to avoid confusing IO.copy_stream. * lib/webrick/httpresponse.rb (ChunkedWrapper#write): return bytes written (ChunkedWrapper#<<): return self git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6676a217f3
Коммит
d6c0b3d787
|
@ -467,7 +467,7 @@ module WEBrick
|
|||
end
|
||||
|
||||
def write(buf)
|
||||
return if buf.empty?
|
||||
return 0 if buf.empty?
|
||||
socket = @socket
|
||||
@resp.instance_eval {
|
||||
size = buf.bytesize
|
||||
|
@ -475,9 +475,14 @@ module WEBrick
|
|||
socket.write(data)
|
||||
data.clear
|
||||
@sent_size += size
|
||||
size
|
||||
}
|
||||
end
|
||||
alias :<< :write
|
||||
|
||||
def <<(*buf)
|
||||
write(buf)
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
# preserved for compatibility with some 3rd-party handlers
|
||||
|
|
Загрузка…
Ссылка в новой задаче