aboutsummaryrefslogtreecommitdiff
path: root/uri.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2020-02-28 18:56:02 +0100
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2020-02-28 18:56:02 +0100
commit76b74e34c20dfaf25e491571044655e3fdf39c19 (patch)
tree70774031af6dd275fbd219bec05cade202f0e62f /uri.go
parentAdd prefork utility (#741) (diff)
downloadfasthttp-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.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/uri.go b/uri.go
index 80e5bf3..c9a81d4 100644
--- a/uri.go
+++ b/uri.go
@@ -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 {