1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/ftp.rb (storebinary): seek correctly. Thanks, William Webber.

* lib/net/ftp.rb (putbinaryfile): rescue FTPPermError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2003-06-13 00:26:51 +00:00
parent 2850b7c481
commit e0a5ffa941
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Fri Jun 13 09:24:39 2003 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (storebinary): seek correctly. Thanks, William Webber.
* lib/net/ftp.rb (putbinaryfile): rescue FTPPermError.
Tue Jun 10 14:26:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net> Tue Jun 10 14:26:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
* ext/syck/token.c: preserve newlines prepended to a block. * ext/syck/token.c: preserve newlines prepended to a block.

View file

@ -407,6 +407,9 @@ module Net
# the data, in chunks of +blocksize+ characters. # the data, in chunks of +blocksize+ characters.
# #
def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data
if rest_offset
file.seek(rest_offset, IO::SEEK_SET)
end
synchronize do synchronize do
voidcmd("TYPE I") voidcmd("TYPE I")
conn = transfercmd(cmd, rest_offset) conn = transfercmd(cmd, rest_offset)
@ -509,7 +512,11 @@ module Net
def putbinaryfile(localfile, remotefile = File.basename(localfile), def putbinaryfile(localfile, remotefile = File.basename(localfile),
blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: line/data blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: line/data
if @resume if @resume
begin
rest_offset = size(remotefile) rest_offset = size(remotefile)
rescue Net::FTPPermError
rest_offset = nil
end
else else
rest_offset = nil rest_offset = nil
end end