From: Steven Fackler Date: Mon, 2 Jan 2017 03:35:30 +0000 (-0800) Subject: Set a user agent with the version when talking to the registry X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~11^2~57^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ae2b5980e09acae5b4856143ed2a47ed4ffdc613;p=cargo.git Set a user agent with the version when talking to the registry This can be used to track what versions of Cargo are being used in the wild, which can be very useful. --- diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index d937976f8..58b2894cd 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -12,6 +12,7 @@ use term::color::BLACK; use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET}; +use version; use core::source::Source; use core::{Package, SourceId, Workspace}; use core::dependency::Kind; @@ -196,6 +197,7 @@ pub fn http_handle(config: &Config) -> CargoResult { handle.connect_timeout(Duration::new(30, 0))?; handle.low_speed_limit(10 /* bytes per second */)?; handle.low_speed_time(Duration::new(30, 0))?; + handle.useragent(&version())?; if let Some(proxy) = http_proxy(config)? { handle.proxy(&proxy)?; }