From 6c13b6d37a7ae28d3e109d8ac04cbb1ea1ccaebd Mon Sep 17 00:00:00 2001 From: fatedier Date: Tue, 23 May 2017 02:10:36 +0800 Subject: [PATCH] net: fix HTTP_PROXY include escape characters error, fix #275 --- utils/net/tcp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/net/tcp.go b/utils/net/tcp.go index 7412b5dc..ca71de0a 100644 --- a/utils/net/tcp.go +++ b/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" {