diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-15 08:16:45 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-15 08:16:45 +0000 |
commit | af36e316d76b13e9724c4507d015de8466f2cd4a (patch) | |
tree | e0354bd30b73dacb74e84e721a84de2e0a40e4df /lib/net | |
parent | c4e660457fb893a248ecec64eec3b8e68a990992 (diff) | |
download | ruby-af36e316d76b13e9724c4507d015de8466f2cd4a.tar.gz |
ftp.rb: use Addrinfo interfaces
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/ftp.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index c2c5e8ce7f..cb786e8360 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -431,7 +431,8 @@ module Net else sock = makeport begin - sendport(sock.addr[3], sock.addr[1]) + addr = sock.local_address + sendport(addr.ip_address, addr.ip_port) if @resume and rest_offset resp = sendcmd("REST " + rest_offset.to_s) if !resp.start_with?("3") @@ -1246,7 +1247,7 @@ module Net raise FTPReplyError, resp end if m = /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/.match(resp) - return @sock.peeraddr[3], m["port"].to_i + return @sock.remote_address.ip_address, m["port"].to_i else raise FTPProtoError, resp end |