diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-28 05:15:54 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-28 05:15:54 +0000 |
commit | 09f27873ed653bd4afb5538b669e2362f3b1bf6e (patch) | |
tree | 1dab78cb5c936ea9c4ee349e7415617e96371c8a /lib/net/http.rb | |
parent | 8a7da58c0fe28af09ce0631d6ada79e47cc7b98f (diff) |
* lib/net/protocol.rb: Add OpenTimeout subclass of Timeout::Error
* lib/net/pop.rb: Modernize Timeout usage. Patch by Eric Wong.
Use Net::OpenTimeout instead of Timeout::Error. [Bug #5765]
* lib/net/http.rb: ditto
* lib/net/smtp.rb: ditto
* lib/net/telnet.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r-- | lib/net/http.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index d6182d9052..65816f52e8 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -360,9 +360,6 @@ module Net #:nodoc: # class HTTP < Protocol - class OpenTimeout < Timeout::Error - end - # :stopdoc: Revision = %q$Revision$.split[1] HTTPVersion = '1.1' @@ -791,7 +788,7 @@ module Net #:nodoc: def connect D "opening connection to #{conn_address()}..." - s = timeout(@open_timeout, OpenTimeout) { + s = Timeout.timeout(@open_timeout, Net::OpenTimeout) { TCPSocket.open(conn_address(), conn_port()) } D "opened" @@ -829,7 +826,7 @@ module Net #:nodoc: end # Server Name Indication (SNI) RFC 3546 s.hostname = @address if s.respond_to? :hostname= - timeout(@open_timeout, OpenTimeout) { s.connect } + Timeout.timeout(@open_timeout, Net::OpenTimeout) { s.connect } if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE s.post_connection_check(@address) end @@ -1363,7 +1360,7 @@ module Net #:nodoc: rescue IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error => exception - raise if OpenTimeout === exception + raise if Net::OpenTimeout === exception if count == 0 && IDEMPOTENT_METHODS_.include?(req.method) count += 1 |