-
Notifications
You must be signed in to change notification settings - Fork 18.1k
net/http: make Transport retry more aggressively on failures if GetBody is set #17844
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
can I work on this? @bradfitz |
Sure, if you're familiar with the http code. Note that we already did this for the http2 Transport (during server graceful shutdown in GOAWAY), so be sure to read that code first. |
@bradfitz Thanks. I will spend some time this weekend. |
Sorry for very late reply. I started going through the code, to understand the problem correctly. I noticed like you mentioned, http2 transport already creating the retry Request via At the same time, in transport.go, the same operation is done via creating new request every time. Instead we have use to Request.GetBody to achieve that. |
CL https://golang.org/cl/42142 mentions this issue. |
To clarify: is this issue specifically about retrying on idempotent-method requests (GET/HEAD/OPTIONS/TRACE) which have non-nil Body but have GetBody set? |
In Go 1.12 we now have the fix for #19943 (comment) ....
|
Make both the http1 and http2 Transports more aggressive on idempotent retries, if the new Go 1.8 Request.GetBody is defined. That means we can back up the Body and replay the whole request.
Go 1.8 uses that for redirects, but not for connection failures.
Do that in Go 1.9.
The text was updated successfully, but these errors were encountered: