Skip to content
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: Do(): url.Error value's Timeout is false if request canceled #33545

Closed
ansd opened this issue Aug 8, 2019 · 3 comments
Closed

net/http: Do(): url.Error value's Timeout is false if request canceled #33545

ansd opened this issue Aug 8, 2019 · 3 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ansd
Copy link

ansd commented Aug 8, 2019

What did you do?

Run the following: https://play.golang.org/p/jjlki46yvxi

What did you expect to see?

According to the docs of func (*Client) Do, I expect that "The url.Error value's Timeout method will report true if request timed out or was canceled."

What did you see instead?

The url.Error value's Timeout method reports false if request was canceled.

Additional notes

In contrast, if you run https://play.golang.org/p/xdNeyWl3Zc7, as the docs correctly state, the url.Error value's Timeout method reports true if request timed out.

The doc change got introduced in 6df4c3a.

The same documentation

Any returned error will be of type *url.Error. The url.Error value's Timeout method will report true if request timed out or was canceled.

also exists for func (*Client) Get and func Get.
Maybe the documentation refers to canceling a request via func (*Transport) CancelRequest?
However, since CancelRequest is deprecated, I would delete the part or was canceled from the docs of func (*Client) Do.

System details

go version go1.12.7 darwin/amd64
GOARCH="amd64"
GOBIN="/Users/david/go/bin"
GOCACHE="/Users/david/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/david/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.12.7 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.7
uname -v: Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G87
lldb --version: lldb-1001.0.13.3
  Swift-5.0
gdb --version: GNU gdb (GDB) 8.3
@andybons
Copy link
Member

@bradfitz

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 12, 2019
@andybons andybons added this to the Unplanned milestone Aug 12, 2019
@odeke-em
Copy link
Member

Thank you for this report @ansd and welcome to the Go project! Thank you @andybons for the triage.

Yes this seems unfortunate as just a documentation typo, I shall send a CL fixing this and a test to enforce our behavior so that we don't regress later on.

@odeke-em odeke-em added Documentation NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 12, 2019
@odeke-em odeke-em self-assigned this Oct 12, 2019
@gopherbot
Copy link

Change https://golang.org/cl/200798 mentions this issue: net/http: fix and lock-in Client.Do docs on request cancelation

@golang golang locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants