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

@@ -19,14 +19,14 @@ var errTooMuchData = errors.New("peer sent too much data")
// The body is used in the requestBody (for a http.Request) and the responseBody (for a http.Response).
type body struct {
str *stream
str *Stream
remainingContentLength int64
violatedContentLength bool
hasContentLength bool
}
func newBody(str *stream, contentLength int64) *body {
func newBody(str *Stream, contentLength int64) *body {
b := &body{str: str}
if contentLength >= 0 {
b.hasContentLength = true
@@ -81,7 +81,7 @@ type requestBody struct {
var _ io.ReadCloser = &requestBody{}
func newRequestBody(str *stream, contentLength int64, connCtx context.Context, rcvdSettings <-chan struct{}, getSettings func() *Settings) *requestBody {
func newRequestBody(str *Stream, contentLength int64, connCtx context.Context, rcvdSettings <-chan struct{}, getSettings func() *Settings) *requestBody {
return &requestBody{
body: *newBody(str, contentLength),
connCtx: connCtx,
@@ -102,7 +102,7 @@ type hijackableBody struct {
var _ io.ReadCloser = &hijackableBody{}
func newResponseBody(str *stream, contentLength int64, done chan<- struct{}) *hijackableBody {
func newResponseBody(str *Stream, contentLength int64, done chan<- struct{}) *hijackableBody {
return &hijackableBody{
body: *newBody(str, contentLength),
reqDone: done,