aboutsummaryrefslogtreecommitdiff
path: root/uri.go
diff options
context:
space:
mode:
authorGravatar Mike Faraponov <11322032+moredure@users.noreply.github.com> 2021-03-20 16:57:57 +0200
committerGravatar GitHub <noreply@github.com> 2021-03-20 15:57:57 +0100
commita5830066b63ab5b9664597a7d33ed44bd6264b31 (patch)
tree35ea2c703b9b6acb1783e4a943cf07e9f749ec78 /uri.go
parentFix unexpected panic when calling Do of a PipelineClient (#997) (diff)
downloadfasthttp-a5830066b63ab5b9664597a7d33ed44bd6264b31.tar.gz
fasthttp-a5830066b63ab5b9664597a7d33ed44bd6264b31.tar.bz2
fasthttp-a5830066b63ab5b9664597a7d33ed44bd6264b31.zip
Use bytes.IndexByte instead of bytes.Index for single byte lookup (#999)
* Update uri.go * Update strings.go
Diffstat (limited to 'uri.go')
-rw-r--r--uri.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/uri.go b/uri.go
index 0788a60..c468183 100644
--- a/uri.go
+++ b/uri.go
@@ -285,11 +285,11 @@ func (u *URI) parse(host, uri []byte, isTLS bool) error {
u.scheme = append(u.scheme[:0], strHTTPS...)
}
- if n := bytes.Index(host, strAt); n >= 0 {
+ if n := bytes.IndexByte(host, '@'); n >= 0 {
auth := host[:n]
host = host[n+1:]
- if n := bytes.Index(auth, strColon); n >= 0 {
+ if n := bytes.IndexByte(auth, ':'); n >= 0 {
u.username = append(u.username[:0], auth[:n]...)
u.password = append(u.password[:0], auth[n+1:]...)
} else {