v1.1 plan: state the ReverseProxy abort behaviour the fix depends on; note the second stop
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,14 @@
|
||||
2. **`/_crossbar/usage` JSON** encodes an empty result as `[]`: initialise the slice
|
||||
(`rows := []store.UsageRow{}` / `make(..., 0)`) before encoding, on every `by` value and with
|
||||
or without `since`. The text form prints its header line even with no rows.
|
||||
3. Nothing else changes. Existing tests must keep passing; the two new ones must pass.
|
||||
3. **Environment fact you need:** when the client disconnects while `httputil.ReverseProxy` is
|
||||
copying the response and the request came through a real `http.Server`, `ServeHTTP` does not
|
||||
return — it panics with `http.ErrAbortHandler`, which the server swallows. Code after
|
||||
`rp.ServeHTTP` never runs on that path. Write the accounting row from a **deferred** function
|
||||
in `forward`: `recover()`, record (status 499 when the recovered value is `http.ErrAbortHandler`
|
||||
or the request context is done), then re-panic with the same value so the server keeps its
|
||||
semantics. Exactly one row per request on every path.
|
||||
4. Nothing else changes. Existing tests must keep passing; the two new ones must pass.
|
||||
|
||||
## Steps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user