Blob Blame History Raw
diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs
index abdce22..402a5b5 100644
--- a/src/cargo/ops/registry.rs
+++ b/src/cargo/ops/registry.rs
@@ -11,6 +11,7 @@ use crates_io::{self, NewCrate, NewCrateDependency, Registry};
 use curl::easy::{Easy, InfoType, SslOpt, SslVersion};
 use log::{log, Level};
 use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
+use url::Url;
 
 use crate::core::dependency::DepKind;
 use crate::core::manifest::ManifestMetadata;
@@ -25,6 +26,14 @@ use crate::util::IntoUrl;
 use crate::util::{paths, validate_package_name};
 use crate::{drop_print, drop_println, version};
 
+// FIXME: This function vanished between crates-io 0.31.1 and 0.32.0 but is still in git master ?!
+/// Returns `true` if the host of the given URL is "crates.io".
+fn is_url_crates_io(url: &str) -> bool {
+    Url::parse(url)
+        .map(|u| u.host_str() == Some("crates.io"))
+        .unwrap_or(false)
+}
+
 /// Registry settings loaded from config files.
 ///
 /// This is loaded based on the `--registry` flag and the config settings.
@@ -443,7 +452,7 @@ fn registry(
             // hopefully that's a relatively small set of users.
             if registry.is_none()
                 && !sid.is_default_registry()
-                && !crates_io::is_url_crates_io(&api_host)
+                && !is_url_crates_io(&api_host)
             {
                 if validate_token {
                     config.shell().warn(