diff options
author | Vitali Pikulik <v.pikulik@gmail.com> | 2020-08-21 16:21:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-21 16:21:23 +0200 |
commit | aa3f96c883322033099b4466c151893a3f9c2172 (patch) | |
tree | 40f2871e6c7f189a4846557f70e8065ba123682b /uri.go | |
parent | Travis doesn't seem to support tip anymore (diff) | |
download | fasthttp-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.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 } |