Skip to content

http3: implement new API to allow fine-grained control of connections#5512

Merged
marten-seemann merged 1 commit intomasterfrom
http3-raw-conn
Jan 3, 2026
Merged

http3: implement new API to allow fine-grained control of connections#5512
marten-seemann merged 1 commit intomasterfrom
http3-raw-conn

Conversation

@marten-seemann
Copy link
Copy Markdown
Member

@marten-seemann marten-seemann commented Dec 29, 2025

This API will be used by WebTransport.

Fixes #4405.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 29, 2025

Codecov Report

❌ Patch coverage is 79.55665% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.12%. Comparing base (4a8af22) to head (06fbff7).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
http3/server_conn.go 70.29% 31 Missing and 10 partials ⚠️
http3/headers.go 0.00% 18 Missing ⚠️
http3/server.go 73.68% 8 Missing and 2 partials ⚠️
http3/client.go 91.75% 7 Missing and 1 partial ⚠️
http3/conn.go 94.25% 5 Missing ⚠️
http3/transport.go 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5512      +/-   ##
==========================================
+ Coverage   84.08%   84.12%   +0.04%     
==========================================
  Files         158      159       +1     
  Lines       16291    16338      +47     
==========================================
+ Hits        13697    13743      +46     
- Misses       1962     1966       +4     
+ Partials      632      629       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented Dec 29, 2025

Introduce raw HTTP/3 client and server APIs with GOAWAY handling and stream accept loops in http3 to support WebTransport

Add rawConn, RawClientConn, and RawServerConn for explicit stream management, move control-stream SETTINGS handling and GOAWAY enforcement into client/server paths, and wire unidirectional stream accept loops in Transport; update request/response handling to use qpack.Decoder, trailer decoding, and qlog recording.

📍Where to Start

Start with client setup in http3.newClientConn and raw connection logic in http3/conn.go, then follow control-stream handling via rawConn.openControlStream and ClientConn.handleControlStream in http3/client.go.


Macroscope summarized 06fbff7.

Comment thread http3/client.go
Comment thread http3/server_conn.go
Comment thread http3/server_conn.go Outdated
Comment thread http3/server.go
Comment thread http3/conn.go
Comment thread http3/server.go
Comment thread http3/conn.go
@marten-seemann marten-seemann force-pushed the http3-raw-conn branch 3 times, most recently from 758ca8b to 6da53e9 Compare January 1, 2026 15:59
Comment thread http3/server.go
Comment thread http3/client.go Outdated
@marten-seemann marten-seemann force-pushed the http3-raw-conn branch 3 times, most recently from bbe54e5 to 9d189b3 Compare January 2, 2026 04:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a new low-level API for WebTransport support in HTTP/3. The main changes include refactoring the internal Conn type to rawConn, and introducing new public types RawServerConn and RawClientConn that allow applications to manually manage stream accept loops.

Key changes:

  • Introduced RawServerConn and RawClientConn for manual stream handling
  • Refactored Conn to internal rawConn with callback-based architecture
  • Moved GOAWAY handling from rawConn to ClientConn
  • Extracted request handling logic into server_conn.go

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
integrationtests/self/http_raw_conn_test.go New integration test demonstrating RawServerConn and RawClientConn usage with manual stream accept loops
http3/transport_test.go Fixed test to use actual connection instead of nil
http3/transport.go Added NewRawClientConn method and goroutine for handling unidirectional streams in NewClientConn
http3/stream_test.go Updated tests to use newRawConn and improved error message clarity
http3/stream.go Changed Stream.conn from *Conn to *rawConn; improved error message
http3/server_conn.go New file containing RawServerConn implementation for handling HTTP/3 requests
http3/server.go Refactored to use RawServerConn; extracted request handling into server_conn.go
http3/response_writer.go Changed responseWriter.conn from *Conn to *rawConn
http3/mock_clientconn_test.go Added handleUnidirectionalStream mock method
http3/headers.go Extracted decodeTrailers function for reuse
http3/conn_test.go Updated tests for new rawConn API with explicit stream handling; fixed push stream error code tests
http3/conn.go Refactored Conn to rawConn with callback-based architecture
http3/client_test.go Added tests for GOAWAY handling and new Raw API; moved tests from conn_test.go
http3/client.go Refactored ClientConn to use rawConn internally; added RawClientConn and GOAWAY handling logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread http3/server_conn.go
Comment thread http3/conn.go
@marten-seemann marten-seemann marked this pull request as ready for review January 2, 2026 08:39
@marten-seemann marten-seemann changed the title http3: implement new API for WebTransport http3: implement new API to allow fine-grained control of connections Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http3: alternative API for stream hijacking

2 participants