Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SNI extension if available #787

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) && (nc->cur != NULL) && (!SSL_set_tlsext_host_name(ssl, nc->cur->url->host)))
kozlovic marked this conversation as resolved.
Show resolved Hide resolved
{
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