[net] internal/http3: add Transport and ClientConn

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jan 22, 2025, 1:00:29 PMJan 22
to Damien Neil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Brad Fitzpatrick, Jonathan Amsterdam, Brad Fitzpatrick, golang-co...@googlegroups.com

Gopher Robot submitted the change with unreviewed changes

Unreviewed changes

4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: internal/http3/transport.go
Insertions: 13, Deletions: 1.

@@ -31,6 +31,8 @@
Endpoint *quic.Endpoint

// Config is the QUIC configuration used for client connections.
+ // The Config may be nil.
+ //
// Dial may clone and modify the Config.
// The Config must not be modified after calling Dial.
Config *quic.Config
@@ -86,6 +88,8 @@
}

// A ClientConn is a client HTTP/3 connection.
+//
+// Multiple goroutines may invoke methods on a ClientConn simultaneously.
type ClientConn struct {
qconn *quic.Conn

@@ -115,8 +119,16 @@
}

// Close closes the connection.
+// Any in-flight requests are canceled.
+// Close does not wait for the peer to acknowledge the connection closing.
func (cc *ClientConn) Close() error {
- return cc.qconn.Close()
+ // Close the QUIC connection immediately with a status of NO_ERROR.
+ cc.qconn.Abort(nil)
+
+ // Return any existing error from the peer, but don't wait for it.
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+ return cc.qconn.Wait(ctx)
}

// RoundTrip sends a request on the connection.
```

Change information

Commit message:
internal/http3: add Transport and ClientConn

Add the first rudiments of an HTTP/3 client.

The client currently opens a QUIC connection and creates a control
stream on it, and nothing else.

Add surrounding test infrastructure for examining the client's
behavior. Tests use the experimental testing/synctest package
and will only run when the Go version is at least Go 1.24 and
GOEXPERIMENT=synctest is set.

For golang/go#70914
Change-Id: I19803187a8e62c461f60d7a1d44c2a408377e342
Reviewed-by: Jonathan Amsterdam <j...@google.com>
Auto-Submit: Damien Neil <dn...@google.com>
Reviewed-by: Brad Fitzpatrick <brad...@golang.org>
Files:
  • A internal/http3/http3_test.go
  • A internal/http3/settings.go
  • M internal/http3/stream.go
  • M internal/http3/stream_test.go
  • A internal/http3/transport.go
  • A internal/http3/transport_test.go
Change size: L
Delta: 6 files changed, 896 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Brad Fitzpatrick, +2 by Jonathan Amsterdam
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I19803187a8e62c461f60d7a1d44c2a408377e342
Gerrit-Change-Number: 642516
Gerrit-PatchSet: 6
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages