ruby-changes:30983
From: nagachika <ko1@a...>
Date: Fri, 27 Sep 2013 01:08:19 +0900 (JST)
Subject: [ruby-changes:30983] nagachika:r43062 (ruby_2_0_0): merge revision(s) 42930: [Backport #8898]
nagachika 2013-09-27 01:08:11 +0900 (Fri, 27 Sep 2013) New Revision: 43062 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43062 Log: merge revision(s) 42930: [Backport #8898] * lib/uri/generic.rb (URI::Generic.find_proxy): return nil if http_proxy environment variable is empty string. [ruby-core:57140] [Bug #8898] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/uri/generic.rb branches/ruby_2_0_0/test/uri/test_generic.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 43061) +++ ruby_2_0_0/ChangeLog (revision 43062) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Sep 27 01:02:59 2013 NARUSE, Yui <naruse@r...> + + * lib/uri/generic.rb (URI::Generic.find_proxy): return nil if + http_proxy environment variable is empty string. + [ruby-core:57140] [Bug #8898] + Fri Sep 27 00:58:57 2013 Zachary Scott <e@z...> * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913] Index: ruby_2_0_0/lib/uri/generic.rb =================================================================== --- ruby_2_0_0/lib/uri/generic.rb (revision 43061) +++ ruby_2_0_0/lib/uri/generic.rb (revision 43062) @@ -1647,31 +1647,29 @@ module URI https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/uri/generic.rb#L1647 proxy_uri = ENV[name] || ENV[name.upcase] end - if proxy_uri && self.hostname + if proxy_uri.nil? || proxy_uri.empty? + return nil + end + + if self.hostname require 'socket' begin addr = IPSocket.getaddress(self.hostname) - proxy_uri = nil if /\A127\.|\A::1\z/ =~ addr + return nil if /\A127\.|\A::1\z/ =~ addr rescue SocketError end end - if proxy_uri - proxy_uri = URI.parse(proxy_uri) - name = 'no_proxy' - if no_proxy = ENV[name] || ENV[name.upcase] - no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port| - if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host && - (!port || self.port == port.to_i) - proxy_uri = nil - break - end - } - end - proxy_uri - else - nil + name = 'no_proxy' + if no_proxy = ENV[name] || ENV[name.upcase] + no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port| + if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host && + (!port || self.port == port.to_i) + return nil + end + } end + URI.parse(proxy_uri) end end end Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 43061) +++ ruby_2_0_0/version.h (revision 43062) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-09-27" -#define RUBY_PATCHLEVEL 318 +#define RUBY_PATCHLEVEL 319 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_0_0/test/uri/test_generic.rb =================================================================== --- ruby_2_0_0/test/uri/test_generic.rb (revision 43061) +++ ruby_2_0_0/test/uri/test_generic.rb (revision 43062) @@ -760,12 +760,12 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/uri/test_generic.rb#L760 assert_nil(URI("http://192.0.2.2/").find_proxy) } with_env('http_proxy'=>'') { - assert_equal(URI(''), URI("http://192.0.2.1/").find_proxy) + assert_nil(URI("http://192.0.2.1/").find_proxy) assert_nil(URI("ftp://192.0.2.1/").find_proxy) } with_env('ftp_proxy'=>'') { assert_nil(URI("http://192.0.2.1/").find_proxy) - assert_equal(URI(''), URI("ftp://192.0.2.1/").find_proxy) + assert_nil(URI("ftp://192.0.2.1/").find_proxy) } end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42930 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/