Index: lib/net/protocol.rb =================================================================== --- lib/net/protocol.rb (revision 34818) +++ lib/net/protocol.rb (working copy) @@ -44,6 +44,7 @@ module Net # :nodoc: class ProtoCommandError < ProtocolError; end class ProtoRetriableError < ProtocolError; end ProtocRetryError = ProtoRetriableError + class ReadTimeout < Timeout::Error; end class BufferedIO #:nodoc: internal use only @@ -143,7 +144,7 @@ module Net # :nodoc: if IO.select([@io], nil, nil, @read_timeout) retry else - raise Timeout::Error + raise Net::ReadTimeout end rescue IO::WaitWritable # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable. @@ -151,7 +152,7 @@ module Net # :nodoc: if IO.select(nil, [@io], nil, @read_timeout) retry else - raise Timeout::Error + raise Net::ReadTimeout end end end Index: test/net/http/test_http.rb =================================================================== --- test/net/http/test_http.rb (revision 34818) +++ test/net/http/test_http.rb (working copy) @@ -200,11 +200,11 @@ module TestNetHTTP_version_1_1_methods port = server.addr[1] conn = Net::HTTP.new('localhost', port) - conn.read_timeout = 1 - conn.open_timeout = 1 + conn.read_timeout = 0.001 + conn.open_timeout = 0.001 th = Thread.new do - assert_raise(Timeout::Error) { + assert_raise(Net::ReadTimeout) { conn.get('/') } end