-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: potential DOS: request context not cancelled if a client sends one byte after ServeHTTP starts #37145
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
Comments
The context is cancelled when connection is closed which is detected by observing read errors: Lines 729 to 742 in 1b24c9e
The server expects remaining body and thus does not start (defers until EOF) background read to monitor connection close: Lines 1951 to 1955 in 1b24c9e
Since handler never reads request body it gets stuck waiting forever. |
Duplicate of #23262 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
ran the following code:
package main
and then ran the following command:
What did you expect to see?
The request context should have been cancelled as per documentation:
and thus i expected to see the following output:
What did you see instead?
The context did not cancel and the goroutine that serves the
http.Handler
never returns.http.Server
s thatselect
directly onand not
(or something like that) could be vulnerable to denial of service attacks.
The text was updated successfully, but these errors were encountered: