Module: HTTPX::Plugins::Proxy::HTTP::ProxyParser

Defined in:
lib/httpx/plugins/proxy/http.rb,
sig/plugins/proxy/http.rbs

Instance Method Summary collapse

Instance Method Details

#join_headline(request) ⇒ Object



244
245
246
247
248
# File 'lib/httpx/plugins/proxy/http.rb', line 244

def join_headline(request)
  return super if request.verb == "CONNECT"

  "#{request.verb} #{request.uri} HTTP/#{@version.join(".")}"
end

#set_protocol_headers(request) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
# File 'lib/httpx/plugins/proxy/http.rb', line 250

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