Files
new-api-hunter/common
t0ng7u c2ed76ddfd 🛡️ fix: prevent OOM on large/decompressed requests; skip heavy prompt meta when token count is disabled
Clamp request body size (including post-decompression) to avoid memory exhaustion caused by huge payloads/zip bombs, especially with large-context Claude requests. Add a configurable `MAX_REQUEST_BODY_MB` (default `32`) and document it.

- Enforce max request body size after gzip/br decompression via `http.MaxBytesReader`
- Add a secondary size guard in `common.GetRequestBody` and cache-safe handling
- Return **413 Request Entity Too Large** on oversized bodies in relay entry
- Avoid building large `TokenCountMeta.CombineText` when both token counting and sensitive check are disabled (use lightweight meta for pricing)
- Update READMEs (CN/EN/FR/JA) with `MAX_REQUEST_BODY_MB`
- Fix a handful of vet/formatting issues encountered during the change
- `go test ./...` passes
2025-12-16 17:00:19 +08:00
..
2025-11-08 01:24:45 +08:00
2025-07-30 20:31:51 +08:00
2025-12-12 16:19:14 +08:00
2025-10-30 14:21:46 +08:00
2024-07-07 02:24:51 +08:00
2025-07-10 20:55:43 +08:00
2025-12-03 00:41:47 +08:00
2025-12-02 21:34:39 +08:00
2025-07-21 15:39:16 +08:00
2023-04-22 20:39:27 +08:00
2025-12-03 00:41:47 +08:00
2024-06-27 19:30:17 +08:00
2025-08-03 10:41:00 +08:00
2023-04-22 20:39:27 +08:00