diff options
author | Amzza0x00 <32904523+Amzza0x00@users.noreply.github.com> | 2022-12-08 15:03:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-08 15:03:55 +0800 |
commit | f6aac906c86613d36ecfc0cdaafee8b868cdbe60 (patch) | |
tree | 1cc1aac0fe8d10eebcca9ae1d740d4e40005d535 /fasthttpproxy | |
parent | add optional simulated addresses to pipeconn and inmemorylistener (#1449) (diff) | |
download | fasthttp-f6aac906c86613d36ecfc0cdaafee8b868cdbe60.tar.gz fasthttp-f6aac906c86613d36ecfc0cdaafee8b868cdbe60.tar.bz2 fasthttp-f6aac906c86613d36ecfc0cdaafee8b868cdbe60.zip |
Fixed an error caused of character when @ > 1 during proxy authentication (#1452)
* Fixed a error caused by more @ character during proxy authentication
* Fixed a error caused by more @ character during proxy authentication
Diffstat (limited to 'fasthttpproxy')
-rw-r--r-- | fasthttpproxy/http.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fasthttpproxy/http.go b/fasthttpproxy/http.go index b814a4c..9dd5a25 100644 --- a/fasthttpproxy/http.go +++ b/fasthttpproxy/http.go @@ -34,9 +34,9 @@ func FasthttpHTTPDialer(proxy string) fasthttp.DialFunc { func FasthttpHTTPDialerTimeout(proxy string, timeout time.Duration) fasthttp.DialFunc { var auth string if strings.Contains(proxy, "@") { - split := strings.Split(proxy, "@") - auth = base64.StdEncoding.EncodeToString([]byte(split[0])) - proxy = split[1] + index := strings.LastIndex(proxy, "@") + auth = base64.StdEncoding.EncodeToString([]byte(proxy[:index])) + proxy = proxy[index+1:] } return func(addr string) (net.Conn, error) { |