Skip to content

Instantly share code, notes, and snippets.

@nnugumanov
Created November 19, 2015 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnugumanov/603266dbfaaa954d4944 to your computer and use it in GitHub Desktop.
Save nnugumanov/603266dbfaaa954d4944 to your computer and use it in GitHub Desktop.
SSL_set_tlsext_host_name call in do_connect
static bool do_connect(SSL *ssl, int &SSL_res, interval_t *timeout) throw() {
if(!SSL_set_tlsext_host_name(ssl, "example.com")) {
log_openssl_error(log::error);
throw exception_log_t(log::error, "SSL_sni");
}
SSL_set_connect_state(ssl);
while(true) {
int res = SSL_connect(ssl);
if(res > 0) return true;
else
if(ssl_wait_loop(ssl, res, SSL_res, timeout) < 0)
break;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment