[前][次][番号順一覧][スレッド一覧]

ruby-changes:34601

From: naruse <ko1@a...>
Date: Fri, 4 Jul 2014 04:47:01 +0900 (JST)
Subject: [ruby-changes:34601] naruse:r46682 (trunk): * lib/net/htp/response.rb (Net::Inflater#inflate_adapter):

naruse	2014-07-04 04:46:44 +0900 (Fri, 04 Jul 2014)

  New Revision: 46682

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46682

  Log:
    * lib/net/htp/response.rb (Net::Inflater#inflate_adapter):
      prevent automatic encoding conversion.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http/response.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46681)
+++ ChangeLog	(revision 46682)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jul  4 04:42:05 2014  NARUSE, Yui  <naruse@r...>
+
+	* lib/net/htp/response.rb (Net::Inflater#inflate_adapter):
+	  prevent automatic encoding conversion.
+
 Fri Jul  4 04:39:52 2014  NARUSE, Yui  <naruse@r...>
 
 	* lib/net/http/response.rb (Net::HTTPResponse.each_response_header):
Index: lib/net/http/response.rb
===================================================================
--- lib/net/http/response.rb	(revision 46681)
+++ lib/net/http/response.rb	(revision 46682)
@@ -369,6 +369,11 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/response.rb#L369
     # 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]