You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
The code that downloads from crates.io does not set the appropriate user-agent header. This causes crates.io to reject the request. Something like the following should fix it.
diff --git a/Cargo.toml b/Cargo.toml
index 9183fbf..47e6ed0 100644
--- a/Cargo.toml+++ b/Cargo.toml@@ -24,7 +24,8 @@ path = "src/bin/rust_semverver.rs"
[dependencies]
cargo = "0.32"
-crates-io = "0.20"+crates-io = "0.23"+curl = "0.4.21"
env_logger = "0.6"
failure = "0.1"
log = "0.4"
diff --git a/src/bin/cargo_semver.rs b/src/bin/cargo_semver.rs
index 82caf68..6e4ae28 100644
--- a/src/bin/cargo_semver.rs+++ b/src/bin/cargo_semver.rs@@ -8,6 +8,7 @@ extern crate serde_derive;
extern crate serde_json;
use cargo::core::{Package, PackageId, PackageSet, Source, SourceId, SourceMap, Workspace};
+use curl::easy::Easy;
use log::debug;
use std::{
env,
@@ -463,7 +464,10 @@ impl<'a> WorkInfo<'a> {
///
/// If no crate with the exact name is present, error out.
pub fn find_on_crates_io(crate_name: &str) -> Result<crates_io::Crate> {
- let mut registry = crates_io::Registry::new("https://crates.io".to_owned(), None);+ let mut handle = Easy::new();+ handle.useragent(&format!("rust-semverver {}", env!("CARGO_PKG_VERSION")))?;+ let mut registry =+ crates_io::Registry::new_handle("https://crates.io".to_owned(), None, handle);
registry
.search(crate_name, 1)
The text was updated successfully, but these errors were encountered:
Interesting, I never noticed any issues. Are new changes to crates.io the reason, or am I missing something else? Keep in mind, the build is still somewhat broken as of now, so that part of the crate is currently untested.
Regardless, I'll include your suggested changes, thanks alot!
The code that downloads from crates.io does not set the appropriate user-agent header. This causes crates.io to reject the request. Something like the following should fix it.
The text was updated successfully, but these errors were encountered: