]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] internal/poll: netpollcheckerr before sendfile
authorWei Fu <fuweid89@gmail.com>
Sun, 24 Jan 2021 10:21:06 +0000 (18:21 +0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 26 Feb 2021 15:40:37 +0000 (15:40 +0000)
commit30357d6ef6513b18fade686a629ab8d49987260f
tree67b1214a76cf051d6ad2ee68c32b191bedfda267
parent023c46676db26e75d244b1d38ccc4a4b8bfe3eef
[release-branch.go1.15] internal/poll: netpollcheckerr before sendfile

In net/http package, the ServeContent/ServeFile doesn't check the I/O
timeout error from chunkWriter or *net.TCPConn, which means that both
HTTP status and headers might be missing when WriteTimeout happens. If
the poll.SendFile() doesn't check the *poll.FD state before sending
data, the client will only receive the response body with status and
report "malformed http response/status code".

This patch is to enable netpollcheckerr before sendfile, which should
align with normal *poll.FD.Write() and Splice().

For #43822
Fixes #44294

Change-Id: I32517e3f261bab883a58b577b813ef189214b954
Reviewed-on: https://go-review.googlesource.com/c/go/+/285914
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
(cherry picked from commit f0d23c9dbb2142b975fa8fb13a57213d0c15bdd1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/296530
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
src/internal/poll/sendfile_bsd.go
src/internal/poll/sendfile_linux.go
src/internal/poll/sendfile_solaris.go
src/net/sendfile_test.go