Merge pull request #152 from passcod/warn-on-http

Warn on non-HTTPS URLs
This commit is contained in:
Félix Saparelli 2022-06-01 01:11:01 +12:00 committed by GitHub
commit 13a8e1e5fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
use std::path::Path; use std::path::Path;
use log::{debug, info}; use log::{debug, info, warn};
use reqwest::Method; use reqwest::Method;
use serde::Serialize; use serde::Serialize;
use url::Url; use url::Url;
@ -28,6 +28,11 @@ impl super::Fetcher for GhCrateMeta {
async fn check(&self) -> Result<bool, BinstallError> { async fn check(&self) -> Result<bool, BinstallError> {
let url = self.url()?; let url = self.url()?;
if url.scheme() != "https" {
warn!("URL is not HTTPS! This may become a hard error in the future, tell the upstream!");
}
info!("Checking for package at: '{url}'"); info!("Checking for package at: '{url}'");
remote_exists(url.as_str(), Method::HEAD).await remote_exists(url.as_str(), Method::HEAD).await
} }