Merge pull request #170 from erickt/ua
Don't include the version of rust-tuf in the user agent
diff --git a/.travis.yml b/.travis.yml
index 6f98dd7..e58355c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@
language: rust
cache: cargo
rust:
- - nightly
+ - nightly-2019-01-09
env:
global:
diff --git a/appveyor.yml b/appveyor.yml
index 0348f0d..87a08fd 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -12,11 +12,11 @@
matrix:
# Rust - Nightly
- TARGET: i686-pc-windows-gnu
- RUST_VERSION: nightly
+ RUST_VERSION: nightly-2019-01-09
BITS: 32
MSYS2: 1
- TARGET: x86_64-pc-windows-msvc
- RUST_VERSION: nightly
+ RUST_VERSION: nightly-2019-01-09
BITS: 64
install:
diff --git a/src/client.rs b/src/client.rs
index a4032ad..bffcf92 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -33,7 +33,7 @@
//! url::Url::parse("https://static.rust-lang.org/").unwrap(),
//! HttpClient::new(),
//! )
-//! .user_agent_prefix("rustup/1.4.0")
+//! .user_agent("rustup/1.4.0")
//! .build();
//!
//! let mut client = await!(Client::with_root_pinned(
diff --git a/src/repository.rs b/src/repository.rs
index 5d1babc..dfa68ba 100644
--- a/src/repository.rs
+++ b/src/repository.rs
@@ -263,7 +263,7 @@
url: Url,
client: Client<C>,
interchange: PhantomData<D>,
- user_agent_prefix: Option<String>,
+ user_agent: Option<String>,
metadata_prefix: Option<Vec<String>>,
min_bytes_per_second: u32,
}
@@ -279,7 +279,7 @@
url: url,
client: client,
interchange: PhantomData,
- user_agent_prefix: None,
+ user_agent: None,
metadata_prefix: None,
min_bytes_per_second: 4096,
}
@@ -290,8 +290,8 @@
/// Callers *should* include a custom User-Agent prefix to help maintainers of TUF repositories
/// keep track of which client versions exist in the field.
///
- pub fn user_agent_prefix<T: Into<String>>(mut self, user_agent_prefix: T) -> Self {
- self.user_agent_prefix = Some(user_agent_prefix.into());
+ pub fn user_agent<T: Into<String>>(mut self, user_agent: T) -> Self {
+ self.user_agent = Some(user_agent.into());
self
}
@@ -313,9 +313,9 @@
/// Build a `HttpRepository`.
pub fn build(self) -> HttpRepository<C, D> {
- let user_agent = match self.user_agent_prefix {
- Some(ua) => format!("{} (rust-tuf/{})", ua, env!("CARGO_PKG_VERSION")),
- None => format!("rust-tuf/{}", env!("CARGO_PKG_VERSION")),
+ let user_agent = match self.user_agent {
+ Some(user_agent) => user_agent,
+ None => "rust-tuf".into(),
};
HttpRepository {