summaryrefslogtreecommitdiffstats
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
commit7ec39aa4ae2bcc12aeb3a6aab18f5ba1a4d4b9a8 (patch)
tree295019025940969bdaa7b4505cec49fdd0509607
parentb32827290ad9f35ddce949d6c02b3756de9139c8 (diff)
downloadruby-7ec39aa4ae2bcc12aeb3a6aab18f5ba1a4d4b9a8.tar.gz
ruby-7ec39aa4ae2bcc12aeb3a6aab18f5ba1a4d4b9a8.tar.xz
ruby-7ec39aa4ae2bcc12aeb3a6aab18f5ba1a4d4b9a8.zip
* lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/net/ftp.rb7
2 files changed, 6 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 5de204788..dd7236473 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 2167a5289..855684de8 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