Blame SOURCES/ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch

0a37a3
From 423d042371d0402071c309dc403ea2701600a98b Mon Sep 17 00:00:00 2001
0a37a3
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
0a37a3
Date: Sat, 13 Feb 2016 08:12:21 +0000
0a37a3
Subject: [PATCH] no_proxy with whitespaces and leading dots
0a37a3
0a37a3
* lib/uri/generic.rb (find_proxy): exclude white-spaces and allow
0a37a3
  for a leading dot in the domain name in no_proxy.
0a37a3
  [ruby-core:54542] [Feature #8317]
0a37a3
0a37a3
The previous implementation wouldn't allow for white-spaces nor a leading dot
0a37a3
in the domain name. The latter is described in the wget documentation as a valid case.
0a37a3
0a37a3
By being more strict on the characters, which are counted to a domainname,
0a37a3
we allow for white-spaces.
0a37a3
Also, a possible leading dot will be handled gracefully.
0a37a3
0a37a3
[Fix GH-285]
0a37a3
0a37a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
0a37a3
---
0a37a3
 ChangeLog                | 6 ++++++
0a37a3
 lib/uri/generic.rb       | 2 +-
0a37a3
 test/uri/test_generic.rb | 4 ++++
0a37a3
 3 files changed, 11 insertions(+), 1 deletion(-)
0a37a3
0a37a3
diff --git a/ChangeLog b/ChangeLog
0a37a3
index 2945679..44116e0 100644
0a37a3
--- a/ChangeLog
0a37a3
+++ b/ChangeLog
0a37a3
@@ -1,3 +1,9 @@
0a37a3
+Sat Feb 13 17:11:58 2016  Fabian Wiesel  <fabian.wiesel@sap.com>
0a37a3
+
0a37a3
+	* lib/uri/generic.rb (find_proxy): exclude white-spaces and allow
0a37a3
+	  for a leading dot in the domain name in no_proxy.
0a37a3
+	  [ruby-core:54542] [Feature #8317]
0a37a3
+
0a37a3
 Tue Apr 26 02:58:51 2016  Marcus Stollsteimer  <sto.mar@web.de>
0a37a3
 
0a37a3
 	* doc/extension.rdoc: Improvements to english grammers.
0a37a3
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
0a37a3
index aba54c1..f2a2d56 100644
0a37a3
--- a/lib/uri/generic.rb
0a37a3
+++ b/lib/uri/generic.rb
0a37a3
@@ -1546,7 +1546,7 @@ def find_proxy
0a37a3
 
0a37a3
       name = 'no_proxy'
0a37a3
       if no_proxy = ENV[name] || ENV[name.upcase]
0a37a3
-        no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port|
0a37a3
+        no_proxy.scan(/(?!\.)([^:,\s]+)(?::(\d+))?/) {|host, port|
0a37a3
           if /(\A|\.)#{Regexp.quote host}\z/i =~ self.host &&
0a37a3
             (!port || self.port == port.to_i)
0a37a3
             return nil
0a37a3
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
0a37a3
index fcfe1f9..ad189fc 100644
0a37a3
--- a/test/uri/test_generic.rb
0a37a3
+++ b/test/uri/test_generic.rb
0a37a3
@@ -819,6 +819,14 @@ def test_find_proxy
0a37a3
       assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
0a37a3
       assert_nil(URI("http://192.0.2.2/").find_proxy)
0a37a3
     }
0a37a3
+    with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'example.org') {
0a37a3
+      assert_nil(URI("http://example.org/").find_proxy)
0a37a3
+      assert_nil(URI("http://www.example.org/").find_proxy)
0a37a3
+    }
0a37a3
+    with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'.example.org') {
0a37a3
+      assert_nil(URI("http://example.org/").find_proxy)
0a37a3
+      assert_nil(URI("http://www.example.org/").find_proxy)
0a37a3
+    }
0a37a3
     with_env('http_proxy'=>'') {
0a37a3
       assert_nil(URI("http://192.0.2.1/").find_proxy)
0a37a3
       assert_nil(URI("ftp://192.0.2.1/").find_proxy)