Browse Source

net: fix HTTP_PROXY include escape characters error, fix #275

fatedier 7 năm trước cách đây
mục cha
commit
6c13b6d37a
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      utils/net/tcp.go

+ 3 - 1
utils/net/tcp.go

@@ -128,7 +128,9 @@ func ConnectTcpServerByHttpProxy(httpProxy string, serverAddr string) (c Conn, e
 
 	var proxyAuth string
 	if proxyUrl.User != nil {
-		proxyAuth = "Basic " + base64.StdEncoding.EncodeToString([]byte(proxyUrl.User.String()))
+		username := proxyUrl.User.Username()
+		passwd, _ := proxyUrl.User.Password()
+		proxyAuth = "Basic " + base64.StdEncoding.EncodeToString([]byte(username+":"+passwd))
 	}
 
 	if proxyUrl.Scheme != "http" {