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

ruby-changes:39441

From: nagachika <ko1@a...>
Date: Tue, 11 Aug 2015 01:47:15 +0900 (JST)
Subject: [ruby-changes:39441] nagachika:r51522 (ruby_2_2): merge revision(s) 51061, 51063, 51091: [Backport #11285]

nagachika	2015-08-11 01:47:03 +0900 (Tue, 11 Aug 2015)

  New Revision: 51522

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

  Log:
    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.

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/lib/net/http/response.rb
    branches/ruby_2_2/test/net/http/test_httpresponse.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 51521)
+++ ruby_2_2/ChangeLog	(revision 51522)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Tue Aug 11 01:37:28 2015  Kazuhiro NISHIYAMA  <zn@m...>
+
+	* test/net/http/test_httpresponse.rb
+	(HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase):
+	fix a failure without zlib.
+
+Tue Aug 11 01:37:28 2015  NARUSE, Yui  <naruse@r...>
+
+	* lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
+	  case. [ruby-core:69670] [Bug #11285] patched by Andy Chu
+
 Tue Aug 11 01:21:49 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
Index: ruby_2_2/lib/net/http/response.rb
===================================================================
--- ruby_2_2/lib/net/http/response.rb	(revision 51521)
+++ ruby_2_2/lib/net/http/response.rb	(revision 51522)
@@ -250,7 +250,8 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/net/http/response.rb#L250
     return yield @socket unless @decode_content
     return yield @socket if self['content-range']
 
-    case self['content-encoding']
+    v = self['content-encoding']
+    case v && v.downcase
     when 'deflate', 'gzip', 'x-gzip' then
       self.delete 'content-encoding'
 
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 51521)
+++ ruby_2_2/version.h	(revision 51522)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-08-11"
-#define RUBY_PATCHLEVEL 154
+#define RUBY_PATCHLEVEL 155
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/test/net/http/test_httpresponse.rb
===================================================================
--- ruby_2_2/test/net/http/test_httpresponse.rb	(revision 51521)
+++ ruby_2_2/test/net/http/test_httpresponse.rb	(revision 51522)
@@ -103,6 +103,34 @@ EOS https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/net/http/test_httpresponse.rb#L103
     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

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51061,51063,51091


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

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