Prechádzať zdrojové kódy

Basic authorization header for proxy needs to be 'Proxy-Authorization'

Eugene Fryntov 10 rokov pred
rodič
commit
0693d6a93a
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      psiphon/upstreamproxy/auth_basic.go

+ 2 - 1
psiphon/upstreamproxy/auth_basic.go

@@ -24,7 +24,8 @@ func newBasicAuthenticator(challenge string) *BasicHttpAuthenticator {
 
 
 func (a BasicHttpAuthenticator) authenticate(req *http.Request, username, password string) error {
 func (a BasicHttpAuthenticator) authenticate(req *http.Request, username, password string) error {
 	if a.state == BASIC_HTTP_AUTH_STATE_CHALLENGE_RECEIVED {
 	if a.state == BASIC_HTTP_AUTH_STATE_CHALLENGE_RECEIVED {
-		req.SetBasicAuth(username, password)
+		auth := username + ":" + password
+		req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(auth)))
 		a.state = BASIC_HTTP_AUTH_STATE_RESPONSE_GENERATED
 		a.state = BASIC_HTTP_AUTH_STATE_RESPONSE_GENERATED
 		return nil
 		return nil
 	} else {
 	} else {