🛡 ️ 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
| Name |
Last commit
|
Last Update |
|---|---|---|
| .github | Loading commit data... | |
| bin | Loading commit data... | |
| common | Loading commit data... | |
| constant | Loading commit data... | |
| controller | Loading commit data... | |
| docs | Loading commit data... | |
| dto | Loading commit data... | |
| electron | Loading commit data... | |
| logger | Loading commit data... | |
| middleware | Loading commit data... | |
| model | Loading commit data... | |
| relay | Loading commit data... | |
| router | Loading commit data... | |
| service | Loading commit data... | |
| setting | Loading commit data... | |
| types | Loading commit data... | |
| web | Loading commit data... | |
| .dockerignore | Loading commit data... | |
| .env.example | Loading commit data... | |
| .gitignore | Loading commit data... | |
| Dockerfile | Loading commit data... | |
| LICENSE | Loading commit data... | |
| README.en.md | Loading commit data... | |
| README.fr.md | Loading commit data... | |
| README.ja.md | Loading commit data... | |
| README.md | Loading commit data... | |
| VERSION | Loading commit data... | |
| docker-compose.yml | Loading commit data... | |
| go.mod | Loading commit data... | |
| go.sum | Loading commit data... | |
| main.go | Loading commit data... | |
| makefile | Loading commit data... | |
| new-api.service | Loading commit data... |