Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dist: trusty
language: rust
cache: cargo
rust:
- nightly
- nightly-2019-01-09

env:
global:
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ environment:
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:
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ where
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,
}
Expand All @@ -279,7 +279,7 @@ where
url: url,
client: client,
interchange: PhantomData,
user_agent_prefix: None,
user_agent: None,
metadata_prefix: None,
min_bytes_per_second: 4096,
}
Expand All @@ -290,8 +290,8 @@ where
/// 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
}

Expand All @@ -313,9 +313,9 @@ where

/// 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 {
Expand Down