From 62dc500faf5d485b2dc8bf177d6e595eef94c342 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Jul 2008 05:17:25 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ lib/net/ftp.rb | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5de2047882..dd7236473e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jul 4 14:17:22 2008 Nobuyoshi Nakada + + * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557] + Fri Jul 4 11:08:37 2008 nari * 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