Module: HTTPX::Plugins::Proxy::HTTP::InstanceMethods
- Defined in:
- lib/httpx/plugins/proxy/http.rb
Instance Method Summary collapse
- #fetch_response(request, connections, options) ⇒ Object
- #with_proxy_basic_auth(opts) ⇒ Object
- #with_proxy_digest_auth(opts) ⇒ Object
- #with_proxy_ntlm_auth(opts) ⇒ Object
Instance Method Details
#fetch_response(request, connections, options) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/httpx/plugins/proxy/http.rb', line 26 def fetch_response(request, connections, ) 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, ) if connection..proxy.can_authenticate?(response.headers["proxy-authenticate"]) request.transition(:idle) request.headers["proxy-authorization"] = connection..proxy.authenticate(request, response.headers["proxy-authenticate"]) send_request(request, connections) return end end response end |
#with_proxy_basic_auth(opts) ⇒ Object
14 15 16 |
# File 'lib/httpx/plugins/proxy/http.rb', line 14 def with_proxy_basic_auth(opts) with(proxy: opts.merge(scheme: "basic")) end |
#with_proxy_digest_auth(opts) ⇒ Object
18 19 20 |
# File 'lib/httpx/plugins/proxy/http.rb', line 18 def with_proxy_digest_auth(opts) with(proxy: opts.merge(scheme: "digest")) end |
#with_proxy_ntlm_auth(opts) ⇒ Object
22 23 24 |
# File 'lib/httpx/plugins/proxy/http.rb', line 22 def with_proxy_ntlm_auth(opts) with(proxy: opts.merge(scheme: "ntlm")) end |