Skip to content

Commit 71e996e

Browse files
committed
Auto merge of #3485 - sfackler:useragent, r=alexcrichton
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. r? @alexcrichton
2 parents c95b873 + ae2b598 commit 71e996e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cargo/ops/registry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use term::color::BLACK;
1212

1313
use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET};
1414

15+
use version;
1516
use core::source::Source;
1617
use core::{Package, SourceId, Workspace};
1718
use core::dependency::Kind;
@@ -196,6 +197,7 @@ pub fn http_handle(config: &Config) -> CargoResult<Easy> {
196197
handle.connect_timeout(Duration::new(30, 0))?;
197198
handle.low_speed_limit(10 /* bytes per second */)?;
198199
handle.low_speed_time(Duration::new(30, 0))?;
200+
handle.useragent(&version())?;
199201
if let Some(proxy) = http_proxy(config)? {
200202
handle.proxy(&proxy)?;
201203
}

0 commit comments

Comments
 (0)