-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http/httputil: ReverseProxy change conflicts with future ReverseProxy plans #23009
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
Comments
I'm also not even convinced the main part of the change is correct. The docs for the ModifyResponse field say:
The whole point of CL 54030 is to now call ModifyResponse on a fake Response that is not from the backend. Why is that correct? /cc @bradfitz @tombergan |
Replied on the CL, but you're correct in that err != nil should be used to construct the fake Response. As to why the fake res not from the backend is constructed, ModifyResponse needs some way of mutating the res when it is nil. I assumed that the correct default response to construct was one that returned a StatusBadGateway error. The change was intended to adapt ModifyResponse's current API to support the case when err != nil. A more robust change for this would be to add an api like http://golang.org/issue/22700 which allows the ErrorHandler to take advantage of the error value. |
It seems to me that CL 54030 and CL 77410 have different, conflicting ideas of how to process a RoundTrip error. If we think that CL 77410 may be the right choice in Go 1.11, then it doesn't make sense to include CL 54030 in Go 1.10. Given the uncertainty around the API decision here I suggest we revert CL 54030 for Go 1.10 and decide the API question in the next round without having painted ourselves into a corner. |
I am fine with that, especially considering that the ErrorHandler in CL 77410 is only called when err != nil. That means that ModifyResponse is only invoked on a successful response. |
Change https://golang.org/cl/86435 mentions this issue: |
Change https://golang.org/cl/86476 mentions this issue: |
No longer needs to be done. Updates #23009 Updates #21255 Change-Id: I78e9e29a923dc03dea89ff3a5bf60f2e0bd0c0aa Reviewed-on: https://go-review.googlesource.com/86476 Reviewed-by: Ian Lance Taylor <iant@golang.org>
…on failed requests" This reverts commit https://golang.org/cl/54030 Reason for revert: to not paint ourselves into a corner. See golang/go#23009 Fixes #23009 Updates #21255 Change-Id: I68caab078839b9d2bf645a7bbed8405a5a30cd22 Reviewed-on: https://go-review.googlesource.com/86435 Reviewed-by: Ian Lance Taylor <iant@golang.org>
CL 54030 makes the suspicious change that after
the error condition is now detected by res == nil instead of err != nil. That seems wrong. Commented more on the CL itself but we should resolve this one way or the other for Go 1.10.
The text was updated successfully, but these errors were encountered: