aboutsummaryrefslogtreecommitdiff
path: root/fasthttpproxy
diff options
context:
space:
mode:
authorGravatar Amzza0x00 <32904523+Amzza0x00@users.noreply.github.com> 2022-12-08 15:03:55 +0800
committerGravatar GitHub <noreply@github.com> 2022-12-08 15:03:55 +0800
commitf6aac906c86613d36ecfc0cdaafee8b868cdbe60 (patch)
tree1cc1aac0fe8d10eebcca9ae1d740d4e40005d535 /fasthttpproxy
parentadd optional simulated addresses to pipeconn and inmemorylistener (#1449) (diff)
downloadfasthttp-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.go6
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) {