bool SendReportRequest(const char *uri, const std::string &data, Buffer *output = NULL) { bool result = false; net::AutoInit netInit; http::Client http; Buffer theVoid; if (output == NULL) output = &theVoid; if (http.Resolve(ServerHostname(), ServerPort())) { http.Connect(); http.POST("/report/message", data, "application/x-www-form-urlencoded", output); http.Disconnect(); result = true; } return result; }
bool SendReportRequest(const char *uri, const std::string &data, const std::string &mimeType, Buffer *output = NULL) { bool result = false; http::Client http; Buffer theVoid; if (output == NULL) output = &theVoid; const char *serverHost = ServerHostname(); if (!serverHost) return false; if (http.Resolve(serverHost, ServerPort())) { http.Connect(); int result = http.POST(uri, data, mimeType, output); http.Disconnect(); return result >= 200 && result < 300; } else { return false; } }