]> Cypherpunks repositories - gostls13.git/commit
net/url: only record RawPath when it is needed
authorRuss Cox <rsc@golang.org>
Tue, 30 Jun 2015 15:28:29 +0000 (11:28 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 30 Jun 2015 15:54:27 +0000 (15:54 +0000)
commit8e6dc76e1f14088546ef99d00d884ac5057b349f
treea8e384aa88ceef7e37bce1c9d5f8bf1be1e1019c
parent19b8aa3b5ddbc3937d9acab64fcfad581a73773d
net/url: only record RawPath when it is needed

RawPath is a hint to the desired encoding of Path.
It is ignored when it is not a valid encoding of Path,
such as when Path has been changed but RawPath has not.
It is not ignored but also not useful when it matches
the url package's natural choice of encoding.
In this latter case, set it to the empty string.
This should help drive home the point that clients
cannot in general depend on it being present and
that they should use the EncodedPath method instead.

This also reduces the impact of the change on tests,
especially tests that use reflect.DeepEqual on parsed URLs.

Change-Id: I437c51a33b85439a31c307caf1436118508ea196
Reviewed-on: https://go-review.googlesource.com/11760
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/readrequest_test.go
src/net/url/url.go
src/net/url/url_test.go