aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/uri/generic.rb2
-rw-r--r--test/uri/test_generic.rb4
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2945679707..44116e071e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Feb 13 17:11:58 2016 Fabian Wiesel <fabian.wiesel@sap.com>
+
+ * lib/uri/generic.rb (find_proxy): exclude white-spaces and allow
+ for a leading dot in the domain name in no_proxy.
+ [ruby-core:54542] [Feature #8317]
+
Fri Feb 12 12:20:56 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (name_err_initialize, nometh_err_initialize): [DOC] fix
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index aba54c14b6..f2a2d567e3 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1546,7 +1546,7 @@ module URI
name = 'no_proxy'
if no_proxy = ENV[name] || ENV[name.upcase]
- no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port|
+ no_proxy.scan(/(?!\.)([^:,\s]+)(?::(\d+))?/) {|host, port|
if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host &&
(!port || self.port == port.to_i)
return nil
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index fcfe1f9696..ad189fc13a 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -835,6 +835,10 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_nil(URI("http://example.org/").find_proxy)
assert_nil(URI("http://www.example.org/").find_proxy)
}
+ with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'.example.org') {
+ assert_nil(URI("http://example.org/").find_proxy)
+ assert_nil(URI("http://www.example.org/").find_proxy)
+ }
end
def test_find_proxy_bad_value