Use peerName instead of peerAddress

This commit is contained in:
Richard Steele 2019-11-18 12:22:56 +01:00
parent 39ece29fed
commit 893726c3d8
2 changed files with 5 additions and 5 deletions

View File

@ -317,9 +317,9 @@ void TLSSocket_GnuTLS::handshake() {
// Start handshaking process
try {
string peerAddress = getPeerAddress();
string peerName = getPeerName();
gnutls_server_name_set(*m_session->m_gnutlsSession, GNUTLS_NAME_DNS, peerAddress.c_str(), peerAddress.size());
gnutls_server_name_set(*m_session->m_gnutlsSession, GNUTLS_NAME_DNS, peerName.c_str(), peerName.size());
while (true) {

View File

@ -122,9 +122,9 @@ TLSSocket_OpenSSL::~TLSSocket_OpenSSL() {
void TLSSocket_OpenSSL::createSSLHandle() {
if (m_wrapped->isConnected()) {
string peerAddress = getPeerAddress();
string peerName = getPeerName();
if (peerAddress.empty()) {
if (peerName.empty()) {
throw exceptions::tls_exception("Unknown host name, will not be able to set SNI");
}
@ -168,7 +168,7 @@ void TLSSocket_OpenSSL::createSSLHandle() {
}
SSL_set_bio(m_ssl, sockBio, sockBio);
SSL_set_tlsext_host_name(m_ssl, peerAddress.c_str());
SSL_set_tlsext_host_name(m_ssl, peerName.c_str());
SSL_set_connect_state(m_ssl);
SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY | SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);