Skip to content

Commit

Permalink
http binding fix nilpointer
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Martinez <[email protected]>
  • Loading branch information
famarting committed Sep 11, 2024
1 parent 8225a11 commit fff1a6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bindings/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func (h *HTTPSource) Init(_ context.Context, meta bindings.Metadata) error {
if err != nil {
return err
}
if tlsConfig == nil {
tlsConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
if h.metadata.MTLSClientCert != "" && h.metadata.MTLSClientKey != "" {
err = h.readMTLSClientCertificates(tlsConfig)
if err != nil {
Expand Down Expand Up @@ -156,9 +159,6 @@ func (h *HTTPSource) readMTLSClientCertificates(tlsConfig *tls.Config) error {
if err != nil {
return fmt.Errorf("failed to load client certificate: %w", err)
}
if tlsConfig == nil {
tlsConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
tlsConfig.Certificates = []tls.Certificate{cert}
return nil
}
Expand Down

0 comments on commit fff1a6c

Please sign in to comment.