The mutex, the two timers and the end of the request move from request into a type of their own. request holds one field of it, limits. Behaviour is unchanged.
New names:
internal/rproxy/timelimits.go: the file of the type.
timeLimits: one request's SWW_RPROXY_MAX_REQUEST_TIME_MS and SWW_RPROXY_MAX_RESPONSE_TIME_MS.
waitingForVisitor: field; reports whether a read of the visitor's body is waiting for the visitor.
endVisitorRead: field; ends that read at once.
stopped: field; once set, neither limit acts.
requestDeadline: when the visitor must have sent its whole request.
startRequestTimer: starts the request limit.
requestTimedOut: the request limit ran out; refuses 408 or 504.
wroteRequest: the app has the whole request; the response limit starts.
startResponseTimer: starts the response limit from the end of the request.
responseTimedOut: the response limit ran out; refuses 504.
endRequest: notes the end of the request once, and returns it.
stop: stops both limits for good.
internal/rproxy/timelimits_internal_test.go: tests of the type alone, in a testing/synctest bubble.
What the diff does not show:
responseReceived on request is gone: it only stopped the timers, so responseBody now gets rq.limits.stop.
endVisitorRead is still called with the lock held, so it cannot reach the connection after the request is handled.
modifyResponse, prepareOwnAnswer and setResponseDeadline still read SWW_RPROXY_MAX_RESPONSE_TIME_MS from the config; they work on the connection and stay on request.
Model: opus-5-5
Closes https://git.eeqj.de/sneak/smallwebwaf/issues/432.
The mutex, the two timers and the end of the request move from `request` into a type of their own. `request` holds one field of it, `limits`. Behaviour is unchanged.
New names:
- `internal/rproxy/timelimits.go`: the file of the type.
- `timeLimits`: one request's `SWW_RPROXY_MAX_REQUEST_TIME_MS` and `SWW_RPROXY_MAX_RESPONSE_TIME_MS`.
- `waitingForVisitor`: field; reports whether a read of the visitor's body is waiting for the visitor.
- `endVisitorRead`: field; ends that read at once.
- `stopped`: field; once set, neither limit acts.
- `requestDeadline`: when the visitor must have sent its whole request.
- `startRequestTimer`: starts the request limit.
- `requestTimedOut`: the request limit ran out; refuses 408 or 504.
- `wroteRequest`: the app has the whole request; the response limit starts.
- `startResponseTimer`: starts the response limit from the end of the request.
- `responseTimedOut`: the response limit ran out; refuses 504.
- `endRequest`: notes the end of the request once, and returns it.
- `stop`: stops both limits for good.
- `internal/rproxy/timelimits_internal_test.go`: tests of the type alone, in a `testing/synctest` bubble.
What the diff does not show:
- `responseReceived` on `request` is gone: it only stopped the timers, so `responseBody` now gets `rq.limits.stop`.
- `endVisitorRead` is still called with the lock held, so it cannot reach the connection after the request is handled.
- `modifyResponse`, `prepareOwnAnswer` and `setResponseDeadline` still read `SWW_RPROXY_MAX_RESPONSE_TIME_MS` from the config; they work on the connection and stay on `request`.
Model: opus-5-5
timeLimits in internal/rproxy/timelimits.go owns the mutex, the two
timers and the end of the request; request holds one field of it. It
is given refuse, whether the visitor's body is being waited on, and a
function that ends that read. Tests of the type alone run in a
synctest bubble.
Model: opus-5-5
clawbot
self-assigned this 2026-11-20 00:02:33 +01:00
The two time limits move unchanged into timeLimits in internal/rproxy/timelimits.go, with synctest tests of the type alone, which meets every point of the definition of done in #432.
Model: opus-5-5
Verdict: PASS
Head: bb3c8f9351607bf1bd2af8d62588eeb0f520feff
The two time limits move unchanged into `timeLimits` in `internal/rproxy/timelimits.go`, with `synctest` tests of the type alone, which meets every point of the definition of done in https://git.eeqj.de/sneak/smallwebwaf/issues/432.
Model: opus-5-5
clawbot
merged commit abf6c8d517 into next2026-11-20 00:28:55 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #432.
The mutex, the two timers and the end of the request move from
requestinto a type of their own.requestholds one field of it,limits. Behaviour is unchanged.New names:
internal/rproxy/timelimits.go: the file of the type.timeLimits: one request'sSWW_RPROXY_MAX_REQUEST_TIME_MSandSWW_RPROXY_MAX_RESPONSE_TIME_MS.waitingForVisitor: field; reports whether a read of the visitor's body is waiting for the visitor.endVisitorRead: field; ends that read at once.stopped: field; once set, neither limit acts.requestDeadline: when the visitor must have sent its whole request.startRequestTimer: starts the request limit.requestTimedOut: the request limit ran out; refuses 408 or 504.wroteRequest: the app has the whole request; the response limit starts.startResponseTimer: starts the response limit from the end of the request.responseTimedOut: the response limit ran out; refuses 504.endRequest: notes the end of the request once, and returns it.stop: stops both limits for good.internal/rproxy/timelimits_internal_test.go: tests of the type alone, in atesting/synctestbubble.What the diff does not show:
responseReceivedonrequestis gone: it only stopped the timers, soresponseBodynow getsrq.limits.stop.endVisitorReadis still called with the lock held, so it cannot reach the connection after the request is handled.modifyResponse,prepareOwnAnswerandsetResponseDeadlinestill readSWW_RPROXY_MAX_RESPONSE_TIME_MSfrom the config; they work on the connection and stay onrequest.Model: opus-5-5
Verdict: PASS
Head:
bb3c8f9351The two time limits move unchanged into
timeLimitsininternal/rproxy/timelimits.go, withsynctesttests of the type alone, which meets every point of the definition of done in #432.Model: opus-5-5