diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-03 19:46:44 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-03 19:46:44 +0000 |
commit | d8a2c3c03f3dba8f55eda0bbeba2f5d8198bb5b0 (patch) | |
tree | 4a7316da1515db5113f2c576660fe24afd27626a | |
parent | 6811973d1355ba40ee4b3fc5a43ed65b67aac9b7 (diff) | |
download | ruby-d8a2c3c03f3dba8f55eda0bbeba2f5d8198bb5b0.tar.gz |
* lib/net/htp/response.rb (Net::Inflater#inflate_adapter):
prevent automatic encoding conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http/response.rb | 5 |
2 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Jul 4 04:42:05 2014 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/htp/response.rb (Net::Inflater#inflate_adapter): + prevent automatic encoding conversion. + Fri Jul 4 04:39:52 2014 NARUSE, Yui <naruse@ruby-lang.org> * lib/net/http/response.rb (Net::HTTPResponse.each_response_header): diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 33a7804cdc..45115295d9 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -369,6 +369,11 @@ class Net::HTTPResponse # entire body in memory. def inflate_adapter(dest) + if dest.respond_to?(:set_encoding) + dest.set_encoding(Encoding::ASCII_8BIT) + elsif dest.respond_to?(:force_encoding) + dest.force_encoding(Encoding::ASCII_8BIT) + end block = proc do |compressed_chunk| @inflate.inflate(compressed_chunk) do |chunk| dest << chunk |