Compare commits

..
1 Commits
Author SHA1 Message Date
sneak fb13d37fa0 rproxy: leave no visitor without an answer as the response time runs out (closes #295)
check / check (push) Failing after 5m35s
A visitor could get a closed connection and no answer when
SWRP_MAX_RESPONSE_TIME_MS ran out about when the answer started: the
write deadline passed before the first byte was written.

- An answer rproxy gives itself has at least 10 seconds to be sent.
- An app's answer that arrives once the time has run out is answered
  504.
- Otherwise the app's status and headers are sent at once, before the
  body is read, with at least 10 seconds. The exact limit applies to
  the rest.

Model: opus-5-5
2026-11-10 18:21:01 +00:00
+6 -3
View File
@@ -571,9 +571,12 @@ func (rq *request) responseReceived() {
rq.stopTimers()
}
// setResponseDeadline sends the status and headers of the app's answer, with
// at least minSendTime, before ReverseProxy reads the answer's body, and then
// the rest has until SWRP_MAX_RESPONSE_TIME_MS after the end of the request.
// setResponseDeadline sets SWRP_MAX_RESPONSE_TIME_MS on the connection to the
// visitor once ReverseProxy has written the status of the app's answer: the
// answer must reach the visitor within it of the end of the request. First it
// sends the status and headers, with minSendTime at least, before ReverseProxy
// reads the body: the time running out can still cut the answer off, but the
// visitor never gets a closed connection with no answer at all.
func (rq *request) setResponseDeadline() {
limit := rq.h.config.MaxResponseTime
if limit == 0 {