From 8ca064de3fd1258f8ae21823ff4515125179b548 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 9 May 2025 12:13:51 +0900 Subject: [PATCH 1/2] Use cgi/escape or cgi/util instead of the all of CGI features --- lib/net/http/persistent.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/net/http/persistent.rb b/lib/net/http/persistent.rb index de19192..0485692 100644 --- a/lib/net/http/persistent.rb +++ b/lib/net/http/persistent.rb @@ -1,6 +1,10 @@ require 'net/http' require 'uri' -require 'cgi' # for escaping +begin + require 'cgi/escape' +rescue LoadError + require 'cgi/util' # for escaping +end require 'connection_pool' begin @@ -826,7 +830,7 @@ def proxy= proxy @proxy_connection_id = [nil, *@proxy_args].join ':' if @proxy_uri.query then - @no_proxy = CGI.parse(@proxy_uri.query)['no_proxy'].join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? } + @no_proxy = URI.decode_www_form(@proxy_uri.query).filter_map { |k, v| v if k == 'no_proxy' }.join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? } end end From 9b6fbd733cf35596dfe7f80c0c154f9f3d17dbdb Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Mon, 12 May 2025 12:01:01 +0900 Subject: [PATCH 2/2] Make to load CGI::Util with old versions of CGI --- lib/net/http/persistent.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/net/http/persistent.rb b/lib/net/http/persistent.rb index 0485692..b430f1f 100644 --- a/lib/net/http/persistent.rb +++ b/lib/net/http/persistent.rb @@ -1,10 +1,7 @@ require 'net/http' require 'uri' -begin - require 'cgi/escape' -rescue LoadError - require 'cgi/util' # for escaping -end +require 'cgi/escape' +require 'cgi/util' unless defined?(CGI::EscapeExt) require 'connection_pool' begin