mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/ftp.rb (Net::FTP#initialize): sets @binary to true.
* lib/net/ftp.rb (Net::FTP#binary=): sends a TYPE command only when logged in. [ruby-dev:39548] * lib/net/ftp.rb (Net::FTP#send_type_command): new private method which sends an appropriate TYPE command according to the value of @binary. * lib/net/ftp.rb (Net::FTP#login): calls send_type_command instead of binary=. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
249569fd8e
commit
91c84cda9b
2 changed files with 28 additions and 3 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Wed Oct 28 13:02:10 2009 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/ftp.rb (Net::FTP#initialize): sets @binary to true.
|
||||||
|
|
||||||
|
* lib/net/ftp.rb (Net::FTP#binary=): sends a TYPE command only when
|
||||||
|
logged in. [ruby-dev:39548]
|
||||||
|
|
||||||
|
* lib/net/ftp.rb (Net::FTP#send_type_command): new private method
|
||||||
|
which sends an appropriate TYPE command according to the value of
|
||||||
|
@binary.
|
||||||
|
|
||||||
|
* lib/net/ftp.rb (Net::FTP#login): calls send_type_command instead
|
||||||
|
of binary=.
|
||||||
|
|
||||||
Tue Oct 27 22:46:44 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
Tue Oct 27 22:46:44 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/ftp.rb (Net::FTP#initialize): @sock = nil.
|
* lib/net/ftp.rb (Net::FTP#initialize): @sock = nil.
|
||||||
|
|
|
@ -128,11 +128,12 @@ module Net
|
||||||
#
|
#
|
||||||
def initialize(host = nil, user = nil, passwd = nil, acct = nil)
|
def initialize(host = nil, user = nil, passwd = nil, acct = nil)
|
||||||
super()
|
super()
|
||||||
@binary = false
|
@binary = true
|
||||||
@passive = false
|
@passive = false
|
||||||
@debug_mode = false
|
@debug_mode = false
|
||||||
@resume = false
|
@resume = false
|
||||||
@sock = nil
|
@sock = nil
|
||||||
|
@logged_in = false
|
||||||
if host
|
if host
|
||||||
connect(host)
|
connect(host)
|
||||||
if user
|
if user
|
||||||
|
@ -144,10 +145,19 @@ module Net
|
||||||
def binary=(newmode)
|
def binary=(newmode)
|
||||||
if newmode != @binary
|
if newmode != @binary
|
||||||
@binary = newmode
|
@binary = newmode
|
||||||
@binary ? voidcmd("TYPE I") : voidcmd("TYPE A") unless closed?
|
send_type_command if @logged_in
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_type_command
|
||||||
|
if @binary
|
||||||
|
voidcmd("TYPE I")
|
||||||
|
else
|
||||||
|
voidcmd("TYPE A")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private :send_type_command
|
||||||
|
|
||||||
def with_binary(newmode)
|
def with_binary(newmode)
|
||||||
oldmode = binary
|
oldmode = binary
|
||||||
self.binary = newmode
|
self.binary = newmode
|
||||||
|
@ -393,7 +403,8 @@ module Net
|
||||||
raise FTPReplyError, resp
|
raise FTPReplyError, resp
|
||||||
end
|
end
|
||||||
@welcome = resp
|
@welcome = resp
|
||||||
self.binary = true
|
send_type_command
|
||||||
|
@logged_in = true
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue