module HTTPX::Plugins::Proxy::HTTP::InstanceMethods

  1. lib/httpx/plugins/proxy/http.rb

Public Instance methods

fetch_response(request, connections, options)
[show source]
   # File lib/httpx/plugins/proxy/http.rb
26 def fetch_response(request, connections, options)
27   response = super
28 
29   if response &&
30      response.is_a?(Response) &&
31      response.status == 407 &&
32      !request.headers.key?("proxy-authorization") &&
33      response.headers.key?("proxy-authenticate")
34 
35     uri = request.uri
36 
37     proxy_options = proxy_options(uri, options)
38     connection = connections.find do |conn|
39       conn.match?(uri, proxy_options)
40     end
41 
42     if connection && connection.options.proxy.can_authenticate?(response.headers["proxy-authenticate"])
43       request.transition(:idle)
44       request.headers["proxy-authorization"] =
45         connection.options.proxy.authenticate(request, response.headers["proxy-authenticate"])
46       send_request(request, connections)
47       return
48     end
49   end
50 
51   response
52 end
with_proxy_basic_auth(opts)
[show source]
   # File lib/httpx/plugins/proxy/http.rb
14 def with_proxy_basic_auth(opts)
15   with(proxy: opts.merge(scheme: "basic"))
16 end
with_proxy_digest_auth(opts)
[show source]
   # File lib/httpx/plugins/proxy/http.rb
18 def with_proxy_digest_auth(opts)
19   with(proxy: opts.merge(scheme: "digest"))
20 end
with_proxy_ntlm_auth(opts)
[show source]
   # File lib/httpx/plugins/proxy/http.rb
22 def with_proxy_ntlm_auth(opts)
23   with(proxy: opts.merge(scheme: "ntlm"))
24 end