Project

General

Profile

Actions

Bug #4246

closed

Net::HTTP does not timeout during SSL connection handshake

Added by marcs (Marc Slemko) almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
Backport:
[ruby-core:34203]

Description

=begin
If you open a SSL connection and it hangs while doing the SSL connection handshake then it does not timeout unless you end up hitting a TCP keepalive timeout.

The problem is that the open_timeout is only applied to the actual TCP socket being opened and not the SSL negotiation.

Also an issue in ruby 1.8.{6,7}.

Attached is a patch against 1.9.2. The patch also ensures that the socket gets closed if we error out in connect after it has been opened.
=end


Files

net.http.ssl.connection.timeout.patch (1.82 KB) net.http.ssl.connection.timeout.patch patch against 1.9.2 marcs (Marc Slemko), 01/07/2011 09:58 AM
net.http.ssl.connection.repro.rb (515 Bytes) net.http.ssl.connection.repro.rb a script that repros the behaviour marcs (Marc Slemko), 01/07/2011 10:00 AM
Actions #1

Updated by marcs (Marc Slemko) almost 14 years ago

=begin
This script demonstrates the behavior. It opens a socket listening on port 6666, then opens a SSL connection to it. It should timeout after 5 seconds but it instead just hangs.
=end

Actions #2

Updated by yugui (Yuki Sonoda) almost 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r30520.
Marc, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0