Skip to content

Commit

Permalink
pass the connection to the client's StreamHijacker callback
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Mar 27, 2022
1 parent 626d5b9 commit 7d738e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions http3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type roundTripperOpts struct {
EnableDatagram bool
MaxHeaderBytes int64
AdditionalSettings map[uint64]uint64
StreamHijacker func(FrameType, quic.Stream) (hijacked bool, err error)
StreamHijacker func(FrameType, quic.Connection, quic.Stream) (hijacked bool, err error)
}

// client is a HTTP3 client doing requests
Expand Down Expand Up @@ -152,7 +152,7 @@ func (c *client) handleBidirectionalStreams() {
go func(str quic.Stream) {
for {
_, err := parseNextFrame(str, func(ft FrameType) (processed bool, err error) {
return c.opts.StreamHijacker(ft, str)
return c.opts.StreamHijacker(ft, c.conn, str)
})
if err == errHijacked {
return
Expand Down
2 changes: 1 addition & 1 deletion http3/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type RoundTripper struct {
// Callers can either process the frame and return control of the stream back to HTTP/3
// (by returning hijacked false).
// Alternatively, callers can take over the QUIC stream (by returning hijacked true).
StreamHijacker func(FrameType, quic.Stream) (hijacked bool, err error)
StreamHijacker func(FrameType, quic.Connection, quic.Stream) (hijacked bool, err error)

// Dial specifies an optional dial function for creating QUIC
// connections for requests.
Expand Down

0 comments on commit 7d738e1

Please sign in to comment.