diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 02:47:11 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 02:47:11 +0000 |
commit | 2666a1ca7a43c7ae4dfc8299e19e86ae724291d2 (patch) | |
tree | f64c157eddf4a0e372fa5e635744beebffa71ed5 /test/net/ftp/test_ftp.rb | |
parent | 0510e5eab6f87a01af817ca235c830c6fd4ce15f (diff) | |
download | ruby-2666a1ca7a43c7ae4dfc8299e19e86ae724291d2.tar.gz |
net/ftp: add a new option ssl_handshake_timeout to Net::FTP.new.
The TLS handshake timeout can be specified independently, because the TLS
handshake doesn't start just after the underlying connection is established,
but after the AUTH command is completed. It's also useful for testing
purposes. However, if ssl_handshake_timeout is not specified, open_timeout
is used instead for convenience.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/ftp/test_ftp.rb')
-rw-r--r-- | test/net/ftp/test_ftp.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index d40e2d8283..fb9852e63d 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -2107,22 +2107,19 @@ EOF commands = [] sock = nil @thread = Thread.start do - begin - sock = server.accept - sock.print("220 (test_ftp).\r\n") - commands.push(sock.gets) - sock.print("234 AUTH success.\r\n") - rescue SystemCallError, IOError - # may be raised by broken connection - end + sock = server.accept + sock.print("220 (test_ftp).\r\n") + commands.push(sock.gets) + sock.print("234 AUTH success.\r\n") end begin assert_raise(Net::OpenTimeout) do Net::FTP.new("localhost", port: port, ssl: { ca_file: CA_FILE }, - open_timeout: 0.1) + ssl_handshake_timeout: 0.1) end + @thread.join ensure sock.close if sock server.close |