lib/webrick/httpproxy.rb in webrick-1.6.1 vs lib/webrick/httpproxy.rb in webrick-1.7.0
- old
+ new
@@ -113,11 +113,11 @@
def proxy_service(req, res)
# Proxy Authentication
proxy_auth(req, res)
begin
- self.send("do_#{req.request_method}", req, res)
+ public_send("do_#{req.request_method}", req, res)
rescue NoMethodError
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."
rescue => err
logger.debug("#{err.class}: #{err.message}")
@@ -293,18 +293,22 @@
return upstream
end
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
path << "?" << uri.query if uri.query
header = setup_proxy_header(req, res)
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]
################################## these issues are
http.open_timeout = 30 # secs # necessary (maybe because