diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb index d05d5951..496a3ff2 100644 --- a/lib/webrick/httpproxy.rb +++ b/lib/webrick/httpproxy.rb @@ -295,6 +295,10 @@ def setup_upstream_proxy_authentication(req, res, header) 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 @@ def perform_proxy_request(req, res, req_class, body_stream = nil) 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]