http3: convert Stream from an interface to a struct (#5154)

This commit is contained in:
Marten Seemann
2025-05-29 11:41:40 +08:00
committed by GitHub
parent 2675d0845f
commit 0b834e6f46
5 changed files with 33 additions and 42 deletions

View File

@@ -17,7 +17,7 @@ import (
// The HTTPStreamer allows taking over a HTTP/3 stream. The interface is implemented by the http.ResponseWriter.
// When a stream is taken over, it's the caller's responsibility to close the stream.
type HTTPStreamer interface {
HTTPStream() Stream
HTTPStream() *Stream
}
// The maximum length of an encoded HTTP/3 frame header is 16:
@@ -27,7 +27,7 @@ const frameHeaderLen = 16
const maxSmallResponseSize = 4096
type responseWriter struct {
str *stream
str *Stream
conn Connection
header http.Header
@@ -65,7 +65,7 @@ var (
} = &responseWriter{}
)
func newResponseWriter(str *stream, conn Connection, isHead bool, logger *slog.Logger) *responseWriter {
func newResponseWriter(str *Stream, conn Connection, isHead bool, logger *slog.Logger) *responseWriter {
return &responseWriter{
str: str,
conn: conn,
@@ -331,7 +331,7 @@ func (w *responseWriter) writeTrailers() error {
return err
}
func (w *responseWriter) HTTPStream() Stream {
func (w *responseWriter) HTTPStream() *Stream {
w.hijacked = true
w.Flush()
return w.str