commit | 7594919abe59a00745ca2e124ad65d48ea968892 | [log] [tgz] |
---|---|---|
author | Damien Neil <dneil@google.com> | Wed Nov 03 18:14:27 2021 -0700 |
committer | Damien Neil <dneil@google.com> | Thu Nov 04 16:11:57 2021 +0000 |
tree | 24b9293130ad2f28eb3901582d3f9933ce2fd488 | |
parent | 4a448f8816b333a409e4ee05c50963107b2c8796 [diff] |
http2: avoid race between processing END_STREAM and closing Response.Body When the client gets an END_STREAM from the peer, it causes the response body to return io.EOF and closes cs.peerClosed. It is possible for the caller of RoundTrip to read io.EOF from the response body and end the request by calling Response.Body.Close before we close cs.peerClosed. In this case, we send a spurious RST_STREAM to the peer. Closing cs.peerClosed first reverses the race: This can cause the response body to return "request canceled" rather than io.EOF. Close both streams with the connection mutex held. Fixes golang/go#49314 Change-Id: I75557670497c96dd6ed1b566bb4f0f3106a0c9f9 Reviewed-on: https://go-review.googlesource.com/c/net/+/361267 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>
This repository holds supplementary Go networking libraries.
The easiest way to install is to run go get -u golang.org/x/net
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/net
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the net repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/net:” in the subject line, so it is easy to find.