Properly copy Request.uri and Request.postArgs

This commit is contained in:
Aliaksandr Valialkin
2015-11-29 12:11:12 +02:00
parent 3a406649a1
commit 1e26cafa01
2 changed files with 8 additions and 6 deletions
+7 -6
View File
@@ -157,12 +157,13 @@ func (req *Request) CopyTo(dst *Request) {
dst.Reset()
req.Header.CopyTo(&dst.Header)
dst.body = append(dst.body[:0], req.body...)
if req.parsedURI {
dst.parseURI()
}
if req.parsedPostArgs {
dst.parsePostArgs()
}
req.uri.CopyTo(&dst.uri)
dst.parsedURI = req.parsedURI
req.postArgs.CopyTo(&dst.postArgs)
dst.parsedPostArgs = req.parsedPostArgs
// do not copy multipartForm - it will be automatically
// re-created on the first call to MultipartForm.
}
+1
View File
@@ -28,6 +28,7 @@ type URI struct {
// CopyTo copies uri contents to dst.
func (x *URI) CopyTo(dst *URI) {
dst.Reset()
dst.pathOriginal = append(dst.pathOriginal[:0], x.pathOriginal...)
dst.scheme = append(dst.scheme[:0], x.scheme...)
dst.path = append(dst.path[:0], x.path...)