* 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
This commit is contained in:
nobu 2008-07-04 05:17:25 +00:00
Родитель 5b72919469
Коммит 62dc500faf
2 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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