[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
@ -155,6 +155,7 @@ module WEBrick
|
|||||||
# Sets the response header +field+ to +value+
|
# Sets the response header +field+ to +value+
|
||||||
|
|
||||||
def []=(field, value)
|
def []=(field, value)
|
||||||
|
@chunked = value.to_s.downcase == 'chunked' if field.downcase == 'transfer-encoding'
|
||||||
@header[field.downcase] = value.to_s
|
@header[field.downcase] = value.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,6 +133,13 @@ module WEBrick
|
|||||||
assert_equal 0, logger.messages.length
|
assert_equal 0, logger.messages.length
|
||||||
end
|
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
|
def test_send_body_io
|
||||||
IO.pipe {|body_r, body_w|
|
IO.pipe {|body_r, body_w|
|
||||||
body_w.write 'hello'
|
body_w.write 'hello'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user