mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 02:05:21 +00:00
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
23 lines
572 B
Go
23 lines
572 B
Go
package constant
|
|
|
|
var StreamingTimeout int
|
|
var DifyDebug bool
|
|
var MaxFileDownloadMB int
|
|
var StreamScannerMaxBufferMB int
|
|
var ForceStreamOption bool
|
|
var CountToken bool
|
|
var GetMediaToken bool
|
|
var GetMediaTokenNotStream bool
|
|
var UpdateTask bool
|
|
var MaxRequestBodyMB int
|
|
var AzureDefaultAPIVersion string
|
|
var GeminiVisionMaxImageNum int
|
|
var NotifyLimitCount int
|
|
var NotificationLimitDurationMinute int
|
|
var GenerateDefaultToken bool
|
|
var ErrorLogEnabled bool
|
|
var TaskQueryLimit int
|
|
|
|
// temporary variable for sora patch, will be removed in future
|
|
var TaskPricePatches []string
|