bug: Copied listener and parser code has drifted (hop-by-hop response headers, SSE BOM/CR handling)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- backend, networking
Direzione di ricerca
Start with the four response-header copy loops in core/listener/forwardproxy/server.go and the SSE parsers in core/plugins/a2aparser/plugin.go and core/plugins/mcpparser/plugin.go; compare them with stripForUpstream and normalizeSSE. Then inspect the listener helpers named in the issue and the shared package locations it proposes. Done means the response filtering, SSE line handling, and helper extraction cover every listed call site.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The listeners and protocol parsers have copied code that has drifted apart. One listener or parser got a fix that its copies did not. Line numbers are at ab5f01f26.
1. Hop-by-hop response headers reach the client
Hop-by-hop headers (like Keep-Alive) describe one connection and must not be forwarded. The forward proxy has four near-identical loops that copy resp.Header to the client verbatim: core/listener/forwardproxy/server.go:827-831, 1918-1922, 2020-2024, 2130-2134. Requests are stripped (stripForUpstream, :1358-1369), but responses are not. The comment at :1917 says "clear hop-by-hop headers as net/http would", and no code does.
- Case: a client negotiates h2 with the TLS bridge, and the HTTP/1.1 origin sends
Keep-Alive: timeout=5. The header goes out in an HTTP/2 HEADERS frame, because Go's h2 server strips onlyConnection. - Reproduced locally: Node 24
http2fails withERR_HTTP2_STREAM_ERRORwhen the header is present and succeeds without it. - The reverse proxy is not affected, because
httputil.ReverseProxystrips these headers.
Fix: one copyResponseHeader(w, resp) that skips the list stripForUpstream uses, plus any header named in Connection. Use it at all four sites.
2. Only one SSE parser handles a BOM or CR-only line endings
SSE (server-sent events) is the streaming format the parsers read. The buffered-response data: scanners are:
core/plugins/inferenceparser:anthropic.go:502,responses.go:566,plugin.go:779. These callnormalizeSSE(plugin.go:627).core/plugins/a2aparser/plugin.go:324, 402andcore/plugins/mcpparser/plugin.go:478. These split on\nonly.
Case: an MCP or A2A response that starts with a UTF-8 BOM (byte-order mark), or uses CR-only line endings, matches no data: line. TrimSpace does not strip U+FEFF, and a CR-only body is one line. The MCP/A2A extension stays empty, and IBAC treats the request as unclassified, which passes by default (ibac/plugin.go:389-399). normalizeSSE's own comment (plugin.go:613-619) describes this exact failure.
The streaming path is fine, because sseframe.Reader handles both cases.
Fix: move normalizeSSE (or a shared ForEachDataLine) into core/plugins/internal/parsercommon and use it at all six sites.
3. Request helpers copied between listeners
isEventStreamis defined three times:forwardproxy/server.go:1830,reverseproxy/server.go:1047,extproc/server.go:1420.reverseproxy/server.go:406-412and:419-440inline copies of forwardproxy'ssetBody(:1401) andsyncHeaders(:1331).
They match today, but this is where the next one-sided fix will land, as problem 1 already shows.
Fix: move them into core/listener/httpx.
Found by a code audit of main at ab5f01f26.
Assisted-By: Claude (Anthropic AI) [email protected]
- Lingua principale
- Go
- Stelle
- 21
- Fork
- 43
- Merge medio
- 13h 32m
- PR unite (30g)
- 256
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rossoctl/cortex
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
UI shows costs for all sessions even when drilled into a sessionForse già presa @esnible l’ha presa 17 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
rossoctl/cortex#1116 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
CodeQL flags r.Host reaching slog in the forward proxy's debug/warn linesForse già presa @evaline-ju l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 Più di una settimana Idoneità per principianti 18/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rossoctl/cortex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hashicorp/golang-lru#245 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
spotify/flink-on-k8s-operator#1075 ·
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
prometheus-community/pyrra#1995 ·
I maintainer di solito rispondono entro 1 giorno
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/TypeScript#65083 ·
I maintainer di solito rispondono entro 1 giorno