summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-04 05:17:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-04 05:17:25 +0000
commit62dc500faf5d485b2dc8bf177d6e595eef94c342 (patch)
tree295019025940969bdaa7b4505cec49fdd0509607 /lib
parent5b72919469f87d74e4f5f833b8c78e385372cb5c (diff)
* lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 2167a52895..855684de89 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -296,12 +296,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