lib/httpx/plugins/proxy/ssh.rb in httpx-0.4.0 vs lib/httpx/plugins/proxy/ssh.rb in httpx-0.4.1

- old
+ new

@@ -4,12 +4,11 @@ module HTTPX module Plugins module Proxy module SSH - def self.load_dependencies(_klass, *) - # klass.plugin(:proxy) + def self.load_dependencies(*) require "net/ssh/gateway" end def self.extra_options(options) Class.new(options.class) do @@ -70,9 +69,24 @@ when "http" TCPSocket.open("localhost", port) else raise Error, "unexpected scheme: #{request_uri.scheme}" end + end + end + + module ConnectionMethods + def match?(uri, options) + return super unless @options.proxy + + super && @options.proxy == options.proxy + end + + # should not coalesce connections here, as the IP is the IP of the proxy + def coalescable?(*) + return super unless @options.proxy + + false end end end end register_plugin :"proxy/ssh", Proxy::SSH