aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-28 06:20:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-28 06:20:20 +0000
commit02f18c0cdb2d4e5478d9a2e810513de4f76706b3 (patch)
treea2f07bed9e284c291e3409e5a5eb85ba191bcb78
parent1a08b2be8e3e8d36dcee7640b57ba7635f207227 (diff)
downloadruby-02f18c0cdb2d4e5478d9a2e810513de4f76706b3.tar.gz
Cache no proxy case
* lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/http.rb4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 27af2cdad2..303cacca06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jun 28 15:20:18 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#proxy_uri): cache the case no proxy
+ is used.
+
Tue Jun 28 09:56:29 2016 Stefan Schussler <mail@stefanschuessler.de>
* object.c (rb_mod_eqq): [DOC] Fix typo in RDoc. [Fix GH-1393]
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 326d737692..4738bc621a 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1049,9 +1049,11 @@ module Net #:nodoc:
# The proxy URI determined from the environment for this connection.
def proxy_uri # :nodoc:
+ return if @proxy_uri == false
@proxy_uri ||= URI::HTTP.new(
"http".freeze, nil, address, port, nil, nil, nil, nil, nil
- ).find_proxy
+ ).find_proxy || false
+ @proxy_uri || nil
end
# The address of the proxy server, if one is configured.