mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/url: reject query values with semicolons
Semicolons are no longer valid separators, so net/url.ParseQuery will now return an error if any part of the query contains a semicolon. net/http.(*Request).ParseMultipartForm has been changed to fall through and continue parsing even if the call to (*Request).ParseForm fails. This change also includes a few minor refactors to existing tests. Fixes #25192 Change-Id: Iba3f108950fb99b9288e402c41fe71ca3a2ababd Reviewed-on: https://go-review.googlesource.com/c/go/+/325697 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
parent
139e935d3c
commit
e6dda19888
6 changed files with 145 additions and 36 deletions
|
|
@ -72,13 +72,13 @@ func ExampleURL_ResolveReference() {
|
|||
}
|
||||
|
||||
func ExampleParseQuery() {
|
||||
m, err := url.ParseQuery(`x=1&y=2&y=3;z`)
|
||||
m, err := url.ParseQuery(`x=1&y=2&y=3`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(toJSON(m))
|
||||
// Output:
|
||||
// {"x":["1"], "y":["2", "3"], "z":[""]}
|
||||
// {"x":["1"], "y":["2", "3"]}
|
||||
}
|
||||
|
||||
func ExampleURL_EscapedPath() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue