Include module version in the User-Agent header.

This commit is contained in:
Tomaz Muraus 2013-11-17 17:18:42 +01:00
parent bb512f60c3
commit 3fcc729746
1 changed files with 4 additions and 2 deletions

View File

@ -52,7 +52,7 @@ class CPushSocket : public CSocket
parent = (CPushMod*) p; parent = (CPushMod*) p;
first = true; first = true;
crlf = "\r\n"; crlf = "\r\n";
user_agent = "ZNC Push"; user_agent = "ZNC Push/" + CString(PUSHVERSION);
} }
// Implemented after CPushMod // Implemented after CPushMod
@ -1500,6 +1500,8 @@ CURLcode make_curl_request(const CString& service_host, const CString& service_u
curl = curl_easy_init(); curl = curl_easy_init();
CString user_agent = "ZNC Push/" + CString(PUSHVERSION);
CString url = CString(use_ssl ? "https" : "http") + "://" + service_host + service_url; CString url = CString(use_ssl ? "https" : "http") + "://" + service_host + service_url;
CString query = build_query_string(params); CString query = build_query_string(params);
@ -1513,7 +1515,7 @@ CURLcode make_curl_request(const CString& service_host, const CString& service_u
curl_easy_setopt(curl, CURLOPT_URL, url.data()); curl_easy_setopt(curl, CURLOPT_URL, url.data());
curl_easy_setopt(curl, CURLOPT_PORT, port); curl_easy_setopt(curl, CURLOPT_PORT, port);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "ZNC Push"); curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent.c_str());
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 3); // three seconds ought to be good enough for anyone, eh? curl_easy_setopt(curl, CURLOPT_TIMEOUT, 3); // three seconds ought to be good enough for anyone, eh?
if (service_auth != "") if (service_auth != "")