forked from quic-go/quic-go
add a http3.RoundTripOpt to skip the request scheme check
Otherwise, we'll only be able to issue https requests. This is what we usually want, but for MASQUE support, the URL will be of the form masque://example.org.
This commit is contained in:
@@ -61,11 +61,12 @@ type RoundTripper struct {
|
||||
|
||||
// RoundTripOpt are options for the Transport.RoundTripOpt method.
|
||||
type RoundTripOpt struct {
|
||||
// OnlyCachedConn controls whether the RoundTripper may
|
||||
// create a new QUIC connection. If set true and
|
||||
// no cached connection is available, RoundTrip
|
||||
// will return ErrNoCachedConn.
|
||||
// OnlyCachedConn controls whether the RoundTripper may create a new QUIC connection.
|
||||
// If set true and no cached connection is available, RoundTrip will return ErrNoCachedConn.
|
||||
OnlyCachedConn bool
|
||||
// SkipSchemeCheck controls whether we check if the scheme is https.
|
||||
// This allows the use of different schemes, e.g. masque://target.example.com:443/.
|
||||
SkipSchemeCheck bool
|
||||
}
|
||||
|
||||
var _ roundTripCloser = &RoundTripper{}
|
||||
@@ -99,7 +100,7 @@ func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if !opt.SkipSchemeCheck {
|
||||
closeRequestBody(req)
|
||||
return nil, fmt.Errorf("http3: unsupported protocol scheme: %s", req.URL.Scheme)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user