aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W Higgins <wishdev@gmail.com>2020-05-21 11:22:18 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-11 13:37:24 +0900
commit6742fcf5531f29b1cce33ab32895513b87f3f53e (patch)
tree40b223c7c13d5acb02750aac7e435d9545f7abf6
parentfdd475386d25948fc9c82930c9c7e2feb6e69e84 (diff)
downloadruby-6742fcf5531f29b1cce33ab32895513b87f3f53e.tar.gz
[ruby/webrick] Extract creation of Net::HTTP in httpproxy
https://github.com/ruby/webrick/commit/e58195faf8
-rw-r--r--lib/webrick/httpproxy.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb
index d05d59514c..496a3ff2d6 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -295,6 +295,10 @@ module WEBrick
return FakeProxyURI
end
+ def create_net_http(uri, upstream)
+ Net::HTTP.new(uri.host, uri.port, upstream.host, upstream.port)
+ end
+
def perform_proxy_request(req, res, req_class, body_stream = nil)
uri = req.request_uri
path = uri.path.dup
@@ -303,7 +307,7 @@ module WEBrick
upstream = setup_upstream_proxy_authentication(req, res, header)
body_tmp = []
- http = Net::HTTP.new(uri.host, uri.port, upstream.host, upstream.port)
+ http = create_net_http(uri, upstream)
req_fib = Fiber.new do
http.start do
if @config[:ProxyTimeout]