[pollock] fix inability of Windows 7 to handle github SSL

* Also increase the console width if needed
This commit is contained in:
Pete Batard 2018-07-21 13:03:05 +01:00
parent f18b3fec1b
commit 5d3631f9ee
2 changed files with 21 additions and 12 deletions

View File

@ -43,7 +43,7 @@ using System.Windows.Forms;
[assembly: AssemblyProduct("Pollock")]
[assembly: AssemblyCopyright("Copyright © 2018 Pete Batard <pete@akeo.ie>")]
[assembly: AssemblyTrademark("GNU GPLv3")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
namespace pollock
{
@ -750,7 +750,7 @@ namespace pollock
/// <returns>true if URL is acessible, false on error.</returns>
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) {

View File

@ -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"