Merge pull request #3359 from lucas-clemente/http3-dial-context

respect the request context when dialing
This commit is contained in:
Marten Seemann 2022-03-25 10:27:43 +01:00 committed by GitHub
commit 42f3159497
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 46 deletions

View file

@ -82,7 +82,7 @@ var _ = Describe("RoundTripper", func() {
BeforeEach(func() {
session = mockquic.NewMockEarlySession(mockCtrl)
origDialAddr = dialAddr
dialAddr = func(addr string, tlsConf *tls.Config, config *quic.Config) (quic.EarlySession, error) {
dialAddr = func(context.Context, string, *tls.Config, *quic.Config) (quic.EarlySession, error) {
// return an error when trying to open a stream
// we don't want to test all the dial logic here, just that dialing happens at all
return session, nil
@ -115,7 +115,7 @@ var _ = Describe("RoundTripper", func() {
It("uses the quic.Config, if provided", func() {
config := &quic.Config{HandshakeIdleTimeout: time.Millisecond}
var receivedConfig *quic.Config
dialAddr = func(addr string, tlsConf *tls.Config, config *quic.Config) (quic.EarlySession, error) {
dialAddr = func(_ context.Context, _ string, _ *tls.Config, config *quic.Config) (quic.EarlySession, error) {
receivedConfig = config
return nil, errors.New("handshake error")
}
@ -127,7 +127,7 @@ var _ = Describe("RoundTripper", func() {
It("uses the custom dialer, if provided", func() {
var dialed bool
dialer := func(_, _ string, tlsCfgP *tls.Config, cfg *quic.Config) (quic.EarlySession, error) {
dialer := func(_ context.Context, _, _ string, tlsCfgP *tls.Config, cfg *quic.Config) (quic.EarlySession, error) {
dialed = true
return nil, errors.New("handshake error")
}