8000 merge revision(s) 51061,51063,51091: [Backport #11285] · github/ruby@9580200 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9580200

Browse files
committed
merge revision(s) 51061,51063,51091: [Backport ruby#11285]
* lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper case. [ruby-core:69670] [Bug ruby#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_1@51602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 59f1eaa commit 9580200

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Mon Aug 17 16:49:00 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
2+
3+
* test/net/http/test_httpresponse.rb
4+
(HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase):
5+
fix a failure without zlib.
6+
7+
Mon Aug 17 16:49:00 2015 NARUSE, Yui <naruse@ruby-lang.org>
8+
9+
* lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
10+
case. [ruby-core:69670] [Bug #11285] patched by Andy Chu
11+
112
Mon Aug 17 16:46:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
213

314
* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine

lib/net/http/response.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ def inflater # :nodoc:
250250
return yield @socket unless @decode_content
251251
return yield @socket if self['content-range']
252252

253-
case self['content-encoding']
253+
v = self['content-encoding']
254+
case v && v.downcase
254255
when 'deflate', 'gzip', 'x-gzip' then
255256
self.delete 'content-encoding'
256257

test/net/http/test_httpresponse.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,34 @@ def test_read_body_content_encoding_deflate
103103
end
104104
end
105105

106+
def test_read_body_content_encoding_deflate_uppercase
107+
io = dummy_io(<<EOS)
108+
HTTP/1.1 200 OK
109+
Connection: close
110+
Content-Encoding: DEFLATE
111+
Content-Length: 13
112+
113+
x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15
114+
EOS
115+
116+
res = Net::HTTPResponse.read_new(io)
117+
res.decode_content = true
118+
119+
body = nil
120+
121+
res.reading_body io, true do
122+
body = res.read_body
123+
end
124+
125+
if Net::HTTP::HAVE_ZLIB
126+
assert_equal nil, res['content-encoding']
127+
assert_equal 'hello', body
128+
else
129+
assert_equal 'DEFLATE', res['content-encoding']
130+
assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
131+
end
132+
end
133+
106134
def test_read_body_content_encoding_deflate_chunked
107135
io = dummy_io(<<EOS)
108136
HTTP/1.1 200 OK

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.7"
22
#define RUBY_RELEASE_DATE " 5212 ;2015-08-17"
3-
#define RUBY_PATCHLEVEL 385
3+
#define RUBY_PATCHLEVEL 386
44

55
#define RUBY_RELEASE_YEAR 2015
66
#define RUBY_RELEASE_MONTH 8

0 commit comments

Comments
 (0)
0