diff options
author | Damien Neil <dneil@google.com> | 2021-11-08 11:23:27 -0800 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2021-12-01 22:10:26 +0000 |
commit | 5a93142cec6c4da528e12939398a615869361d5a (patch) | |
tree | 4cd27eaae11a807692da2cfe625b5a52b6c32765 /src/net/http/server.go | |
parent | f2b0149e5701939ebbe05449e58ab162d98d7a22 (diff) | |
download | go-5a93142cec6c4da528e12939398a615869361d5a.tar.gz go-5a93142cec6c4da528e12939398a615869361d5a.zip |
[release-branch.go1.16] net/http: do not cancel request context on response body read
When sending a Request with a non-context deadline, we create a
context with a timeout. This context is canceled when closing the
response body, and also if a read from the response body returns
an error (including io.EOF).
Cancelling the context in Response.Body.Read interferes with the
HTTP/2 client cleaning up after a request is completed, and is
unnecessary: The user should always close the body, the impact
from not canceling the context is minor (the context timer leaks
until it fires).
For #49366.
Fixes #49558.
Change-Id: Ieaed866116916261d9079f71d8fea7a7b303b8fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/361919
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 76fbd6167364fb98e3ebe946cfc16b5b84d4240e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/368084
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/net/http/server.go')
0 files changed, 0 insertions, 0 deletions