From 4ad17ba8692d1c4905966e9adb5f36d3a42f4974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B2=B3?= Date: Sat, 7 Dec 2019 22:25:03 +0800 Subject: [PATCH] fix npc http proxy verify bug --- client/control.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/control.go b/client/control.go index faf0fcb..e4a67a8 100644 --- a/client/control.go +++ b/client/control.go @@ -198,7 +198,7 @@ func NewConn(tp string, vkey string, server string, connType string, proxyUrl st return nil, er } connection, err = n.Dial("tcp", server) - case "http": + default: connection, err = NewHttpProxyConn(u, server) } } else { @@ -262,7 +262,7 @@ func NewHttpProxyConn(url *url.URL, remoteAddr string) (net.Conn, error) { Proto: "HTTP/1.1", } password, _ := url.User.Password() - req.Header.Set("Proxy-Authorization", "Basic "+basicAuth(url.User.Username(), password)) + req.Header.Set("Authorization", "Basic "+basicAuth(strings.Trim(url.User.Username(), " "), password)) b, err := httputil.DumpRequest(req, false) if err != nil { return nil, err