Feature #8317
closedURI: no_proxy with whitespaces and leading dots.
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.
Files
Updated by hsbt (Hiroshi SHIBATA) almost 11 years ago
- Target version changed from 2.1.0 to 2.2.0
Updated by vo.x (Vit Ondruch) over 8 years ago
Could this be applied?
BTW how is this relates to #10251?
Updated by nobu (Nobuyoshi Nakada) over 8 years 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
Updated by nobu (Nobuyoshi Nakada) over 8 years 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.
[ruby-core:54542] [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]
Updated by vo.x (Vit Ondruch) over 8 years ago
- Related to Bug #12421: Please backport r53816, r53817 added