diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-10 09:39:50 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-10 09:39:50 +0000 |
commit | 46776da2aa3432ba72873aede6b727450aed4de1 (patch) | |
tree | 30e7dfe52af377c55745a8ad15253b2049bc4106 /lib | |
parent | e7023df46a6cca0249c0eafc3521b8d9134ed0e7 (diff) |
merge revision(s) 17868:
* lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ftp.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index dfbcf1499f..bee60d559c 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -278,12 +278,9 @@ module Net def sendport(host, port) af = (@sock.peeraddr)[0] if af == "AF_INET" - hbytes = host.split(".") - pbytes = [port / 256, port % 256] - bytes = hbytes + pbytes - cmd = "PORT " + bytes.join(",") + cmd = "PORT " + (host.split(".") + port.divmod(256)).join(",") elsif af == "AF_INET6" - cmd = "EPRT |2|" + host + "|" + sprintf("%d", port) + "|" + cmd = sprintf("EPRT |2|%s|%d|", host, port) else raise FTPProtoError, host end |