summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-06-23 20:33:44 +0100
committersr55 <[email protected]>2017-06-23 20:34:00 +0100
commit2128977388d9003a8bb191b2c0c481d5e5083601 (patch)
tree1352e72aa137c034d1a70522e212abede05c0a28
parentbe794bdcaa7c899a7b42251bc1ad34fbbdb8b992 (diff)
WinGui: Add a user agent for the HttpRequest on the update checker so we can identify the WinGui version that's checking for updates.
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs6
-rw-r--r--win/CS/HandBrakeWPF/Services/UpdateService.cs2
2 files changed, 8 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
index 209e3ddc8..40aca7d3e 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/VersionHelper.cs
@@ -33,6 +33,12 @@ namespace HandBrake.ApplicationServices.Utilities
return IsNightly() ? string.Format("Nightly {0} ({1})", instance.Version, instance.Build) : string.Format("{0} ({1})", instance.Version, instance.Build);
}
+ public static string GetVersionShort()
+ {
+ IHandBrakeInstance instance = HandBrakeInstanceManager.GetScanInstance(1);
+ return string.Format("{0} {1}", instance.Version, instance.Build);
+ }
+
/// <summary>
/// The is nightly.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs
index 362df2e33..3b3d09125 100644
--- a/win/CS/HandBrakeWPF/Services/UpdateService.cs
+++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs
@@ -108,6 +108,7 @@ namespace HandBrakeWPF.Services
// Fetch the Appcast from our server.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = false; // We will never do this.
+ request.UserAgent = string.Format("HandBrake Win Upd {0}", VersionHelper.GetVersionShort());
WebResponse response = request.GetResponse();
// Parse the data with the AppcastReader
@@ -180,6 +181,7 @@ namespace HandBrakeWPF.Services
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Credentials = CredentialCache.DefaultCredentials;
+ webRequest.UserAgent = string.Format("HandBrake Win Upd {0}", VersionHelper.GetVersionShort());
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
long fileSize = webResponse.ContentLength;