aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net/http.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 4b1a65767f..cc1b1c4a1f 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1424,7 +1424,9 @@ module Net #:nodoc:
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?