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

ruby-changes:50638

From: seki <ko1@a...>
Date: Sun, 18 Mar 2018 00:13:45 +0900 (JST)
Subject: [ruby-changes:50638] seki:r62798 (trunk): If host of URI is omitted, make it with IP address.

seki	2018-03-18 00:13:39 +0900 (Sun, 18 Mar 2018)

  New Revision: 62798

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

  Log:
    If host of URI is omitted, make it with IP address.

  Modified files:
    trunk/lib/drb/drb.rb
Index: lib/drb/drb.rb
===================================================================
--- lib/drb/drb.rb	(revision 62797)
+++ lib/drb/drb.rb	(revision 62798)
@@ -847,7 +847,11 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L847
     def self.getservername
       host = Socket::gethostname
       begin
-        Socket::gethostbyname(host)[0]
+        Socket::getaddrinfo(host, nil,
+                                  Socket::AF_UNSPEC,
+                                  Socket::SOCK_STREAM,
+                                  0,
+                                  Socket::AI_PASSIVE)[0][3]
       rescue
         'localhost'
       end

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

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