Skip to content

Commit 1eddaa7

Browse files
remove additional header, send_analytics in user_agent
1 parent e980ff6 commit 1eddaa7

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/about.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ pub fn get_latest_release() -> &'static Option<LatestRelease> {
7171
}
7272

7373
// User Agent for Download API call
74-
// Format: Parseable/<UID>/<version>/<commit_hash> (<OS>; <Platform>)
75-
pub fn user_agent(uid: &Ulid) -> String {
74+
// Format: Parseable/<UID>/<version>/<commit_hash>/<send_analytics> (<OS>; <Platform>)
75+
pub fn user_agent(uid: &Ulid, send_analytics: bool) -> String {
7676
analytics::refresh_sys_info();
7777
format!(
78-
"Parseable/{}/{}/{} ({:?}; {})",
78+
"Parseable/{}/{}/{}/{} ({:?}; {})",
7979
uid,
8080
current().released_version,
8181
current().commit_hash,
82+
send_analytics,
8283
System::name().unwrap_or_default(),
8384
platform()
8485
)

src/utils/update.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::time::Duration;
2020

2121
use anyhow::anyhow;
2222
use chrono::{DateTime, Utc};
23-
use http::header;
2423

2524
use crate::{about, parseable::PARSEABLE};
2625

@@ -33,15 +32,9 @@ pub struct LatestRelease {
3332
}
3433

3534
pub async fn get_latest(deployment_id: &uid::Uid) -> Result<LatestRelease, anyhow::Error> {
36-
let send_analytics = PARSEABLE.options.send_analytics.to_string();
37-
let mut headers = header::HeaderMap::new();
38-
headers.insert(
39-
"P_SEND_ANONYMOUS_USAGE_DATA",
40-
header::HeaderValue::from_str(send_analytics.as_str()).expect("valid header value"),
41-
);
35+
let send_analytics = PARSEABLE.options.send_analytics;
4236
let agent = reqwest::ClientBuilder::new()
43-
.user_agent(about::user_agent(deployment_id))
44-
.default_headers(headers)
37+
.user_agent(about::user_agent(deployment_id, send_analytics))
4538
.timeout(Duration::from_secs(8))
4639
.build()
4740
.expect("client can be built on this system");

0 commit comments

Comments
 (0)