aboutsummaryrefslogtreecommitdiff
path: root/uri.go
diff options
context:
space:
mode:
authorGravatar Vitali Pikulik <v.pikulik@gmail.com> 2020-08-21 16:21:23 +0200
committerGravatar GitHub <noreply@github.com> 2020-08-21 16:21:23 +0200
commitaa3f96c883322033099b4466c151893a3f9c2172 (patch)
tree40f2871e6c7f189a4846557f70e8065ba123682b /uri.go
parentTravis doesn't seem to support tip anymore (diff)
downloadfasthttp-aa3f96c883322033099b4466c151893a3f9c2172.tar.gz
fasthttp-aa3f96c883322033099b4466c151893a3f9c2172.tar.bz2
fasthttp-aa3f96c883322033099b4466c151893a3f9c2172.zip
Git commit fix URI parse for urls like host.dm?some/path/to/file (#866)
Diffstat (limited to 'uri.go')
-rw-r--r--uri.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/uri.go b/uri.go
index 695efe4..0650c93 100644
--- a/uri.go
+++ b/uri.go
@@ -575,11 +575,15 @@ func splitHostURI(host, uri []byte) ([]byte, []byte, []byte) {
n += len(strSlashSlash)
uri = uri[n:]
n = bytes.IndexByte(uri, '/')
- if n < 0 {
+ nq := bytes.IndexByte(uri, '?')
+ if nq >= 0 && nq < n {
+ // A hack for urls like foobar.com?a=b/xyz
+ n = nq
+ } else if n < 0 {
// A hack for bogus urls like foobar.com?a=b without
// slash after host.
- if n = bytes.IndexByte(uri, '?'); n >= 0 {
- return scheme, uri[:n], uri[n:]
+ if nq >= 0 {
+ return scheme, uri[:nq], uri[nq:]
}
return scheme, uri, strSlash
}