lib/httpx/plugins/proxy/http.rb in httpx-0.22.1 vs lib/httpx/plugins/proxy/http.rb in httpx-0.22.2
- old
+ new
@@ -21,10 +21,11 @@
def fetch_response(request, connections, options)
response = super
if response &&
+ response.is_a?(Response) &&
response.status == 407 &&
!request.headers.key?("proxy-authorization") &&
response.headers.key?("proxy-authenticate")
connection = find_connection(request, connections, options)
@@ -111,16 +112,17 @@
end
end
def __http_on_connect(request, response)
@inflight -= 1
- if response.status == 200
+ if response.is_a?(Response) && response.status == 200
req = @pending.first
request_uri = req.uri
@io = ProxySSL.new(@io, request_uri, @options)
transition(:connected)
throw(:called)
- elsif response.status == 407 &&
+ elsif response.is_a?(Response) &&
+ response.status == 407 &&
!request.headers.key?("proxy-authorization") &&
@options.proxy.can_authenticate?(response.headers["proxy-authenticate"])
request.transition(:idle)
request.headers["proxy-authorization"] = @options.proxy.authenticate(request, response.headers["proxy-authenticate"])