From 84de36c74831bb6420fcd3c224fc515380e28350 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 29 Jun 2015 07:14:31 +0000 Subject: * 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 --- test/net/http/test_httpresponse.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/net') diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb index ba8b45eaca..7d378648b3 100644 --- a/test/net/http/test_httpresponse.rb +++ b/test/net/http/test_httpresponse.rb @@ -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(<