SIGN IN SIGN UP

CRS-自建Claude Code镜像,一站式开源中转服务,让 Claude、OpenAI、Gemini、Droid 订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。

0 0 1 JavaScript

fix: prevent SSE stream corruption by requesting identity encoding

Add 'accept-encoding: identity' to upstream request headers to prevent
Cloudflare/Anthropic CDN from returning gzip-compressed SSE responses.

When the upstream returns gzip data without a Content-Encoding header
(observed with some CDN edge configurations), the stream handler's
chunk.toString() call decodes raw gzip bytes as UTF-8, replacing any
byte >= 0x80 that isn't valid UTF-8 with U+FFFD (ef bf bd). This
silently corrupts the entire SSE stream.

Explicitly requesting identity encoding is the simplest and most
reliable fix — it prevents compression at the source rather than
trying to detect and decompress it after the fact.

Closes #1030
A
atian8179 committed
4d5ea4e0bc458c6ffa83821de5cd3d584d780404
Parent: 0871101