mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/webrick] Enabled chunked encoding if Transfer-Encoding: chunked header is set
Patch from Leonard Garvey. Fixes Ruby Bug 9986. https://github.com/ruby/webrick/commit/8cff7f3995
This commit is contained in:
parent
edfbffb241
commit
a98632d5c2
2 changed files with 8 additions and 0 deletions
|
@ -155,6 +155,7 @@ module WEBrick
|
|||
# Sets the response header +field+ to +value+
|
||||
|
||||
def []=(field, value)
|
||||
@chunked = value.to_s.downcase == 'chunked' if field.downcase == 'transfer-encoding'
|
||||
@header[field.downcase] = value.to_s
|
||||
end
|
||||
|
||||
|
|
|
@ -133,6 +133,13 @@ module WEBrick
|
|||
assert_equal 0, logger.messages.length
|
||||
end
|
||||
|
||||
def test_200_chunked_does_not_set_content_length
|
||||
res.chunked = false
|
||||
res["Transfer-Encoding"] = 'chunked'
|
||||
res.setup_header
|
||||
assert_nil res.header.fetch('content-length', nil)
|
||||
end
|
||||
|
||||
def test_send_body_io
|
||||
IO.pipe {|body_r, body_w|
|
||||
body_w.write 'hello'
|
||||
|
|
Loading…
Reference in a new issue