diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-08 15:55:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-08 15:55:53 +0300 |
commit | 7f1f391faf93d216bfe651131a95d70961f8ffa2 (patch) | |
tree | 625b4f8ad0af19c3b3af6f515645d18f2ac75d25 /plugins/PluginUpdater/src | |
parent | 2905b7c3e14cb2c96656f0c0c0a5c21513941cc3 (diff) |
PluginUpdater: added OS version detect
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 7b0b1b704c..72d9bd91c9 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -220,10 +220,18 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc)
{
- char szMirVer[1000];
+ char szMirVer[100];
Miranda_GetVersionText(szMirVer, _countof(szMirVer));
- NETLIBHTTPREQUEST nlhr = {0};
+ wchar_t wszOsVer[100];
+ GetOSDisplayString(wszOsVer, _countof(wszOsVer));
+
+ CMStringA szUserAgent("Miranda ");
+ szUserAgent.Append(szMirVer);
+ szUserAgent.Append("; ");
+ szUserAgent.Append(_T2A(wszOsVer));
+
+ NETLIBHTTPREQUEST nlhr = {};
nlhr.cbSize = sizeof(nlhr);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_PERSISTENT;
nlhr.requestType = REQUEST_GET;
@@ -233,7 +241,7 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) nlhr.headersCount = 4;
nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = szMirVer;
+ nlhr.headers[0].szValue = szUserAgent.GetBuffer();
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
nlhr.headers[2].szName = "Cache-Control";
@@ -604,7 +612,7 @@ void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName) /////////////////////////////////////////////////////////////////////////////////////////
-char *StrToLower(char *str)
+char* StrToLower(char *str)
{
for (int i = 0; str[i]; i++)
str[i] = tolower(str[i]);
|