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 field empty for Requests passed to CheckRedirect after the first #31441
Comments
It's not obvious to me what you mean by “second time jump into CheckRedirect”. Could you give a concrete code snippet (ideally as a https://play.golang.org link) that demonstrates the problem? |
CheckRedirect is to call every time when http redirect to another destination!!! |
Thanks, the concrete code example makes it much clearer for me. |
CC @bradfitz |
Those aren't copied because they're not relevant. The docs on net/http.Request.Proto (https://golang.org/pkg/net/http/#Request.Proto) say:
So I'm not sure there's anything to do here. I could copy them through, but that'd only be misleading. |
So, the result above is correct? why? |
NewRequest populates its returned Request's Proto* fields, but that's a historical mistake. I think that predates understanding & documentation of what the Proto* fields represented. It wouldn't be worth it to change NewRequest at this point, but no need to add to the confusion by populating them in more places. |
So can fix this issue on next go release? |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Every time get the variable: Proto, always return HTTP/1.1
2019/04/12 22:52:02 GET / HTTP/1.1
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /intl/zh-TW/ HTTP/1.1
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /?hl=zh-TW HTTP/1.1
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /?hl=zh-TW&gws_rd=ssl HTTP/1.1
2019/04/12 22:52:02 HTTP/2.0 200 OK
What did you see instead?
2019/04/12 22:52:02 GET / HTTP/1.1
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /intl/zh-TW/
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /?hl=zh-TW
2019/04/12 22:52:02 HTTP/1.1 302 Found
2019/04/12 22:52:02 GET /?hl=zh-TW&gws_rd=ssl
2019/04/12 22:52:02 HTTP/2.0 200 OK
The text was updated successfully, but these errors were encountered: