Skip to content

http: URLs with RawPath domain.com?query #2344

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

Closed
bradfitz opened this issue Oct 6, 2011 · 6 comments
Closed

http: URLs with RawPath domain.com?query #2344

bradfitz opened this issue Oct 6, 2011 · 6 comments

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Oct 6, 2011

http://google.com?q=ponies works in Chrome and Firefox.

url.Parse parses it as:

Hello, &url.URL{Raw:"http://google.com?q=ponies";, Scheme:"http",
RawAuthority:"google.com", RawUserinfo:"",
Host:"google.com", RawPath:"?q=ponies", Path:"",
OpaquePath:false, RawQuery:"q=ponies", Fragment:""}

Which I guess is correct, but the RawPath at least generates illegal Request.Write
headers:

GET ?q=ponies HTTP/1.1

Figure out the best fix.
@rsc
Copy link
Contributor

rsc commented Oct 6, 2011

Comment 1:

send /?q=ponies

@bradfitz
Copy link
Contributor Author

bradfitz commented Oct 6, 2011

Comment 2:

Yes, but I think only when it starts with a "?".  Because with a CONNECT request it can
be some host:port, and with an OPTIONS request it be be a single "*" symbol.
I did the prepend "/" in front of "?" thing in http://golang.org/cl/5213043

@rsc
Copy link
Contributor

rsc commented Oct 6, 2011

Comment 3:

that is, i think this is an http fix, not a url fix.

@bradfitz
Copy link
Contributor Author

bradfitz commented Oct 6, 2011

Comment 4:

yeah.  changed subject.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2011

Comment 5:

sgtm.  will review tomorrow.

@bradfitz
Copy link
Contributor Author

Comment 6:

Fixed in the same CL as
https://code.google.com/p/go/source/detail?r=af3d7d10735c1fbd4da60b624c661b9557471da0

Status changed to Fixed.

@bradfitz bradfitz self-assigned this Oct 12, 2011
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

3 participants