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: Proto when set is not used properly. #13985
Comments
After looking into the code i see that fix to be
|
and testing the program again.
|
Changing to an unsupported server for 2.0
|
CL https://golang.org/cl/18705 mentions this issue. |
The comment on Request.Proto says // The protocol version for incoming requests.
// Client requests always use HTTP/1.1. So, yeah there is nothing to fix. The code already works as documented. Also this won't work for HTTP 2 anyway as it's implemented in the golang.org/x/net/http2 repo which is vendored into the net/http package. The comment on Request.Proto should probably be updated to say that HTTP/2.0 will be used for client requests if available. |
The comment actually had been updated. Read at tip.golang.org/pkg/net/http |
I replied further on https://golang.org/cl/18705 |
This is what led to this change. I see the 'keep-alive' change i didn't address.
|
I don't understand. |
`Proto string // "HTTP/1.0"`` is never honored. |
What about it? That's a valid example value you might get for server requests. |
Now i see that i didn't read the comment properly, since client is supposed to automatically handle the incoming requests based on their proto. One of the reasons why one would ignore That was my confusion, thanks for clarifying. But is it ever valid to set |
"For client requests these fields are ignored." I don't know how I can word that more clearly. |
Hmm, okay. Understood. |
I actually did think how I can word it more clearly. I sent out https://go-review.googlesource.com/18720 |
CL https://golang.org/cl/18720 mentions this issue. |
Thanks. |
No need to say "by default" because there is no alternative and no way to override. Always HTTP/2.0 is officially spelled HTTP/2 these days. Fixes #13985 harder Change-Id: Ib1ec03cec171ca865342b8e7452cd4c707d7b770 Reviewed-on: https://go-review.googlesource.com/18720 Reviewed-by: Rob Pike <r@golang.org>
For example even after setting request
Proto
has no affect on how http.Client sends request, it always defaults to. 'HTTP/1.1'Now testing with
.Proto
as 'HTTP/2.0' defaults to 'HTTP/1.1'The text was updated successfully, but these errors were encountered: