diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2020-02-28 18:56:02 +0100 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2020-02-28 18:56:02 +0100 |
commit | 76b74e34c20dfaf25e491571044655e3fdf39c19 (patch) | |
tree | 70774031af6dd275fbd219bec05cade202f0e62f /uri.go | |
parent | Add prefork utility (#741) (diff) | |
download | fasthttp-76b74e34c20dfaf25e491571044655e3fdf39c19.tar.gz fasthttp-76b74e34c20dfaf25e491571044655e3fdf39c19.tar.bz2 fasthttp-76b74e34c20dfaf25e491571044655e3fdf39c19.zip |
Don't send the fragment/hash/# part of a URL to the server
Fixes https://github.com/valyala/fasthttp/issues/748
Diffstat (limited to 'uri.go')
-rw-r--r-- | uri.go | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -401,10 +401,6 @@ func (u *URI) RequestURI() []byte { dst = append(dst, '?') dst = append(dst, u.queryString...) } - if len(u.hash) > 0 { - dst = append(dst, '#') - dst = append(dst, u.hash...) - } u.requestURI = dst return u.requestURI } @@ -519,7 +515,12 @@ func (u *URI) FullURI() []byte { // AppendBytes appends full uri to dst and returns the extended dst. func (u *URI) AppendBytes(dst []byte) []byte { dst = u.appendSchemeHost(dst) - return append(dst, u.RequestURI()...) + dst = append(dst, u.RequestURI()...) + if len(u.hash) > 0 { + dst = append(dst, '#') + dst = append(dst, u.hash...) + } + return dst } func (u *URI) appendSchemeHost(dst []byte) []byte { |