summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:47:03 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:47:03 +0000
commit3b90cf70d17b5441a83b7ccb1aa0ff2e8b2f5bbc (patch)
tree3063aee1f11e9f6fd0b5d21e4cef278a1e780d52 /test
parente49c2e3569ebf5a1304483efca4c92c143a3e321 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/net/http/test_httpresponse.rb28
1 files changed, 28 insertions, 0 deletions
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(<<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
+
+ 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_chunked
io = dummy_io(<<EOS)
HTTP/1.1 200 OK