зеркало из https://github.com/github/ruby.git
* lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
case. [ruby-core:69670] [Bug #11285] patched by Andy Chu git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8803c6016f
Коммит
84de36c748
|
@ -1,3 +1,8 @@
|
|||
Mon Jun 29 16:01:24 2015 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
|
||||
case. [ruby-core:69670] [Bug #11285] patched by Andy Chu
|
||||
|
||||
Mon Jun 29 14:50:08 2015 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* eval.c (add_activated_refinement): should not include the original
|
||||
|
|
|
@ -250,7 +250,7 @@ class Net::HTTPResponse
|
|||
return yield @socket unless @decode_content
|
||||
return yield @socket if self['content-range']
|
||||
|
||||
case self['content-encoding']
|
||||
case self['content-encoding'].downcase
|
||||
when 'deflate', 'gzip', 'x-gzip' then
|
||||
self.delete 'content-encoding'
|
||||
|
||||
|
|
|
@ -82,6 +82,34 @@ Connection: close
|
|||
Content-Encoding: deflate
|
||||
Content-Length: 13
|
||||
|
||||
x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
|
||||
EOS
|
||||
|
||||
res = Net::HTTPResponse.read_new(io)
|
||||
res.decode_content = true
|
||||
|
||||
body = nil
|
||||
|
||||
res.reading_body io, true do
|
||||
body = res.read_body
|
||||
end
|
||||
|
||||
if Net::HTTP::HAVE_ZLIB
|
||||
assert_equal nil, res['content-encoding']
|
||||
assert_equal 'hello', body
|
||||
else
|
||||
assert_equal 'deflate', res['content-encoding']
|
||||
assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
|
||||
end
|
||||
end
|
||||
|
||||
def test_read_body_content_encoding_deflate_uppercase
|
||||
io = dummy_io(<<EOS)
|
||||
HTTP/1.1 200 OK
|
||||
Connection: close
|
||||
Content-Encoding: DEFLATE
|
||||
Content-Length: 13
|
||||
|
||||
x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
|
||||
EOS
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче