Skip to content

Commit b08f231

Browse files
Merge pull request #161 from monzo/http2-negotiation-respect-context-deadline
Use DialTLSContext instead of DialTLS when negotiating HTTP2 session
2 parents 8168923 + dd1c028 commit b08f231

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ var (
3232
AllowHTTP: true,
3333
// This monstrosity is needed to get the http2 Transport to dial over cleartext.
3434
// See https://github.com/thrawn01/h2c-golang-example
35-
DialTLS: func(network, addr string, _ *tls.Config) (net.Conn, error) {
36-
return net.Dial(network, addr)
35+
DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) {
36+
var d net.Dialer
37+
return d.DialContext(ctx, network, addr)
3738
},
3839
}
3940
)

0 commit comments

Comments
 (0)