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

ruby-changes:44905

From: shugo <ko1@a...>
Date: Sun, 4 Dec 2016 14:05:58 +0900 (JST)
Subject: [ruby-changes:44905] shugo:r56978 (trunk): Specify the socktype explicitly.

shugo	2016-12-04 14:05:54 +0900 (Sun, 04 Dec 2016)

  New Revision: 56978

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

  Log:
    Specify the socktype explicitly.

  Modified files:
    trunk/test/net/ftp/test_ftp.rb
Index: test/net/ftp/test_ftp.rb
===================================================================
--- test/net/ftp/test_ftp.rb	(revision 56977)
+++ test/net/ftp/test_ftp.rb	(revision 56978)
@@ -9,7 +9,11 @@ require "tempfile" https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L9
 class FTPTest < Test::Unit::TestCase
   SERVER_NAME = "localhost"
   SERVER_ADDR =
-    Addrinfo.getaddrinfo(SERVER_NAME, 0)[0].ip_address rescue "127.0.0.1"
+    begin
+      Addrinfo.getaddrinfo(SERVER_NAME, 0, nil, :STREAM)[0].ip_address
+    rescue SocketError
+      "127.0.0.1"
+    end
   CA_FILE = File.expand_path("../fixtures/cacert.pem", __dir__)
   SERVER_KEY = File.expand_path("../fixtures/server.key", __dir__)
   SERVER_CERT = File.expand_path("../fixtures/server.crt", __dir__)

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

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