Skip to content
Permalink
Browse files

Use peerName instead of peerAddress

  • Loading branch information
RichardSteele committed Nov 18, 2019
1 parent 39ece29 commit 893726c3d8743c1ff8b204cdfe4815f8928388d5
@@ -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) {

@@ -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);

0 comments on commit 893726c

Please sign in to comment.
You can’t perform that action at this time.