]> Cypherpunks repositories - gostls13.git/commit
net/url: consider ForceQuery in ResolveReference
authorTimothy Gu <timothygu99@gmail.com>
Fri, 7 May 2021 08:03:59 +0000 (01:03 -0700)
committerDamien Neil <dneil@google.com>
Tue, 2 Nov 2021 00:12:17 +0000 (00:12 +0000)
commit81fea0b4fd3b134d4c1d121abad171e358037ce3
treef0d9927d48c7bbe79af5f26fd13bfef67670d6cb
parent02e5913406b2ac354695471690b79d8d4242ad8d
net/url: consider ForceQuery in ResolveReference

Previously, when resolving references of form
  (https://golang.org/?hello).ResolveReference(?)
we only used URL.RawQuery to determine whether or not a query part is
defined. Go 1.7 introduced URL.ForceQuery as a flag for the situation
where a query part is provided but empty. But we did not use it in
ResolveReference. This leads to the erroneous output
  https://golang.org/?hello
when the correct output should be
  https://golang.org/?
This commit rectifies that error.

Fixes #46033

Change-Id: I05bc0b48bf2bbf13b4ddc0dd10599ea613dc2188
Reviewed-on: https://go-review.googlesource.com/c/go/+/317930
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Damien Neil <dneil@google.com>
src/net/url/url.go
src/net/url/url_test.go