[前][次][番号順一覧][スレッド一覧]

ruby-changes:44774

From: shugo <ko1@a...>
Date: Sun, 20 Nov 2016 10:49:29 +0900 (JST)
Subject: [ruby-changes:44774] shugo:r56847 (trunk): remote_address should be called on @bare_sock.

shugo	2016-11-20 10:49:25 +0900 (Sun, 20 Nov 2016)

  New Revision: 56847

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56847

  Log:
    remote_address should be called on @bare_sock.
    
    Because @sock.remote_address fails if @sock is an SSLSocket.

  Modified files:
    trunk/lib/net/ftp.rb
    trunk/test/net/ftp/test_ftp.rb
Index: test/net/ftp/test_ftp.rb
===================================================================
--- test/net/ftp/test_ftp.rb	(revision 56846)
+++ test/net/ftp/test_ftp.rb	(revision 56847)
@@ -114,7 +114,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L114
     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)
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 56846)
+++ lib/net/ftp.rb	(revision 56847)
@@ -1362,7 +1362,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L1362
         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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]