-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: canceled requests with Timeout set always return a Timeout error #16094
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
Looking into it, this is not only the error message. The error is actually a net Timeout. |
CL https://golang.org/cl/24230 mentions this issue. |
@FiloSottile, is this a regression from Go 1.6? |
Yep, it's a regression.
I'll address the points on the CL now, sorry for the delay, I've been offline for a bit.
|
I've updated @FiloSottile's CL https://golang.org/cl/24230 with https://go-review.googlesource.com/32478. |
CL https://golang.org/cl/32478 mentions this issue. |
Line 301 in 7448eb4
Check L303 Please is what correct? But a continue problem
|
@KingRider, we don't track comments on closed issues. Please file a new bug if you have a reproducible problem with the Go master branch. |
Where is |
@keitaj, we don't track comments on closed issues. Please file a new bug if you have a reproducible problem with the Go master branch. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go version devel +9e8fa1e Fri Jun 17 15:18:39 2016 +0000 darwin/amd64
Make a http.Client with a Timeout. Cancel the request.
https://play.golang.org/p/v-QbAxdj-3
If the cause was not a Client.Timeout, then the error should be left alone.
The error is
This is because
reqWasCanceled
returns true whatever the reason for the cancelation is, be it a library user cancel or a Timeout. ThencancelTimerBody.Read
uses that function to add the message.The
(Client.Timeout exceeded while awaiting headers)
message is more likely to be correct (even if slightly racy), because it only adds the message if!deadline.IsZero() && !time.Now().Before(deadline)
.The text was updated successfully, but these errors were encountered: