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: ServeContent()/ServeFile() doesn't return expected response when WriteTimeout happens [1.15 backport] #44294

Closed
gopherbot opened this issue Feb 16, 2021 · 3 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 16, 2021

@odeke-em requested issue #43822 to be considered for backport to the next 1.15 minor release.

As per the comment by Ian in #43822 (comment), this issue is a worthy candidate. @gopherbot please backport this issue.

@toothrot
Copy link
Contributor

@toothrot toothrot commented Feb 25, 2021

Approved. This is a serious issue with no workaround.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Feb 25, 2021

Change https://golang.org/cl/296530 mentions this issue: [release-branch.go1.15] internal/poll: netpollcheckerr before sendfile

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Feb 26, 2021

Closed by merging 30357d6 to release-branch.go1.15.

@gopherbot gopherbot closed this Feb 26, 2021
gopherbot pushed a commit that referenced this issue Feb 26, 2021
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 f0d23c9)
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants