lib/httpx/plugins/proxy.rb in httpx-0.6.7 vs lib/httpx/plugins/proxy.rb in httpx-0.7.0

- old
+ new

@@ -66,21 +66,21 @@ end def extra_options(options) Class.new(options.class) do def_option(:proxy) do |pr| - Hash[pr] + if pr.is_a?(Parameters) + pr + else + Hash[pr] + end end end.new(options) end end module InstanceMethods - def with_proxy(*args) - branch(default_options.with_proxy(*args)) - end - private def proxy_uris(uri, options) @_proxy_uris ||= begin uris = options.proxy ? Array(options.proxy[:uri]) : [] @@ -102,11 +102,11 @@ proxy_options = options.merge(proxy: Parameters.new(**next_proxy)) connection = pool.find_connection(uri, proxy_options) || build_connection(uri, proxy_options) unless connections.nil? || connections.include?(connection) connections << connection - set_connection_callbacks(connection, options) + set_connection_callbacks(connection, connections, options) end connection end def build_connection(uri, options) @@ -127,16 +127,15 @@ log { "failed connecting to proxy, trying next..." } request.transition(:idle) connection = find_connection(request, connections, options) connections << connection unless connections.include?(connection) connection.send(request) - set_request_timeout(connection, request, options) return end response end - def build_altsvc_connection(_, _, _, _, options) + def build_altsvc_connection(_, _, _, _, _, options) return if options.proxy super end end