diff options
-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 |