Expand abbreviated option names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6839d47eb8
commit
77403c88cd
@ -174,20 +174,22 @@ module Net
|
|||||||
#
|
#
|
||||||
# The available options are:
|
# The available options are:
|
||||||
#
|
#
|
||||||
# port:: Port number (default value is 21)
|
# port:: Port number (default value is 21)
|
||||||
# ssl:: If options[:ssl] is true, then an attempt will be made
|
# ssl:: If options[:ssl] is true, then an attempt will be made
|
||||||
# to use SSL (now TLS) to connect to the server. For this to
|
# to use SSL (now TLS) to connect to the server. For this
|
||||||
# work OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions
|
# to work OpenSSL [OSSL] and the Ruby OpenSSL [RSSL]
|
||||||
# need to be installed. If options[:ssl] is a hash, it's
|
# extensions need to be installed. If options[:ssl] is a
|
||||||
# passed to OpenSSL::SSL::SSLContext#set_params as parameters.
|
# hash, it's passed to OpenSSL::SSL::SSLContext#set_params
|
||||||
|
# as parameters.
|
||||||
# private_data_connection:: If true, TLS is used for data connections.
|
# private_data_connection:: If true, TLS is used for data connections.
|
||||||
# Default: +true+ when options[:ssl] is true.
|
# Default: +true+ when options[:ssl] is true.
|
||||||
# user:: Username for login. If options[:user] is the string
|
# username:: Username for login. If options[:user] is the string
|
||||||
# "anonymous" and the options[:password] is +nil+,
|
# "anonymous" and the options[:password] is +nil+,
|
||||||
# "anonymous@" is used as a password.
|
# "anonymous@" is used as a password.
|
||||||
# passwd:: Password for login.
|
# password:: Password for login.
|
||||||
# acct:: Account information for ACCT.
|
# account:: Account information for ACCT.
|
||||||
# passive:: When +true+, the connection is in passive mode. Default: +true+.
|
# passive:: When +true+, the connection is in passive mode. Default:
|
||||||
|
# +true+.
|
||||||
# debug_mode:: When +true+, all traffic to and from the server is
|
# debug_mode:: When +true+, all traffic to and from the server is
|
||||||
# written to +$stdout+. Default: +false+.
|
# written to +$stdout+. Default: +false+.
|
||||||
#
|
#
|
||||||
@ -198,9 +200,9 @@ module Net
|
|||||||
rescue NoMethodError
|
rescue NoMethodError
|
||||||
# for backward compatibility
|
# for backward compatibility
|
||||||
options = {}
|
options = {}
|
||||||
options[:user] = user_or_options
|
options[:username] = user_or_options
|
||||||
options[:passwd] = passwd
|
options[:password] = passwd
|
||||||
options[:acct] = acct
|
options[:account] = acct
|
||||||
end
|
end
|
||||||
@host = nil
|
@host = nil
|
||||||
if options[:ssl]
|
if options[:ssl]
|
||||||
@ -250,8 +252,8 @@ module Net
|
|||||||
# the number of arguments passed to connect....
|
# the number of arguments passed to connect....
|
||||||
connect(host)
|
connect(host)
|
||||||
end
|
end
|
||||||
if options[:user]
|
if options[:username]
|
||||||
login(options[:user], options[:passwd], options[:acct])
|
login(options[:username], options[:password], options[:account])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -239,9 +239,9 @@ class FTPTest < Test::Unit::TestCase
|
|||||||
begin
|
begin
|
||||||
ftp = Net::FTP.new(SERVER_ADDR,
|
ftp = Net::FTP.new(SERVER_ADDR,
|
||||||
port: server.port,
|
port: server.port,
|
||||||
user: "foo",
|
username: "foo",
|
||||||
passwd: "bar",
|
password: "bar",
|
||||||
acct: "baz")
|
account: "baz")
|
||||||
assert_equal("USER foo\r\n", commands.shift)
|
assert_equal("USER foo\r\n", commands.shift)
|
||||||
assert_equal("PASS bar\r\n", commands.shift)
|
assert_equal("PASS bar\r\n", commands.shift)
|
||||||
assert_equal("ACCT baz\r\n", commands.shift)
|
assert_equal("ACCT baz\r\n", commands.shift)
|
||||||
@ -267,7 +267,7 @@ class FTPTest < Test::Unit::TestCase
|
|||||||
sock.print("200 Switching to Binary mode.\r\n")
|
sock.print("200 Switching to Binary mode.\r\n")
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
Net::FTP.open(SERVER_ADDR, port: server.port, user: "anonymous") do
|
Net::FTP.open(SERVER_ADDR, port: server.port, username: "anonymous") do
|
||||||
end
|
end
|
||||||
assert_equal("USER anonymous\r\n", commands.shift)
|
assert_equal("USER anonymous\r\n", commands.shift)
|
||||||
assert_equal("PASS anonymous@\r\n", commands.shift)
|
assert_equal("PASS anonymous@\r\n", commands.shift)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user