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

ruby-changes:46503

From: nagachika <ko1@a...>
Date: Tue, 9 May 2017 23:28:25 +0900 (JST)
Subject: [ruby-changes:46503] nagachika:r58624 (ruby_2_4): merge revision(s) 57359: [Backport #13442]

nagachika	2017-05-09 23:28:21 +0900 (Tue, 09 May 2017)

  New Revision: 58624

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

  Log:
    merge revision(s) 57359: [Backport #13442]
    
    uri/generic.rb: fix exception on non-IP format
    
    * lib/uri/generic.rb (URI::Generic#find_proxy): match IP address
      no_proxy against resolved self IP address.  [Fix GH-1513]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/lib/uri/generic.rb
    branches/ruby_2_4/test/uri/test_generic.rb
    branches/ruby_2_4/version.h
Index: ruby_2_4/test/uri/test_generic.rb
===================================================================
--- ruby_2_4/test/uri/test_generic.rb	(revision 58623)
+++ ruby_2_4/test/uri/test_generic.rb	(revision 58624)
@@ -839,6 +839,31 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/uri/test_generic.rb#L839
     with_proxy_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'192.0.2.2') {|env|
       assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy(env))
       assert_nil(URI("http://192.0.2.2/").find_proxy(env))
+
+      getaddress = IPSocket.method(:getaddress)
+      begin
+        class << IPSocket
+          undef getaddress
+          def getaddress(host)
+            host == "example.org" or raise
+            "192.0.2.1"
+          end
+        end
+        assert_equal(URI('http://127.0.0.1:8080'), URI.parse("http://example.org").find_proxy(env))
+        class << IPSocket
+          undef getaddress
+          def getaddress(host)
+            host == "example.org" or raise
+            "192.0.2.2"
+          end
+        end
+        assert_nil(URI.parse("http://example.org").find_proxy(env))
+      ensure
+        IPSocket.singleton_class.class_eval do
+          undef getaddress
+          define_method(:getaddress, getaddress)
+        end
+      end
     }
     with_proxy_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'example.org') {|env|
       assert_nil(URI("http://example.org/").find_proxy(env))
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 58623)
+++ ruby_2_4/version.h	(revision 58624)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.2"
 #define RUBY_RELEASE_DATE "2017-05-09"
-#define RUBY_PATCHLEVEL 118
+#define RUBY_PATCHLEVEL 119
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_4/lib/uri/generic.rb
===================================================================
--- ruby_2_4/lib/uri/generic.rb	(revision 58623)
+++ ruby_2_4/lib/uri/generic.rb	(revision 58624)
@@ -1531,14 +1531,14 @@ module URI https://github.com/ruby/ruby/blob/trunk/ruby_2_4/lib/uri/generic.rb#L1531
           if (!port || self.port == port.to_i)
             if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host
               return nil
-            else
+            elsif addr
               require 'ipaddr'
               return nil if
                 begin
                   IPAddr.new(host)
                 rescue IPAddr::InvalidAddressError
                   next
-                end.include?(self.host)
+                end.include?(addr)
             end
           end
         }
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 58623)
+++ ruby_2_4	(revision 58624)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r57359

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

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