diff --git a/src/rustup-dist/src/dist.rs b/src/rustup-dist/src/dist.rs index e60be4d3dc..0b84229dcb 100644 --- a/src/rustup-dist/src/dist.rs +++ b/src/rustup-dist/src/dist.rs @@ -518,7 +518,7 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>, } } Ok(None) => return Ok(None), - Err(Error(ErrorKind::Utils(::rustup_utils::ErrorKind::Download404 { .. }), _)) => { + Err(Error(ErrorKind::Utils(::rustup_utils::ErrorKind::DownloadNotExists { .. }), _)) => { // Proceed to try v1 as a fallback (download.notify_handler)(Notification::DownloadingLegacyManifest); } @@ -528,7 +528,7 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>, // If the v2 manifest is not found then try v1 let manifest = match dl_v1_manifest(download, toolchain) { Ok(m) => m, - Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::Download404 { .. }), _)) => { + Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::DownloadNotExists { .. }), _)) => { return Err(format!("no release found for '{}'", toolchain.manifest_name()).into()); } Err(e @ Error(ErrorKind::ChecksumFailed { .. }, _)) => { @@ -547,7 +547,7 @@ pub fn update_from_dist<'a>(download: DownloadCfg<'a>, download.notify_handler.clone()) { Ok(None) => Ok(None), Ok(Some(hash)) => Ok(Some(hash)), - e @ Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::Download404 { .. }), _)) => { + e @ Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::DownloadNotExists { .. }), _)) => { e.chain_err(|| { format!("could not download nonexistent rust version `{}`", toolchain_str) diff --git a/src/rustup-utils/src/errors.rs b/src/rustup-utils/src/errors.rs index fa0b9456d6..ad29831dcb 100644 --- a/src/rustup-utils/src/errors.rs +++ b/src/rustup-utils/src/errors.rs @@ -81,7 +81,7 @@ error_chain! { description("could not download file") display("could not download file from '{}' to '{}", url, path.display()) } - Download404 { + DownloadNotExists { url: Url, path: PathBuf, } { diff --git a/src/rustup-utils/src/utils.rs b/src/rustup-utils/src/utils.rs index 8df0b1bd14..0ace7592a1 100644 --- a/src/rustup-utils/src/utils.rs +++ b/src/rustup-utils/src/utils.rs @@ -150,11 +150,13 @@ pub fn download_file(url: &Url, Err(e) => { let is404 = match e.kind() { &ErrorKind::Download(DEK::HttpStatus(404)) => true, + // 403 is what static.rlo returns for bogus URLs as of 2016/07/11 + &ErrorKind::Download(DEK::HttpStatus(403)) => true, &ErrorKind::Download(DEK::FileNotFound) => true, _ => false }; Err(e).chain_err(|| if is404 { - ErrorKind::Download404 { + ErrorKind::DownloadNotExists { url: url.clone(), path: path.to_path_buf(), }