Skip to content

Commit d79fdf3

Browse files
committed
Auto merge of #13548 - Turbo87:user-agent, r=weihanglo
util/network/http: Use `cargo/1.2.3` user-agent header ... instead of `cargo 1.2.3`. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent#syntax declares that the product and product version are usually separated by a slash. This commit changes the cargo `User-Agent` header to follow that syntax instead of using whitespace for the separator.
2 parents 29cf016 + c1f5fa6 commit d79fdf3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cargo/util/network/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn configure_http_handle(gctx: &GlobalContext, handle: &mut Easy) -> CargoRe
7474
if let Some(user_agent) = &http.user_agent {
7575
handle.useragent(user_agent)?;
7676
} else {
77-
handle.useragent(&format!("cargo {}", version()))?;
77+
handle.useragent(&format!("cargo/{}", version()))?;
7878
}
7979

8080
fn to_ssl_version(s: &str) -> CargoResult<SslVersion> {

src/doc/src/reference/registry-web-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Cargo sets the following headers for all requests:
4242

4343
- `Content-Type`: `application/json` (for requests with a body payload)
4444
- `Accept`: `application/json`
45-
- `User-Agent`: The Cargo version such as `cargo 1.32.0 (8610973aa
45+
- `User-Agent`: The Cargo version such as `cargo/1.32.0 (8610973aa
4646
2019-01-02)`. This may be modified by the user in a configuration value.
4747
Added in 1.29.
4848

0 commit comments

Comments
 (0)