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

ruby-changes:27186

From: drbrain <ko1@a...>
Date: Thu, 14 Feb 2013 14:33:10 +0900 (JST)
Subject: [ruby-changes:27186] drbrain:r39238 (trunk): * lib/net/http.rb: Removed OpenSSL dependency from Net::HTTP.

drbrain	2013-02-14 14:32:58 +0900 (Thu, 14 Feb 2013)

  New Revision: 39238

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

  Log:
    * lib/net/http.rb:  Removed OpenSSL dependency from Net::HTTP.
    
    * test/net/http/test_http.rb:  Remove Zlib dependency from tests.
    * test/net/http/test_http_request.rb:  ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http.rb
    trunk/test/net/http/test_http.rb
    trunk/test/net/http/test_http_request.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39237)
+++ ChangeLog	(revision 39238)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Feb 14 14:31:43 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/net/http.rb:  Removed OpenSSL dependency from Net::HTTP.
+
+	* test/net/http/test_http.rb:  Remove Zlib dependency from tests.
+	* test/net/http/test_http_request.rb:  ditto.
+
 Thu Feb 14 11:08:15 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* class.c (include_modules_at): detect cyclic prepend with original
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb	(revision 39237)
+++ lib/net/http.rb	(revision 39238)
@@ -1424,7 +1424,9 @@ module Net   #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L1424
         raise
       rescue Net::ReadTimeout, IOError, EOFError,
              Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE,
-             OpenSSL::SSL::SSLError, Timeout::Error => exception
+             # avoid a dependency on OpenSSL
+             defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : IOError,
+             Timeout::Error => exception
         if count == 0 && IDEMPOTENT_METHODS_.include?(req.method)
           count += 1
           @socket.close if @socket and not @socket.closed?
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 39237)
+++ test/net/http/test_http.rb	(revision 39238)
@@ -442,7 +442,7 @@ module TestNetHTTP_version_1_2_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L442
       assert_equal $test_net_http_data.size, res.body.size
       assert_equal $test_net_http_data, res.body
 
-      assert res.decode_content, 'Bug #7831'
+      assert res.decode_content, 'Bug #7831' if Net::HTTP::HAVE_ZLIB
     }
   end
 
Index: test/net/http/test_http_request.rb
===================================================================
--- test/net/http/test_http_request.rb	(revision 39237)
+++ test/net/http/test_http_request.rb	(revision 39238)
@@ -62,7 +62,7 @@ class HTTPRequestTest < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L62
 
     refute req2.decode_content,
            'Bug #7381 - do not decode content if the user overrides'
-  end
+  end if Net::HTTP::HAVE_ZLIB
 
   def test_header_set
     req = Net::HTTP::Get.new '/'
@@ -73,7 +73,7 @@ class HTTPRequestTest < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L73
 
     refute req.decode_content,
            'Bug #7831 - do not decode content if the user overrides'
-  end
+  end if Net::HTTP::HAVE_ZLIB
 
 end
 

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

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