Project

General

Profile

Feature #8317

URI: no_proxy with whitespaces and leading dots.

Added by Zachary Scott over 3 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
[ruby-core:54542]

Description

From GitHub#285

The previous implementation wouldn't allow for white-spaces nor a leading dot
in the no_proxy list. The latter is described in the wget documentation as a valid case.

By being more strict on the characters, which are counted to a domainname,
we allow for white-spaces.
Also, a possible leading dot will be handled gracefully.

285.patch View (1.22 KB) Zachary Scott, 04/24/2013 12:40 PM


Related issues

Related to Ruby trunk - Bug #12421: Please backport r53816, r53817 Open

Associated revisions

Revision 53816
Added by Nobuyoshi Nakada 10 months ago

no_proxy with whitespaces and leading dots

  • lib/uri/generic.rb (find_proxy): exclude white-spaces and allow for a leading dot in the domain name in no_proxy. [Feature #8317]

The previous implementation wouldn't allow for white-spaces nor a leading dot
in the domain name. The latter is described in the wget documentation as a valid case.

By being more strict on the characters, which are counted to a domainname,
we allow for white-spaces.
Also, a possible leading dot will be handled gracefully.

[Fix GH-285]

History

#1 [ruby-core:60292] Updated by Hiroshi SHIBATA almost 3 years ago

  • Target version changed from 2.1.0 to current: 2.2.0

#2 [ruby-core:73780] Updated by Vit Ondruch 10 months ago

Could this be applied?

BTW how is this relates to #10251?

#3 [ruby-core:73787] Updated by Nobuyoshi Nakada 10 months ago

  • Description updated (diff)

Why also semicolon-separated?

diff --git c/lib/uri/generic.rb w/lib/uri/generic.rb
index aba54c1..f2a2d56 100644
--- c/lib/uri/generic.rb
+++ w/lib/uri/generic.rb
@@ -1546,7 +1546,7 @@

       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 c/test/uri/test_generic.rb w/test/uri/test_generic.rb
index b759657..70c3a73 100644
--- c/test/uri/test_generic.rb
+++ w/test/uri/test_generic.rb
@@ -831,6 +831,10 @@
       assert_nil(URI("http://example.net/").find_proxy)
       assert_nil(URI("http://www.example.net/").find_proxy)
     }
+    with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'.example.net') {
+      assert_nil(URI("http://example.net/").find_proxy)
+      assert_nil(URI("http://www.example.net/").find_proxy)
+    }
   end

   def test_find_proxy_case_sensitive_env

#4 Updated by Nobuyoshi Nakada 10 months ago

  • Status changed from Assigned to Closed

Applied in changeset r53816.


no_proxy with whitespaces and leading dots

  • lib/uri/generic.rb (find_proxy): exclude white-spaces and allow for a leading dot in the domain name in no_proxy. [Feature #8317]

The previous implementation wouldn't allow for white-spaces nor a leading dot
in the domain name. The latter is described in the wget documentation as a valid case.

By being more strict on the characters, which are counted to a domainname,
we allow for white-spaces.
Also, a possible leading dot will be handled gracefully.

[Fix GH-285]

#5 Updated by Vit Ondruch 7 months ago

  • Related to Bug #12421: Please backport r53816, r53817 added

Also available in: Atom PDF