lib/httpx/plugins/proxy.rb in httpx-0.18.7 vs lib/httpx/plugins/proxy.rb in httpx-0.19.0
- old
+ new
@@ -1,11 +1,7 @@
# frozen_string_literal: true
-require "resolv"
-require "ipaddr"
-require "forwardable"
-
module HTTPX
class HTTPProxyError < Error; end
module Plugins
#
@@ -115,10 +111,11 @@
end
end
def fetch_response(request, connections, options)
response = super
+
if response.is_a?(ErrorResponse) &&
__proxy_error?(response) && !@_proxy_uris.empty?
@_proxy_uris.shift
log { "failed connecting to proxy, trying next..." }
request.transition(:idle)
@@ -249,10 +246,10 @@
return super unless @options.proxy
case nextstate
when :closing
# this is a hack so that we can use the super method
- # and it'll thing that the current state is open
+ # and it'll think that the current state is open
@state = :open if @state == :connecting
end
super
end
end