Skip to content

Commit

Permalink
Fix test (context can't be set in ClientHelloInfo)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Nov 14, 2023
1 parent db6a576 commit e017bf7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (cfg *Config) GetCertificateWithContext(ctx context.Context, clientHello *t
return nil, fmt.Errorf("handshake aborted by event handler: %w", err)
}

if ctx == nil {
// tests can't set context on a tls.ClientHelloInfo because it's unexported :(
ctx = context.Background()
}
ctx = context.WithValue(ctx, ClientHelloInfoCtxKey, clientHello)

// special case: serve up the certificate for a TLS-ALPN ACME challenge
Expand Down

0 comments on commit e017bf7

Please sign in to comment.