File 0005-Manual-cherry-pick-of-423d042.patch of Package ruby2.1.4483
From 000d658149518615ebe096504d92c41223b1b273 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <mrueckert@suse.de>
Date: Tue, 7 Mar 2017 13:36:18 +0100
Subject: [PATCH 05/12] Manual cherry pick of 423d042
---
lib/uri/generic.rb | 2 +-
test/uri/test_generic.rb | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index d7a55dcbd8..3dd6186b5e 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1662,7 +1662,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 c9e3576a80..166763b40f 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -789,6 +789,18 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
assert_nil(URI("http://192.0.2.2/").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)
+ }
+ 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
with_env('http_proxy'=>'') {
assert_nil(URI("http://192.0.2.1/").find_proxy)
assert_nil(URI("ftp://192.0.2.1/").find_proxy)
--
2.12.0