forked from quic-go/quic-go
http3: rename RoundTripper.QuicConfig to RoundTripper.QUICConfig (#4385)
This commit is contained in:
@@ -46,7 +46,7 @@ func main() {
|
|||||||
InsecureSkipVerify: *insecure,
|
InsecureSkipVerify: *insecure,
|
||||||
KeyLogWriter: keyLog,
|
KeyLogWriter: keyLog,
|
||||||
},
|
},
|
||||||
QuicConfig: &quic.Config{
|
QUICConfig: &quic.Config{
|
||||||
Tracer: qlog.DefaultTracer,
|
Tracer: qlog.DefaultTracer,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,12 +70,12 @@ type RoundTripper struct {
|
|||||||
// tls.Client. If nil, the default configuration is used.
|
// tls.Client. If nil, the default configuration is used.
|
||||||
TLSClientConfig *tls.Config
|
TLSClientConfig *tls.Config
|
||||||
|
|
||||||
// QuicConfig is the quic.Config used for dialing new connections.
|
// QUICConfig is the quic.Config used for dialing new connections.
|
||||||
// If nil, reasonable default values will be used.
|
// If nil, reasonable default values will be used.
|
||||||
QuicConfig *quic.Config
|
QUICConfig *quic.Config
|
||||||
|
|
||||||
// Enable support for HTTP/3 datagrams (RFC 9297).
|
// Enable support for HTTP/3 datagrams (RFC 9297).
|
||||||
// If a QuicConfig is set, datagram support also needs to be enabled on the QUIC layer by setting EnableDatagrams.
|
// If a QUICConfig is set, datagram support also needs to be enabled on the QUIC layer by setting EnableDatagrams.
|
||||||
EnableDatagrams bool
|
EnableDatagrams bool
|
||||||
|
|
||||||
// Additional HTTP/3 settings.
|
// Additional HTTP/3 settings.
|
||||||
@@ -217,7 +217,7 @@ func (r *RoundTripper) getClient(hostname string, onlyCached bool) (rtc *roundTr
|
|||||||
UniStreamHijacker: r.UniStreamHijacker,
|
UniStreamHijacker: r.UniStreamHijacker,
|
||||||
AdditionalSettings: r.AdditionalSettings,
|
AdditionalSettings: r.AdditionalSettings,
|
||||||
},
|
},
|
||||||
r.QuicConfig,
|
r.QUICConfig,
|
||||||
dial,
|
dial,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -93,21 +93,21 @@ var _ = Describe("RoundTripper", func() {
|
|||||||
receivedConfig = config
|
receivedConfig = config
|
||||||
return nil, errors.New("handshake error")
|
return nil, errors.New("handshake error")
|
||||||
}
|
}
|
||||||
rt.QuicConfig = config
|
rt.QUICConfig = config
|
||||||
_, err := rt.RoundTrip(req)
|
_, err := rt.RoundTrip(req)
|
||||||
Expect(err).To(MatchError("handshake error"))
|
Expect(err).To(MatchError("handshake error"))
|
||||||
Expect(receivedConfig.HandshakeIdleTimeout).To(Equal(config.HandshakeIdleTimeout))
|
Expect(receivedConfig.HandshakeIdleTimeout).To(Equal(config.HandshakeIdleTimeout))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("requires quic.Config.EnableDatagram if HTTP datagrams are enabled", func() {
|
It("requires quic.Config.EnableDatagram if HTTP datagrams are enabled", func() {
|
||||||
rt.QuicConfig = &quic.Config{EnableDatagrams: false}
|
rt.QUICConfig = &quic.Config{EnableDatagrams: false}
|
||||||
rt.Dial = func(_ context.Context, _ string, _ *tls.Config, config *quic.Config) (quic.EarlyConnection, error) {
|
rt.Dial = func(_ context.Context, _ string, _ *tls.Config, config *quic.Config) (quic.EarlyConnection, error) {
|
||||||
return nil, errors.New("handshake error")
|
return nil, errors.New("handshake error")
|
||||||
}
|
}
|
||||||
rt.EnableDatagrams = true
|
rt.EnableDatagrams = true
|
||||||
_, err := rt.RoundTrip(req)
|
_, err := rt.RoundTrip(req)
|
||||||
Expect(err).To(MatchError("HTTP Datagrams enabled, but QUIC Datagrams disabled"))
|
Expect(err).To(MatchError("HTTP Datagrams enabled, but QUIC Datagrams disabled"))
|
||||||
rt.QuicConfig.EnableDatagrams = true
|
rt.QUICConfig.EnableDatagrams = true
|
||||||
_, err = rt.RoundTrip(req)
|
_, err = rt.RoundTrip(req)
|
||||||
Expect(err).To(MatchError("handshake error"))
|
Expect(err).To(MatchError("handshake error"))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ var _ = Describe("HTTP3 Server hotswap test", func() {
|
|||||||
rt = &http3.RoundTripper{
|
rt = &http3.RoundTripper{
|
||||||
TLSClientConfig: getTLSClientConfig(),
|
TLSClientConfig: getTLSClientConfig(),
|
||||||
DisableCompression: true,
|
DisableCompression: true,
|
||||||
QuicConfig: getQuicConfig(&quic.Config{MaxIdleTimeout: 10 * time.Second}),
|
QUICConfig: getQuicConfig(&quic.Config{MaxIdleTimeout: 10 * time.Second}),
|
||||||
}
|
}
|
||||||
client = &http.Client{Transport: rt}
|
client = &http.Client{Transport: rt}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ var _ = Describe("HTTP tests", func() {
|
|||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
rt = &http3.RoundTripper{
|
rt = &http3.RoundTripper{
|
||||||
TLSClientConfig: getTLSClientConfigWithoutServerName(),
|
TLSClientConfig: getTLSClientConfigWithoutServerName(),
|
||||||
QuicConfig: getQuicConfig(&quic.Config{
|
QUICConfig: getQuicConfig(&quic.Config{
|
||||||
MaxIdleTimeout: 10 * time.Second,
|
MaxIdleTimeout: 10 * time.Second,
|
||||||
Allow0RTT: true,
|
Allow0RTT: true,
|
||||||
}),
|
}),
|
||||||
@@ -604,7 +604,7 @@ var _ = Describe("HTTP tests", func() {
|
|||||||
tlsConf.ClientSessionCache = newClientSessionCache(tls.NewLRUClientSessionCache(10), nil, puts)
|
tlsConf.ClientSessionCache = newClientSessionCache(tls.NewLRUClientSessionCache(10), nil, puts)
|
||||||
rt := &http3.RoundTripper{
|
rt := &http3.RoundTripper{
|
||||||
TLSClientConfig: tlsConf,
|
TLSClientConfig: tlsConf,
|
||||||
QuicConfig: getQuicConfig(&quic.Config{
|
QUICConfig: getQuicConfig(&quic.Config{
|
||||||
MaxIdleTimeout: 10 * time.Second,
|
MaxIdleTimeout: 10 * time.Second,
|
||||||
Allow0RTT: true,
|
Allow0RTT: true,
|
||||||
}),
|
}),
|
||||||
@@ -628,7 +628,7 @@ var _ = Describe("HTTP tests", func() {
|
|||||||
|
|
||||||
rt2 := &http3.RoundTripper{
|
rt2 := &http3.RoundTripper{
|
||||||
TLSClientConfig: rt.TLSClientConfig,
|
TLSClientConfig: rt.TLSClientConfig,
|
||||||
QuicConfig: rt.QuicConfig,
|
QUICConfig: rt.QUICConfig,
|
||||||
DisableCompression: true,
|
DisableCompression: true,
|
||||||
}
|
}
|
||||||
defer rt2.Close()
|
defer rt2.Close()
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func runTestcase(testcase string) error {
|
|||||||
if testcase == "http3" {
|
if testcase == "http3" {
|
||||||
r := &http3.RoundTripper{
|
r := &http3.RoundTripper{
|
||||||
TLSClientConfig: tlsConf,
|
TLSClientConfig: tlsConf,
|
||||||
QuicConfig: quicConf,
|
QUICConfig: quicConf,
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
return downloadFiles(r, urls, false)
|
return downloadFiles(r, urls, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user