From ef0736604a327e30568ea97ca07637c7d144544e Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 12 Jan 2011 07:26:18 +0000 Subject: * lib/net/http.rb (Net::HTTP#connect): makes it timeout during SSL handshake too. [ruby-core:34203] Patch by Marc Slemko. * test/net/http/test_http.rb (TestNetHTTP_v1_2#test_timeout_during_HTTP_session): test for [ruby-core:34203] * test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/http/test_http.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/net/http/test_http.rb') diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 036a6a1570..18ca79e721 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -182,6 +182,25 @@ module TestNetHTTP_version_1_1_methods assert_equal data, res.entity end + def test_timeout_during_HTTP_session + bug4246 = "expected the HTTP session to have timed out but have not. c.f. [ruby-core:34203]" + + # listen for connections... but deliberately do not complete SSL handshake + TCPServer.open(0) {|server| + port = server.addr[1] + + conn = Net::HTTP.new('localhost', port) + conn.read_timeout = 1 + conn.open_timeout = 1 + + th = Thread.new do + assert_raise(Timeout::Error) { + conn.get('/') + } + end + assert th.join(10), bug4246 + } + end end -- cgit v1.2.3