diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2017-11-08 13:05:29 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2017-11-08 13:05:29 +0200 |
commit | e2ac397815808b48a6f634b82e6b96bec382dadb (patch) | |
tree | 97fd799016c9f5a6cd30cb91747319d37e8bb17c /uri.go | |
parent | Added RequestCtx.String that returns unique string representation of the requ... (diff) | |
download | fasthttp-e2ac397815808b48a6f634b82e6b96bec382dadb.tar.gz fasthttp-e2ac397815808b48a6f634b82e6b96bec382dadb.tar.bz2 fasthttp-e2ac397815808b48a6f634b82e6b96bec382dadb.zip |
Parse bogus uris with missing slash after hostname like `http://foobar.com?baz=123`, since such uris occur in real life :(
Diffstat (limited to 'uri.go')
-rw-r--r-- | uri.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -500,6 +500,11 @@ func splitHostURI(host, uri []byte) ([]byte, []byte, []byte) { uri = uri[n:] n = bytes.IndexByte(uri, '/') 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:] + } return scheme, uri, strSlash } return scheme, uri[:n], uri[n:] |