-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
The current implementation of the http.Reuest allows parsing and setting the basic authentication username and password using the BasicAuth and SetBasicAuth methods. When authenticating to a http proxy server the http client and server are using a different header for the basic authentication - "Proxy-Authorization" described in RFC 2068, Section 14. Supporting parsing and setting proxy basic authentication is currently not covered in the net/http package and would be very helpful when programming http proxy client/server.
To help tackle this, I propose the following API:
// ProxyBasicAuth returns the username and password provided in the request's
// Proxy-Authorization header, if the request uses HTTP Basic Authentication.
// See RFC 2068, Section 14.
(r *Request) ProxyBasicAuth() (username, password string, ok bool)
// SetProxyBasicAuth sets the request's Proxy-Authorization header to use HTTP
// Basic Authentication with the provided username and password.
(r *Request) SetProxyBasicAuth(username, password string)