http3: add client trace support (#4749)

Since the QUIC connection establishment process includes TLS handshake logic,
Connect and TLS handshake are called in the following order:

ConnectStart -> TLSHandshakeStart -> TLSHandshakeDone -> ConnectDone.

Notice: Wait100Continue not implemented as quic-go doesn't support handling
Expect: 100-continue.
This commit is contained in:
Roccoon
2025-01-14 12:50:16 +08:00
committed by Marten Seemann
parent 516220b0c5
commit 96ce54e83f
9 changed files with 370 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ import (
"log/slog"
"net"
"net/http"
"net/http/httptrace"
"sync"
"sync/atomic"
"time"
@@ -123,7 +124,8 @@ func (c *connection) openRequestStream(
rsp.Trailer = hdr
return nil
})
return newRequestStream(hstr, requestWriter, reqDone, c.decoder, disableCompression, maxHeaderBytes, rsp), nil
trace := httptrace.ContextClientTrace(ctx)
return newRequestStream(hstr, requestWriter, reqDone, c.decoder, disableCompression, maxHeaderBytes, rsp, trace), nil
}
func (c *connection) decodeTrailers(r io.Reader, l, maxHeaderBytes uint64) (http.Header, error) {