aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 10:38:31 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 10:38:31 +0000
commitd6a74a715d99f5c6d18f5d254b4af707c1266623 (patch)
tree64a3af85340273d7cd3dcff296699900b9818f49 /lib
parente7dfcb0293ddb5046a7efd0915eaf51db53e69d9 (diff)
downloadruby-d6a74a715d99f5c6d18f5d254b4af707c1266623.tar.gz
Add new options open_timeout and read_timeout to Net::FTP.new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 278dd51024..7a07d27437 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -190,6 +190,10 @@ module Net
# account:: Account information for ACCT.
# passive:: When +true+, the connection is in passive mode. Default:
# +true+.
+ # open_timeout:: Number of seconds to wait for the connection to open.
+ # See Net::FTP#open_timeout for details. Default: +nil+.
+ # read_timeout:: Number of seconds to wait for one block to be read.
+ # See Net::FTP#read_timeout for details. Default: +60+.
# debug_mode:: When +true+, all traffic to and from the server is
# written to +$stdout+. Default: +false+.
#
@@ -242,8 +246,8 @@ module Net
@resume = false
@bare_sock = @sock = NullSocket.new
@logged_in = false
- @open_timeout = nil
- @read_timeout = 60
+ @open_timeout = options[:open_timeout]
+ @read_timeout = options[:read_timeout] || 60
if host
if options[:port]
connect(host, options[:port] || FTP_PORT)