From da60d77e08178b42637288b15d62ea3c20def90d Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Tue, 24 May 2016 13:08:58 -0400 Subject: [PATCH] Support in no_proxy for domain names with whitespaces and leading dots Resolves: rhbz#1384810 --- ...xy-with-whitespaces-and-leading-dots.patch | 71 +++++++++++++++++++ ruby.spec | 11 ++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch diff --git a/ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch b/ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch new file mode 100644 index 0000000..fb91f9a --- /dev/null +++ b/ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch @@ -0,0 +1,71 @@ +From 423d042371d0402071c309dc403ea2701600a98b Mon Sep 17 00:00:00 2001 +From: nobu +Date: Sat, 13 Feb 2016 08:12:21 +0000 +Subject: [PATCH] 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] + +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e +--- + ChangeLog | 6 ++++++ + lib/uri/generic.rb | 2 +- + test/uri/test_generic.rb | 4 ++++ + 3 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog b/ChangeLog +index 2945679..44116e0 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++Sat Feb 13 17:11:58 2016 Fabian Wiesel ++ ++ * 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] ++ + Tue Apr 26 02:58:51 2016 Marcus Stollsteimer + + * doc/extension.rdoc: Improvements to english grammers. +diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb +index aba54c1..f2a2d56 100644 +--- a/lib/uri/generic.rb ++++ b/lib/uri/generic.rb +@@ -1546,7 +1546,7 @@ def find_proxy + + 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 fcfe1f9..ad189fc 100644 +--- a/test/uri/test_generic.rb ++++ b/test/uri/test_generic.rb +@@ -819,6 +819,14 @@ def test_find_proxy + 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) ++ } + with_env('http_proxy'=>'') { + assert_nil(URI("http://192.0.2.1/").find_proxy) + assert_nil(URI("ftp://192.0.2.1/").find_proxy) diff --git a/ruby.spec b/ruby.spec index 7de6871..9dca15c 100644 --- a/ruby.spec +++ b/ruby.spec @@ -23,7 +23,7 @@ %global ruby_archive %{ruby_archive}-%{?milestone}%{?!milestone:%{?revision:r%{revision}}} %endif -%global release 62 +%global release 63 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory three, since the @@ -124,6 +124,10 @@ Patch7: ruby-2.2.3-Generate-preludes-using-miniruby.patch # Disable colorized ./configure due to missing macro AS_FUNCTION_DESCRIBE in Autoconf # http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/m4sugar/m4sh.m4?id=d99fef0e1e8e7a4c04b97fc4c6e0ffb01463622c Patch9: ruby-2.3.0-Disable-colorized-configure.patch +# Support in no_proxy for domain names with whitespaces and leading dots +# https://bugzilla.redhat.com/show_bug.cgi?id=1384810 +# https://github.com/ruby/ruby/commit/423d042371d0402071c309dc403ea2701600a98b +Patch10: ruby-2.4.0-no_proxy-with-whitespaces-and-leading-dots.patch Requires: %{?scl_prefix}%{pkg_name}-libs%{?_isa} = %{version}-%{release} Requires: %{?scl_prefix}ruby(rubygems) >= %{rubygems_version} @@ -464,6 +468,7 @@ rm -rf ext/fiddle/libffi* %patch6 -p1 %patch7 -p1 %patch9 -p1 +%patch10 -p1 # Allow to use autoconf 2.63. sed -i '/AC_PREREQ/ s/(.*)/(2.62)/' configure.in @@ -958,6 +963,10 @@ make check TESTS="-v $DISABLE_TESTS" %{ruby_libdir}/tkextlib %changelog +* Mon Oct 17 2016 Pavel Valena +- Support in no_proxy for domain names with whitespaces and leading dots + Resolves: rhbz#1384810 + * Fri Aug 12 2016 Pavel Valena - 2.3.1-62 - Fix support for dependent^2 SCLs - Update to Ruby 2.3.1