summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-13 00:26:51 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-13 00:26:51 +0000
commite0a5ffa941d22ef4320db4ea803594e4dbb480d6 (patch)
tree08b100a58ad59396d4f92e17e2ae62e25ade61a1 /lib
parent2850b7c4812894a616bca1af09f901fe9a202fb0 (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 5a08e46280..b34c648bf3 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -407,6 +407,9 @@ module Net
# the data, in chunks of +blocksize+ characters.
#
def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data
+ if rest_offset
+ file.seek(rest_offset, IO::SEEK_SET)
+ end
synchronize do
voidcmd("TYPE I")
conn = transfercmd(cmd, rest_offset)
@@ -509,7 +512,11 @@ module Net
def putbinaryfile(localfile, remotefile = File.basename(localfile),
blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: line/data
if @resume
- rest_offset = size(remotefile)
+ begin
+ rest_offset = size(remotefile)
+ rescue Net::FTPPermError
+ rest_offset = nil
+ end
else
rest_offset = nil
end