mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-17 07:08:01 +08:00
DecodeResponseBody used zstd.NewReader with its default options, which hands blocks to up to four asynchronous decoders: allocations and handoff latency on every streamed response for no gain on bodies read as they arrive. Decode with WithDecoderConcurrency(1) instead. A response without Content-Encoding was sniffed for gzip/zstd magic with Peek(4) before DecodeResponseBody returned, blocking the caller until the upstream sent its first bytes. Detect on the first Read instead, waiting for more than one byte only when the first byte can start a gzip or zstd frame.
6.7 KiB
6.7 KiB