Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: document the behavior of %2F in url strings #8450

Closed
gopherbot opened this issue Jul 30, 2014 · 6 comments
Closed

net/http: document the behavior of %2F in url strings #8450

gopherbot opened this issue Jul 30, 2014 · 6 comments

Comments

@gopherbot
Copy link
Contributor

by david.schmiddi.86:

What does 'go version' print?
go version go1.3 windows/amd64

What steps reproduce the problem?
http://play.golang.org/p/ZOqHmlFaU8

1. http.Get("https://example.com/search/Alive+%2F%2F+Well/true";)

What happened?
404

What should have happened instead?
200
The parameter is a string, it should not modify my provided url. I should care about
escaping myself or at least given an option or hint what is magically happening behind
the scenes.

Please provide any additional information below.

I stumbled across this on accident and after I finally found the flaw, I found a lot of
older issues and an updated note about this unexpected behavior in another package:
http://golang.org/pkg/net/url/#URL

It should be documented in net/http, that it uses net/url to parse, decode and reencode
the string url parameters and that %2F is going to be lost. I'd even document the
solution for users who need %2F support.
@jstemmer
Copy link
Contributor

Comment 1:

I'm trying to work around a similar problem. Note that the string "Alice // Well" in
your example is technically part of the URL path (and not a query parameter) which means
the escaping should behave differently. A space for example should be represented as %20
instead of +, so using url.QueryEscape may not always lead to correct escaping.

@gopherbot
Copy link
Contributor Author

Comment 2 by david.schmiddi.86:

But the "+" was the result of the encoder in http://golang.org/pkg/net/url/#URL .
http.Get(fmt.Sprintf("https://example.com/search/%s/true", url.QueryEscape(name)))

@mikioh
Copy link
Contributor

mikioh commented Aug 15, 2014

Comment 3:

cf. issue #5684

@griesemer
Copy link
Contributor

Comment 4:

Labels changed: added repo-main.

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

Isn't this already well documented?

@rsc rsc added this to the Go1.5 milestone Apr 10, 2015
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

(Original title mentioned RFC 3986.)

@rsc rsc changed the title net/http: document the not compliance of RFC 3986 regarding %2F in url strings net/http: document the behavior of %2F in url strings Apr 10, 2015
@rsc rsc removed the repo-main label Apr 14, 2015
@rsc rsc closed this as completed in 874a605 Jun 22, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants