diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/net/ftp.rb | 7 |
2 files changed, 6 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Fri Jul 4 14:17:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557] + Fri Jul 4 11:08:37 2008 nari <authorNari@gmail.com> * gc.c (garbage_collect_force): sweep is completely ended. 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 |