🐛 QUIC Hijack() skips the status-written check that HTTP/2 enforces
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- backend, networking
Direzione di ricerca
Compare http2RespWriter.Hijack in connection/http2.go with httpResponseAdapter.Hijack in connection/quic_connection.go, focusing on statusWritten and connectResponseSent. Reproduce the differing behavior with the described HTTP/2 and QUIC protocols, then verify that QUIC enforces the same precondition and no longer permits raw writes before a connect response is sent.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Hijack() has different preconditions on the two transports.
HTTP/2, http2RespWriter.Hijack in connection/http2.go, refuses when no status was written yet:
if !rp.statusWritten {
return nil, nil, fmt.Errorf("status not yet written before attempting to hijack connection")
}
QUIC, httpResponseAdapter.Hijack in connection/quic_connection.go, has no such check. It always returns a localProxyConnection, even when connectResponseSent is still false, so the caller can write raw bytes to the stream before any connect response went out.
Same caller, different outcome depending on the transport: on HTTP/2 it gets an error, on QUIC it gets a conn.
To Reproduce
Stock cloudflared writes the status before it hijacks, so the built-in ingress path does not hit this. I hit it in a fork that replaces the OriginProxy, with code that hijacks first. net/http/httputil.ReverseProxy does exactly that on a 101: handleUpgradeResponse calls Hijack() and then writes the status line onto the conn itself.
ProxyHTTPserves the request throughhttputil.ReverseProxyto a backend that answers 101.- With
--protocol http2,Hijackfails and the client gets a 502. - With
--protocol quic,Hijacksucceeds and the caller can write to the stream before any connect response was sent.
Expected behavior
Both transports enforce the same precondition. The HTTP/2 check looks like the right one, so QUIC could refuse the same way while connectResponseSent is false.
Environment and versions
- OS: Linux
- Architecture: AMD64
- Version: 2026.9.1, and the
Hijackbodies are unchanged on master as of 2026.9.3
Logs and errors
HTTP/2: status not yet written before attempting to hijack connection. QUIC: no error.
Additional context
I worked around it on my side, so it does not block me. Filing it because the two transports disagree on the ResponseWriter contract, and that is easy to miss.
- Lingua principale
- Go
- Stelle
- 15.8k
- Fork
- 1.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
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 cloudflare/cloudflared
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloudflare/cloudflared#1715 ·
-
Priority: Normal Type: Feature Request
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cloudflare/cloudflared#1645 · 3 reazioni ·
-
Priority: Normal Type: Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
cloudflare/cloudflared#1609 · 1 reazione ·
-
Priority: Normal Type: Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
cloudflare/cloudflared#1348 · 6 reazioni ·
-
Priority: Normal Type: Bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cloudflare/cloudflared#1737 ·
Tutte le issue di cloudflare/cloudflared
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[开源推荐] FCaptcha:可自行部署的开源验证码Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
521xueweihan/HelloGitHub#3789 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 12 giorni
-
stage-fail
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
siyuan-note/bazaar#2282 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openshift/kube-compare#307 ·
I maintainer di solito rispondono entro 1 giorno