aboutsummaryrefslogtreecommitdiff
path: root/uri.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2020-05-25 20:26:56 +0200
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2020-05-25 20:27:15 +0200
commit123f6a8cee92a692af12c77d82cd15cf3515e39b (patch)
treeae970de43e53517075eb0e23fcf02f23a6a249de /uri.go
parentMerge pull request #810 from valyala/brotli (diff)
downloadfasthttp-123f6a8cee92a692af12c77d82cd15cf3515e39b.tar.gz
fasthttp-123f6a8cee92a692af12c77d82cd15cf3515e39b.tar.bz2
fasthttp-123f6a8cee92a692af12c77d82cd15cf3515e39b.zip
Fix memory reusage bug with auth
Fixes #814
Diffstat (limited to 'uri.go')
-rw-r--r--uri.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/uri.go b/uri.go
index 9d64db8..a8b915a 100644
--- a/uri.go
+++ b/uri.go
@@ -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]
}
}