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     connection = find_connection(request, connections, options)
36 
37     if connection.options.proxy.can_authenticate?(response.headers["proxy-authenticate"])
38       request.transition(:idle)
39       request.headers["proxy-authorization"] =
40         connection.options.proxy.authenticate(request, response.headers["proxy-authenticate"])
41       send_request(request, connections)
42       return
43     end
44   end
45 
46   response
47 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