fixed:client http proxy

pull/426/head
cnlh 2020-02-29 00:32:56 +08:00
parent aec1a25557
commit 0865c98a7f
1 changed files with 6 additions and 5 deletions

View File

@ -254,11 +254,12 @@ func NewConn(tp string, vkey string, server string, connType string, proxyUrl st
//http proxy connection //http proxy connection
func NewHttpProxyConn(url *url.URL, remoteAddr string) (net.Conn, error) { func NewHttpProxyConn(url *url.URL, remoteAddr string) (net.Conn, error) {
req := &http.Request{ req := &http.Request{
Method: "CONNECT", Method: "CONNECT",
URL: url, URL: url,
Host: remoteAddr, Host: remoteAddr,
Header: http.Header{}, Header: http.Header{},
Proto: "HTTP/1.1", ProtoMajor: 1,
ProtoMinor: 1,
} }
password, _ := url.User.Password() password, _ := url.User.Password()
req.Header.Set("Authorization", "Basic "+basicAuth(strings.Trim(url.User.Username(), " "), password)) req.Header.Set("Authorization", "Basic "+basicAuth(strings.Trim(url.User.Username(), " "), password))