From: Kyle Fuller Date: Mon, 10 Aug 2015 22:02:09 +0000 (+0100) Subject: Send SNI when connecting via TLS X-Git-Tag: 1.0.0~5 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=fca16c60742bd452d2af7fc87c40b6141e3cd5ef;p=znc-palaver.git Send SNI when connecting via TLS --- diff --git a/palaver.cpp b/palaver.cpp index 4c2e5ff..bcdb00d 100644 --- a/palaver.cpp +++ b/palaver.cpp @@ -81,7 +81,7 @@ public: CString sTemp = sURL.Token(1, true, "://"); CString sAddress = sTemp.Token(0, false, "/"); - CString sHostname = sAddress.Token(0, false, ":"); + m_sHostname = sAddress.Token(0, false, ":"); CString sPort = sAddress.Token(1, true, ":"); CString sPath = "/" + sTemp.Token(1, true, "/"); @@ -104,12 +104,12 @@ public: bool useSSL = sScheme.Equals("https"); - DEBUG("Palaver: Connecting to '" << sHostname << "' on port " << uPort << (useSSL ? " with" : " without") << " TLS (" << sMethod << " " << sPath << ")"); + DEBUG("Palaver: Connecting to '" << m_sHostname << "' on port " << uPort << (useSSL ? " with" : " without") << " TLS (" << sMethod << " " << sPath << ")"); - Connect(sHostname, uPort, useSSL); + Connect(m_sHostname, uPort, useSSL); EnableReadLine(); Write(sMethod + " " + sPath + " HTTP/1.1\r\n"); - Write("Host: " + sHostname + "\r\n"); + Write("Host: " + m_sHostname + "\r\n"); for (MCString::const_iterator it = mcsHeaders.begin(); it != mcsHeaders.end(); ++it) { const CString &sKey = it->first; @@ -165,6 +165,14 @@ public: void Disconnected() { Close(CSocket::CLT_AFTERWRITE); } + + virtual bool SNIConfigureClient(CS_STRING &sHostname) { + sHostname = m_sHostname; + return true; + } + +private: + CString m_sHostname; }; class CDevice {