Method: HTTPX::Plugins::Proxy::HTTP::ProxyParser#set_protocol_headers

Defined in:
lib/httpx/plugins/proxy/http.rb

#set_protocol_headers(request) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
# File 'lib/httpx/plugins/proxy/http.rb', line 185

def set_protocol_headers(request)
  extra_headers = super

  proxy_params = @options.proxy
  if proxy_params.scheme == "basic"
    # opt for basic auth
    extra_headers["proxy-authorization"] = proxy_params.authenticate(extra_headers)
  end
  extra_headers["proxy-connection"] = extra_headers.delete("connection") if extra_headers.key?("connection")
  extra_headers
end