refactor: make version and user_agent &'static str (#18400)

These caused a bunch of unnecessary allocations on each startup.
This commit is contained in:
Bartek Iwańczuk 2023-03-23 23:27:58 +01:00 committed by GitHub
parent edab8f2fd4
commit 275dee60e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 91 additions and 79 deletions

View file

@ -114,7 +114,7 @@ deno_core::extension!(deno_fetch,
state.put::<Options>(options.options.clone());
state.put::<reqwest::Client>({
create_http_client(
options.options.user_agent,
&options.options.user_agent,
options.options.root_cert_store,
vec![],
options.options.proxy,
@ -631,7 +631,7 @@ where
.collect::<Vec<_>>();
let client = create_http_client(
options.user_agent.clone(),
&options.user_agent,
options.root_cert_store.clone(),
ca_certs,
args.proxy,
@ -646,7 +646,7 @@ where
/// Create new instance of async reqwest::Client. This client supports
/// proxies and doesn't follow redirects.
pub fn create_http_client(
user_agent: String,
user_agent: &str,
root_cert_store: Option<RootCertStore>,
ca_certs: Vec<Vec<u8>>,
proxy: Option<Proxy>,