forked from quic-go/quic-go
http3: don't automatically set RoundTripper.QuicConfig.EnableDatagrams (#4340)
If the user provides a quic.Config, we shouldn't modify it. Instead, we should return an error if the user enables HTTP Datagrams but fails to enable datagrams on the QUIC layer.
This commit is contained in:
@@ -99,6 +99,19 @@ var _ = Describe("RoundTripper", func() {
|
||||
Expect(receivedConfig.HandshakeIdleTimeout).To(Equal(config.HandshakeIdleTimeout))
|
||||
})
|
||||
|
||||
It("requires quic.Config.EnableDatagram if HTTP datagrams are enabled", func() {
|
||||
rt.QuicConfig = &quic.Config{EnableDatagrams: false}
|
||||
rt.Dial = func(_ context.Context, _ string, _ *tls.Config, config *quic.Config) (quic.EarlyConnection, error) {
|
||||
return nil, errors.New("handshake error")
|
||||
}
|
||||
rt.EnableDatagrams = true
|
||||
_, err := rt.RoundTrip(req)
|
||||
Expect(err).To(MatchError("HTTP Datagrams enabled, but QUIC Datagrams disabled"))
|
||||
rt.QuicConfig.EnableDatagrams = true
|
||||
_, err = rt.RoundTrip(req)
|
||||
Expect(err).To(MatchError("handshake error"))
|
||||
})
|
||||
|
||||
It("uses the custom dialer, if provided", func() {
|
||||
var dialed bool
|
||||
dialer := func(_ context.Context, _ string, tlsCfgP *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) {
|
||||
|
||||
Reference in New Issue
Block a user