Bug #9927 ยป 0001-lib-webrick-httpresponse.rb-unset-content-length-hea.patch
lib/webrick/httpresponse.rb | ||
---|---|---|
end
|
||
# Determine the message length (RFC2616 -- 4.4 Message Length)
|
||
if @status == 304 || @status == 204 || HTTPStatus::info?(@status)
|
||
if @status == 304 || @status == 204 || HTTPStatus::info?(@status) || @request_method == 'HEAD'
|
||
@header.delete('content-length')
|
||
@body = ""
|
||
elsif chunked?
|
test/webrick/test_httpresponse.rb | ||
---|---|---|
r.binmode
|
||
assert_equal "5\r\nhello\r\n0\r\n\r\n", r.read
|
||
end
|
||
def test_head_does_not_return_body
|
||
res.request_method = 'HEAD'
|
||
res.body = 'ignored'
|
||
res.setup_header
|
||
assert_equal nil, res.header['content-length']
|
||
assert_equal '', res.body
|
||
end
|
||
end
|
||
end
|