1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[pollock] remove call to ValidateDownload()

* It is seeing 403 errors from GitHub even though the download works
This commit is contained in:
Pete Batard 2019-03-12 13:42:01 +00:00
parent 65f886141b
commit 688ccfad66
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 8 additions and 53 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Poedit <-> rufus.loc conversion utility
* Copyright © 2018 Pete Batard <pete@akeo.ie>
* Copyright © 2018-2019 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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.1.*")]
[assembly: AssemblyVersion("1.2.*")]
namespace pollock
{
@ -743,45 +743,6 @@ namespace pollock
return true;
}
/// <summary>
/// Validate a download URL by checking its HTTP status code.
/// </summary>
/// <param name="url">The URL to validate.</param>
/// <returns>true if URL is acessible, false on error.</returns>
static bool ValidateDownload(string url)
{
HttpStatusCode status = HttpStatusCode.InternalServerError;
var uri = new Uri(url);
WebRequest request = WebRequest.Create(uri);
request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
request.Method = "HEAD";
// This is soooooooo retarded. Trying to simply read a 404 response throws a 404 *exception*?!?
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
status = response.StatusCode;
}
catch (WebException we)
{
HttpWebResponse response = we.Response as HttpWebResponse;
if (response != null)
{
status = response.StatusCode;
response.Close();
}
}
request.Abort();
switch (status)
{
case HttpStatusCode.OK:
return true;
default:
Console.WriteLine($"Error downloading {url}: {(int)status} - {status}");
return false;
}
}
/// <summary>
/// Download a file as a string. Codepage is assumed to be UTF-8.
/// </summary>
@ -791,9 +752,6 @@ namespace pollock
{
string str = null;
if (!ValidateDownload(url))
return null;
using (WebClient wc = new WebClient())
{
try
@ -825,9 +783,6 @@ namespace pollock
if (dest == null)
dest = url.Split('/').Last();
if (!ValidateDownload(url))
return false;
console_x_pos = Console.CursorLeft;
using (WebClient wc = new WebClient())
{

View file

@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>pollock</RootNamespace>
<AssemblyName>pollock</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

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.5.1454"
CAPTION "Rufus 3.5.1455"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -394,8 +394,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,1454,0
PRODUCTVERSION 3,5,1454,0
FILEVERSION 3,5,1455,0
PRODUCTVERSION 3,5,1455,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -413,13 +413,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.5.1454"
VALUE "FileVersion", "3.5.1455"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.5.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.5.1454"
VALUE "ProductVersion", "3.5.1455"
END
END
BLOCK "VarFileInfo"