From a9d85c013ba7c809a2b8981e2576bffec33d95e9 Mon Sep 17 00:00:00 2001 From: Joe Ellis Date: Thu, 23 Feb 2023 17:38:17 +0000 Subject: [PATCH] Use DialTLSContext instead of DialTLS when negotiating HTTP2 session ... so that we respect context deadlines when we're dialling. The old DialTLS is marked as deprecated now anyways. --- client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 77745d91..6eb24828 100644 --- a/client.go +++ b/client.go @@ -32,8 +32,9 @@ var ( AllowHTTP: true, // This monstrosity is needed to get the http2 Transport to dial over cleartext. // See https://github.com/thrawn01/h2c-golang-example - DialTLS: func(network, addr string, _ *tls.Config) (net.Conn, error) { - return net.Dial(network, addr) + DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) { + var d net.Dialer + return d.DialContext(ctx, network, addr) }, } )