A client that stops sending with little of its body left after the app has answered is timed out (closes #136)
check / check (push) Canceled after 0s

When less than 256 KiB of a client's body is left, Go's server reads the
rest before it sends the app's answer, and the transport reads it as it
closes the body after a failed write to the app. Neither read goes
through requestBody.Read, so when SWWAF_CLIENT_REQUEST_TIMEOUT ran out
smallwebwaf took the 504 branch, which set no read deadline, and the
request held its connection for as long as the client kept it open.
That branch now ends reading the client's body at the client's
deadline too.

Model: opus-5-5
This commit is contained in:
2026-10-20 10:03:08 +00:00
parent 6327f7f9c5
commit 786290e177
2 changed files with 60 additions and 0 deletions
+6
View File
@@ -715,6 +715,12 @@ func (rq *request) requestTimedOut(limit string) {
action: requestlog.ActionTimedOut,
limit: limit,
})
// Go's server, before it sends the app's answer, and the
// transport, as it closes the body, read what is left of a body
// under 256 KiB without requestBody.Read, so waiting is false
// while they wait for the client. Those reads end when the client
// is out of time.
rq.stopReadingBody(rq.clientRequestDeadline())
return
}