Skip to content

Commit

Permalink
Include the SNI for SSL client
Browse files Browse the repository at this point in the history
  • Loading branch information
grondinjc authored and orgads committed Sep 11, 2024
1 parent fdc0c97 commit d677f54
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sslsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ const char *SSL_error_string(int ssl_error, int orig_ret)

SSL* SSL_new_client()
{
return SSL_new(sip_trp_ssl_ctx_client);
SSL* ssl = SSL_new(sip_trp_ssl_ctx_client);

// Inject the ServerNameIndication (SNI).
// It requires to be a hostname. However, SSL takes whatever we set.
// Ref https://datatracker.ietf.org/doc/html/rfc6066#section-3
if (strcmp(remote_ip, remote_host)) {
SSL_set_tlsext_host_name(ssl, remote_host);
}

return ssl;
}

SSL* SSL_new_server()
Expand Down

0 comments on commit d677f54

Please sign in to comment.