1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

remote_address should be called on @bare_sock.

Because @sock.remote_address fails if @sock is an SSLSocket.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2016-11-20 01:49:25 +00:00
parent f0dd33d549
commit fb8628ecda
2 changed files with 2 additions and 2 deletions

View file

@ -1362,7 +1362,7 @@ module Net
raise FTPReplyError, resp
end
if m = /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/.match(resp)
return @sock.remote_address.ip_address, m["port"].to_i
return @bare_sock.remote_address.ip_address, m["port"].to_i
else
raise FTPProtoError, resp
end

View file

@ -114,7 +114,7 @@ class FTPTest < Test::Unit::TestCase
sock = OpenStruct.new
sock.remote_address = OpenStruct.new
sock.remote_address.ip_address = "1080:0000:0000:0000:0008:0800:200c:417a"
ftp.instance_variable_set(:@sock, sock)
ftp.instance_variable_set(:@bare_sock, sock)
host, port = ftp.send(:parse229, "229 Entering Passive Mode (|||3106|)")
assert_equal("1080:0000:0000:0000:0008:0800:200c:417a", host)
assert_equal(3106, port)