Skip to content

Commit

Permalink
enable datagram support on the SingleDestinationRoundTripper (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Apr 26, 2024
1 parent 0da5b74 commit ea89833
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (d *Dialer) Dial(ctx context.Context, urlStr string, reqHdr http.Header) (*
if quicConf == nil {
quicConf = &quic.Config{EnableDatagrams: true}
} else if !d.QUICConfig.EnableDatagrams {
return nil, nil, errors.New("WebTransport requires DATAGRAM support, enable it via QUICConfig.EnableDatagrams")
return nil, nil, errors.New("webtransport: DATAGRAM support required, enable it via QUICConfig.EnableDatagrams")
}

tlsConf := d.TLSClientConfig
Expand Down Expand Up @@ -101,7 +101,8 @@ func (d *Dialer) Dial(ctx context.Context, urlStr string, reqHdr http.Header) (*
return nil, nil, err
}
rt := &http3.SingleDestinationRoundTripper{
Connection: qconn,
Connection: qconn,
EnableDatagrams: true,
StreamHijacker: func(ft http3.FrameType, connTracingID quic.ConnectionTracingID, str quic.Stream, e error) (hijacked bool, err error) {
if isWebTransportError(e) {
return true, nil
Expand Down

0 comments on commit ea89833

Please sign in to comment.