Skip to content

Commit

Permalink
Adding SNI extension if available
Browse files Browse the repository at this point in the history
  • Loading branch information
thierryba committed Aug 9, 2024
1 parent 01cfb28 commit 9f9b70d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,13 @@ _makeTLSConn(natsConnection *nc)
SSL_set_verify(ssl, SSL_VERIFY_PEER, _collectSSLErr);
}
}
#if defined(NATS_USE_OPENSSL_1_1)
// add the host name in the SNI extension
if ((s == NATS_OK) && (!SSL_set_tlsext_host_name(ssl, nc->cur->url->host)))
{
s = nats_setError(NATS_SSL_ERROR, "unable to set SNI extension for hostname '%s'", nc->cur->url->host);
}
#endif
if ((s == NATS_OK) && (SSL_do_handshake(ssl) != 1))
{
s = nats_setError(NATS_SSL_ERROR,
Expand Down

0 comments on commit 9f9b70d

Please sign in to comment.