From 5d3631f9ee5ee6d021482c467ba8a30d9623df16 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sat, 21 Jul 2018 13:03:05 +0100 Subject: [PATCH] [pollock] fix inability of Windows 7 to handle github SSL * Also increase the console width if needed --- res/loc/pollock/Pollock.cs | 23 ++++++++++++++++------- src/rufus.rc | 10 +++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/res/loc/pollock/Pollock.cs b/res/loc/pollock/Pollock.cs index ef2f0d47..abcd9cf7 100644 --- a/res/loc/pollock/Pollock.cs +++ b/res/loc/pollock/Pollock.cs @@ -43,7 +43,7 @@ using System.Windows.Forms; [assembly: AssemblyProduct("Pollock")] [assembly: AssemblyCopyright("Copyright © 2018 Pete Batard ")] [assembly: AssemblyTrademark("GNU GPLv3")] -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.1.*")] namespace pollock { @@ -750,7 +750,7 @@ namespace pollock /// true if URL is acessible, false on error. static bool ValidateDownload(string url) { - HttpStatusCode status = HttpStatusCode.NotFound; + HttpStatusCode status = HttpStatusCode.InternalServerError; var uri = new Uri(url); WebRequest request = WebRequest.Create(uri); request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); @@ -759,15 +759,17 @@ namespace pollock // This is soooooooo retarded. Trying to simply read a 404 response throws a 404 *exception*?!? try { - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - status = response.StatusCode; - response.Close(); + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) + status = response.StatusCode; } catch (WebException we) { HttpWebResponse response = we.Response as HttpWebResponse; - status = response.StatusCode; - response.Close(); + if (response != null) + { + status = response.StatusCode; + response.Close(); + } } request.Abort(); switch (status) @@ -964,6 +966,13 @@ namespace pollock [STAThread] static void Main(string[] args) { + // Fix needed for Windows 7 to download from github SSL + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + // Also set the Console width to something that can accomodate us + if (Console.WindowWidth < 100) + Console.SetWindowSize(100, Console.WindowHeight); + bool use_local_loc = false; Console.OutputEncoding = System.Text.Encoding.UTF8; Console.CancelKeyPress += delegate (object sender, ConsoleCancelEventArgs e) { diff --git a/src/rufus.rc b/src/rufus.rc index 58df11e3..5097196a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.2.1346" +CAPTION "Rufus 3.2.1347" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,1346,0 - PRODUCTVERSION 3,2,1346,0 + FILEVERSION 3,2,1347,0 + PRODUCTVERSION 3,2,1347,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://akeo.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.2.1346" + VALUE "FileVersion", "3.2.1347" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.2.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.2.1346" + VALUE "ProductVersion", "3.2.1347" END END BLOCK "VarFileInfo"