Fix a bug where PATH and headers were not being sent to the server correctly
authorKyle Fuller <redacted>
Tue, 24 Sep 2013 07:08:27 +0000 (08:08 +0100)
committerKyle Fuller <redacted>
Tue, 24 Sep 2013 12:51:55 +0000 (13:51 +0100)
Add additional logging when we send a notification

palaver.cpp

index 1269b01048ae8a4e868f7c2adf60712d153b9b68..8515bc725b36dc0c3f396c7ed20d1cf6b1178cea 100644 (file)
@@ -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) {
git clone https://git.99rst.org/PROJECT