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:
parent
65f886141b
commit
688ccfad66
3 changed files with 8 additions and 53 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Rufus: The Reliable USB Formatting Utility
|
* Rufus: The Reliable USB Formatting Utility
|
||||||
* Poedit <-> rufus.loc conversion 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
|
* 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
|
* 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: AssemblyProduct("Pollock")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2018 Pete Batard <pete@akeo.ie>")]
|
[assembly: AssemblyCopyright("Copyright © 2018 Pete Batard <pete@akeo.ie>")]
|
||||||
[assembly: AssemblyTrademark("GNU GPLv3")]
|
[assembly: AssemblyTrademark("GNU GPLv3")]
|
||||||
[assembly: AssemblyVersion("1.1.*")]
|
[assembly: AssemblyVersion("1.2.*")]
|
||||||
|
|
||||||
namespace pollock
|
namespace pollock
|
||||||
{
|
{
|
||||||
|
@ -743,45 +743,6 @@ namespace pollock
|
||||||
return true;
|
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>
|
/// <summary>
|
||||||
/// Download a file as a string. Codepage is assumed to be UTF-8.
|
/// Download a file as a string. Codepage is assumed to be UTF-8.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -791,9 +752,6 @@ namespace pollock
|
||||||
{
|
{
|
||||||
string str = null;
|
string str = null;
|
||||||
|
|
||||||
if (!ValidateDownload(url))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
using (WebClient wc = new WebClient())
|
using (WebClient wc = new WebClient())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -825,9 +783,6 @@ namespace pollock
|
||||||
if (dest == null)
|
if (dest == null)
|
||||||
dest = url.Split('/').Last();
|
dest = url.Split('/').Last();
|
||||||
|
|
||||||
if (!ValidateDownload(url))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
console_x_pos = Console.CursorLeft;
|
console_x_pos = Console.CursorLeft;
|
||||||
using (WebClient wc = new WebClient())
|
using (WebClient wc = new WebClient())
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>pollock</RootNamespace>
|
<RootNamespace>pollock</RootNamespace>
|
||||||
<AssemblyName>pollock</AssemblyName>
|
<AssemblyName>pollock</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 3.5.1454"
|
CAPTION "Rufus 3.5.1455"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -394,8 +394,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,5,1454,0
|
FILEVERSION 3,5,1455,0
|
||||||
PRODUCTVERSION 3,5,1454,0
|
PRODUCTVERSION 3,5,1455,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -413,13 +413,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://akeo.ie"
|
VALUE "Comments", "https://akeo.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.5.1454"
|
VALUE "FileVersion", "3.5.1455"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.5.exe"
|
VALUE "OriginalFilename", "rufus-3.5.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.5.1454"
|
VALUE "ProductVersion", "3.5.1455"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue