From: Kyle Fuller Date: Tue, 24 Sep 2013 07:08:27 +0000 (+0100) Subject: Fix a bug where PATH and headers were not being sent to the server correctly X-Git-Tag: 1.0.0~18 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b12e13ba6e721034f3ebb39d1e81cad1fd7d46d7;p=znc-palaver.git Fix a bug where PATH and headers were not being sent to the server correctly Add additional logging when we send a notification --- diff --git a/palaver.cpp b/palaver.cpp index 1269b01..8515bc7 100644 --- a/palaver.cpp +++ b/palaver.cpp @@ -57,13 +57,17 @@ public: mcsHeaders["Content-Length"] = CString(sContent.length()); } - Connect(sHostname, uPort, sScheme.Equals("https")); - Write(sMethod + " HTTP/1.1\r\n"); + bool useSSL = sScheme.Equals("https"); + + DEBUG("Palaver: Connecting to '" << sHostname << "' on port " << uPort << (useSSL ? " with" : " without") << " TLS (" << sMethod << " " << sPath << ")"); + + Connect(sHostname, uPort, useSSL); + Write(sMethod + " " + sPath + " HTTP/1.1\r\n"); Write("Host: " + sHostname + "\r\n"); for (MCString::const_iterator it = mcsHeaders.begin(); it != mcsHeaders.end(); ++it) { - CString sKey; - CString sValue; + const CString &sKey = it->first; + const CString &sValue = it->second; Write(sKey + ": " + sValue + "\r\n"); } @@ -494,7 +498,7 @@ public: mcsHeaders["Content-Type"] = "application/json"; CString sJSON = "{"; - sJSON += "\"badge\": " + m_uiBadge; + sJSON += "\"badge\": " + CString(m_uiBadge); sJSON += ",\"message\": \"" + sNotification.Replace_n("\"", "\\\"") + "\""; sJSON += ",\"sender\": \"" + sSender.Replace_n("\"", "\\\"") + "\""; if (pChannel) {