net/url: resolvePath should not collapse leading slashes in the path component #21158
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?master
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Using Go's
net/http
DefaultClient, make a GET request that returns a redirect to a fully formed Location URI.What did you expect to see?
The
http.Client
should redirect tohttp://example.com//foo/bar
, as instructed by the Location header.What did you see instead?
The
http.Client
redirected tohttp://example.com/foo/bar
, which is a cleaned-up URL, with a single slash instead of double.The
http.Client.Do()
code is usingreq.URL.Parse()
on the Location header here: https://github.com/golang/go/blob/master/src/net/http/client.go#L529-L538Behaviour of other clients
curl
will use the Location header byte-for-byte, and correctly redirect to the double-slash:Playground
Here is an example of the incorrect behavior:
https://play.golang.org/p/ZgPpXddu2G
The text was updated successfully, but these errors were encountered: