http3: simplify composition of the HTTP stream and request stream (#4433)

This commit is contained in:
Marten Seemann
2024-04-13 17:18:51 -07:00
committed by GitHub
parent 90627f6f7c
commit 25cd4b5d24
4 changed files with 24 additions and 32 deletions

View File

@@ -222,14 +222,12 @@ func (c *SingleDestinationRoundTripper) OpenRequestStream(ctx context.Context) (
return nil, err
}
return newRequestStream(
newStream(str, func(e ErrCode) { c.Connection.CloseWithError(quic.ApplicationErrorCode(e), "") }),
c.hconn,
newStream(str, c.hconn),
c.requestWriter,
nil,
c.decoder,
c.DisableCompression,
c.maxHeaderBytes(),
func(e ErrCode) { c.Connection.CloseWithError(quic.ApplicationErrorCode(e), "") },
), nil
}
@@ -274,14 +272,12 @@ func (c *SingleDestinationRoundTripper) sendRequestBody(str Stream, body io.Read
func (c *SingleDestinationRoundTripper) doRequest(req *http.Request, str quic.Stream, reqDone chan<- struct{}) (*http.Response, error) {
hstr := newRequestStream(
newStream(str, func(e ErrCode) { c.Connection.CloseWithError(quic.ApplicationErrorCode(e), "") }),
c.hconn,
newStream(str, c.hconn),
c.requestWriter,
reqDone,
c.decoder,
c.DisableCompression,
c.maxHeaderBytes(),
func(e ErrCode) { c.Connection.CloseWithError(quic.ApplicationErrorCode(e), "") },
)
if err := hstr.SendRequestHeader(req); err != nil {
return nil, err