mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
+1
-1
@@ -112,7 +112,7 @@ func TestClientURLAuth(t *testing.T) {
|
||||
for up, expected := range cases {
|
||||
req := AcquireRequest()
|
||||
req.Header.SetMethod(MethodGet)
|
||||
req.SetRequestURI("http://" + up + "example.com")
|
||||
req.SetRequestURI("http://" + up + "example.com/foo/bar")
|
||||
if err := c.Do(req, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -284,11 +284,11 @@ func (u *URI) parse(host, uri []byte, isTLS bool) {
|
||||
host = host[n+1:]
|
||||
|
||||
if n := bytes.Index(auth, strColon); n >= 0 {
|
||||
u.username = auth[:n]
|
||||
u.password = auth[n+1:]
|
||||
u.username = append(u.username[:0], auth[:n]...)
|
||||
u.password = append(u.password[:0], auth[n+1:]...)
|
||||
} else {
|
||||
u.username = auth
|
||||
u.password = auth[:0] // Make sure it's not nil
|
||||
u.username = append(u.username[:0], auth...)
|
||||
u.password = u.password[:0]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user