From f1a3ae730a5e2847c22cda8e2fa0dce7fbda2b1a Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 4 Apr 2016 15:36:14 +0200 Subject: [PATCH] Update package file download sets User-Agent header too now --- UpdCheck/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UpdCheck/main.cpp b/UpdCheck/main.cpp index 8bc89c8..06e628b 100644 --- a/UpdCheck/main.cpp +++ b/UpdCheck/main.cpp @@ -496,6 +496,14 @@ bool wxUpdCheckApp::DownloadUpdatePackage(const wxString &fileName) if (!url.IsOk()) continue; + if (url.HasScheme()) { + const wxString scheme = url.GetScheme(); + if (scheme == wxT("http") || scheme == wxT("https")) { + wxHTTP &http = (wxHTTP&)url.GetProtocol(); + http.SetHeader(wxS("User-Agent"), wxS("Updater/") wxS(UPDATER_VERSION_STR)); + } + } + wxLogStatus(wxT("Downloading update package from %s..."), m_urls[i].c_str()); wxInputStream *stream = url.GetInputStream(); if (!stream) {