From 3fcc729746ce6e1dea2626f4c36bfdd74c3d52bc Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 17 Nov 2013 17:18:42 +0100 Subject: [PATCH] Include module version in the User-Agent header. --- push.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/push.cpp b/push.cpp index 9692e08..126e543 100644 --- a/push.cpp +++ b/push.cpp @@ -52,7 +52,7 @@ class CPushSocket : public CSocket parent = (CPushMod*) p; first = true; crlf = "\r\n"; - user_agent = "ZNC Push"; + user_agent = "ZNC Push/" + CString(PUSHVERSION); } // Implemented after CPushMod @@ -1500,6 +1500,8 @@ CURLcode make_curl_request(const CString& service_host, const CString& service_u curl = curl_easy_init(); + CString user_agent = "ZNC Push/" + CString(PUSHVERSION); + CString url = CString(use_ssl ? "https" : "http") + "://" + service_host + service_url; 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_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? if (service_auth != "")