mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 00:05:30 +00:00
The Gemini native, Claude-compat, Chat Completions-compat and stream collector paths read upstream SSE with bufio.Reader.ReadString, so a custom base_url upstream that never sends a newline could grow one line without limit. - Read these streams through boundedSSELineReader, which keeps line endings and EOF semantics and enforces the configured line and event limits. An overflow is a stream read error; no truncated prefix is forwarded. - Thread cfg into collectGeminiSSE/collectGeminiSSEObserved. - Antigravity ForwardUpstream reads non-stream responses with ReadUpstreamResponseBody instead of an unlimited io.ReadAll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>