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 fields set in Request.URL in handler #3805
Labels
Milestone
Comments
Comment 1 by kelwert@mtu.edu: Notes: This appears to be the case in stable and from the tip. |
Some additional details: lucky(~/src) go run http.go & [1] 2170 lucky(~/src) % curl http://alice:bob@lucky.local:8080/foo/bar?baz#flobble &url.URL{Scheme:"", Opaque:"", User:(*url.Userinfo)(nil), Host:"", Path:"/foo/bar", RawQuery:"baz", Fragment:""} &http.Request{Method:"GET", URL:(*url.URL)(0xf8400683f0), Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{"Authorization":[]string{"Basic YWxpY2U6Ym9i"}, "User-Agent":[]string{"curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"}, "Accept":[]string{"*/*"}}, Body:(*http.body)(0xf84007a740), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Host:"lucky.local:8080", Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"192.168.1.25:56773", RequestURI:"/foo/bar?baz", TLS:(*tls.ConnectionState)(nil)} Attachments:
|
Fragments are never sent in HTTP. They're purely a local browser concept. Opaque and Fragment should not be set. Scheme isn't necessarily known... the HTTP package just uses a listener. It doesn't know the details of how a connection was made. Although I'm sure we could hack it to make it work for the common two types. |
Comment 4 by kelwert@mtu.edu: Shouldn't Host be set though? |
This seems to me mainly a doc fix. If the request said GET /foo then r.URL.Host will be empty. If the request said GET http://you.com/foo then r.URL.Host will be "you.com". But that's only common in proxies. r.Host is the convenience, the effective host regardless of the request form. r.URL tells you what was sent in the GET line. Labels changed: added priority-later, removed priority-triage. Status changed to Accepted. |
This issue was closed by revision 948f0b7. Status changed to Fixed. |
gopherbot
added
fixed
Suggested
Issues that may be good for new contributors looking for work to do.
labels
Jan 2, 2013
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
by kelwert@mtu.edu:
The text was updated successfully, but these errors were encountered: