From 3b90cf70d17b5441a83b7ccb1aa0ff2e8b2f5bbc Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 10 Aug 2015 16:47:03 +0000 Subject: [PATCH] merge revision(s) 51061,51063,51091: [Backport #11285] * lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper case. [ruby-core:69670] [Bug #11285] patched by Andy Chu * test/net/http/test_httpresponse.rb (HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase): fix a failure without zlib. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/net/http/response.rb | 3 ++- test/net/http/test_httpresponse.rb | 28 ++++++++++++++++++++++++++++ version.h | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4599552673..680c6b7e19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Aug 11 01:37:28 2015 Kazuhiro NISHIYAMA + + * test/net/http/test_httpresponse.rb + (HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase): + fix a failure without zlib. + +Tue Aug 11 01:37:28 2015 NARUSE, Yui + + * lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper + case. [ruby-core:69670] [Bug #11285] patched by Andy Chu + Tue Aug 11 01:21:49 2015 Nobuyoshi Nakada * vm.c (m_core_hash_merge_ptr): copy the arguments to the machine diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index b0731694ca..674faf2cfc 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -250,7 +250,8 @@ class Net::HTTPResponse return yield @socket unless @decode_content return yield @socket if self['content-range'] - case self['content-encoding'] + v = self['content-encoding'] + case v && v.downcase when 'deflate', 'gzip', 'x-gzip' then self.delete 'content-encoding' diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb index 0193a153e4..a9cd9f5d26 100644 --- a/test/net/http/test_httpresponse.rb +++ b/test/net/http/test_httpresponse.rb @@ -103,6 +103,34 @@ EOS end end + def test_read_body_content_encoding_deflate_uppercase + io = dummy_io(<