lib/httpx/plugins/proxy.rb in httpx-0.2.1 vs lib/httpx/plugins/proxy.rb in httpx-0.3.0

- old
+ new

@@ -48,15 +48,16 @@ end def find_channel(request, **options) uri = URI(request.uri) proxy = proxy_params(uri) - return super unless proxy + raise Error, "Failed to connect to proxy" unless proxy @connection.find_channel(proxy) || build_channel(proxy, options) end def build_channel(proxy, options) + return super if proxy.is_a?(URI::Generic) channel = build_proxy_channel(proxy, **options) set_channel_callbacks(channel, options) channel end @@ -114,9 +115,13 @@ true end def send(request, **args) @pending << [request, args] + end + + def connecting? + super || @state == :connecting || @state == :connected end def to_io case @state when :idle