Repository navigation
Conversation
HTTP/1.1: reject RFC 9112 obs-fold and handle asterisk-form/CONNECT targets. WebSocket: validate close codes, reason UTF-8 and empty close payloads; ignore frames after Close.
Track streams closed by nghttp2, inspect frame headers before recv, and answer STREAM_CLOSED/FLOW_CONTROL_ERROR at the raw layer. Close on invalid PING and peer GOAWAY; preserve the existing h2 session path for normal traffic.
OpenSSL 3.5's QUIC TLS registers quic_transport_parameters as a custom extension, so a ClientHello without it is accepted and the handshake is reported complete. On the server, ngtcp2's negotiated_version is only set from conn_recv_transport_params; it therefore stays 0 while 1-RTT tx keys are already installed, and the next write hits assert(conn->negotiated_version) in conn_write_pkt and aborts the process. That is the "server crashed during the suite" h3spec result. RFC 9001 8.2 requires aborting such a handshake with the TLS alert missing_extension. Add a ClientHello callback on the server SSL_CTX that checks the extension, marks QUIC sessions through SSL ex_data so TLS over TCP on the same context is untouched, and returns SSL_CLIENT_HELLO_ERROR with SSL_AD_MISSING_EXTENSION. Also carry the TLS alert into CONNECTION_CLOSE: handle_conn_error now builds CRYPTO_ERROR | alert from ngtcp2_conn_get_tls_alert2 instead of collapsing a TLS failure into PROTOCOL_VIOLATION. Regression evidence (h3spec 0.1.15, min H3 server, self-signed cert, -n): - pre-fix: the single missing_extension test leaves the server dead with ngtcp2_conn.c:3618 conn_write_pkt assertion; full suite 37/81 with the crash cascading into 44 failures. - post-fix: single test passes and the server stays up; full suite 78 passed / 7 failed / 1 pending, 86 examples, exit at 20.6s with no crash (7 remaining failures are separate H3 error-code gaps). - ctest -R 'quic|h3': 12/12 passed (Release, QUIC+HTTP3 build).
nghttp3's nghttp3_conn_read_uni() identifies a peer unidirectional stream from the first varint and returns before looking at fin when the type code is the last byte of that read. The H3 connection marked the FIN as delivered and never re-presented it, so a QPACK decoder/encoder or control stream closed together with its type byte produced no H3_CLOSED_CRITICAL_STREAM and the connection stayed up. Deliver an explicit zero-length FIN for a fully consumed peer uni stream after the data read. Add an end-to-end regression: a raw QUIC client opens a unidirectional stream, writes 0x03 with FIN, and the server must close the connection with error 0x0104. h3spec: decoder-stream-closed case now passes; suite 86 examples, 5 failures (was 6), 1 pending.
nghttp3 1.18 (and 1.19.0) accepts five control-stream violations that h3spec 0.1.15 reports: a duplicate SETTINGS identifier, a CANCEL_PUSH for a push ID that MAX_PUSH_ID never allowed, a decreasing MAX_PUSH_ID, trailing octets after the MAX_PUSH_ID varint, and an unbounded control frame length. Patch the nghttp3 copy in the build tree; NGHTTP3_VERSION still points at the upstream tag and nghttp3's public header/ABI is untouched. Each replacement carries a configure-time assertion so an upstream change to those lines fails loudly instead of silently skipping the patch. Add five end-to-end QUIC regressions to web_app_h3_http_func: they fail 8 checks against the unpatched library and pass with it. h3spec 0.1.15: 86 examples, 0 failures, 1 pending.
Do not close the transport before nghttp2 records a peer GOAWAY; run the same raw preface sniff on the h2c feed path.
The raw frame observer treated response HEADERS on a client connection as peer-opened streams. Out-of-order delayed responses then queued GOAWAY(PROTOCOL_ERROR) and dropped the remaining responses (per_stream B). After a valid peer GOAWAY with no active streams nghttp2 stops reading and suppresses the PING ACK. A server must close the transport then, otherwise h2spec 3.8.1 and 7.1 wait until timeout; clients must keep the connection and their in-flight responses.
…AWAY - h2c probe: classify the first line before falling back to HTTP/1. A line without an HTTP/<d>.<d> version marker is not a valid request line, so it goes back to nghttp2, which closes with GOAWAY(PROTOCOL_ERROR) instead of an HTTP/1 400 response (h2spec 3.5.2). - session: NGHTTP2_ERR_BAD_CLIENT_MAGIC selects PROTOCOL_ERROR for the closing GOAWAY; nghttp2 only returns -903 and queues no frame itself. - connection: after a fatal recv nghttp2 must not be called again, so the GOAWAY is built in the raw layer. After a peer GOAWAY the connection stays readable and a late PING is answered with a raw ACK, avoiding the TCP RST that an immediate close produced (h2spec generic 3.8.1, http2 7.1). - tests: web_h2_cleartext_func gains an invalid-preface round and a GOAWAY-then-PING round. - docs: refresh line references after the source insertions.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tighten protocol handling found by the HttpArena compliance run.
HTTP/1.1
400and close).*request-target:OPTIONS *->204, other methods ->400.405instead of routing its authority as a path.HTTP/2
nghttp2_session_mem_recv2and answer frames on closed streams at the wire layer withRST_STREAM(STREAM_CLOSED).RST_STREAM(FLOW_CONTROL_ERROR)before the session's GOAWAY when WINDOW_UPDATE overflows.HTTP/3
quic_transport_parametersand answer a TLS alert without ALPN overlap withno_application_protocol.H3_CLOSED_CRITICAL_STREAM.H3_SETTINGS_ERROR),CANCEL_PUSHfor an unallowed push id (H3_ID_ERROR), a decreasingMAX_PUSH_ID(H3_ID_ERROR), trailing octets afterMAX_PUSH_ID(H3_FRAME_ERROR), and a control frame larger than 1 MiB (H3_EXCESSIVE_LOAD). These five checks live in the nghttp3 copy under the build tree;NGHTTP3_VERSIONstill points at the upstream tag and nghttp3's public header/ABI is unchanged.WebSocket
Evidence
Built the exact 1.13.2-dev tree with the HttpArena entry recipe and ran the suites against the built image:
GET *400,OPTIONS *204, CONNECT 405.web_app_h3_http_func: five real-QUIC regressions for the close codes above, plus the critical-stream FIN case.cteston the HTTP/3-enabled Release tree: 165 passed, 2 skipped (Redis unavailable), 1 environment-blocked (test_web_http_server_funcneeds 127.0.0.1:20001, occupied by an unrelated local service; the test passes in an isolated network namespace).Commit author:
zhuweiye <61441059+Antruly@users.noreply.github.com>