Skip to content

Commit 25a6976

Browse files
chore: add .use_rustls_tls() for our reqwest client builders for added safety
1 parent 497b2d2 commit 25a6976

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

bottlecap/src/bin/bottlecap/main.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,16 @@ async fn main() -> Result<()> {
230230
let version_without_next = EXTENSION_VERSION.split('-').next().unwrap_or("NA");
231231
debug!("Starting Datadog Extension {version_without_next}");
232232
prepare_client_provider()?;
233-
let client = Client::builder().no_proxy().build().map_err(|e| {
234-
Error::new(
235-
std::io::ErrorKind::InvalidData,
236-
format!("Failed to create client: {e:?}"),
237-
)
238-
})?;
233+
let client = Client::builder()
234+
.use_rustls_tls()
235+
.no_proxy()
236+
.build()
237+
.map_err(|e| {
238+
Error::new(
239+
std::io::ErrorKind::InvalidData,
240+
format!("Failed to create client: {e:?}"),
241+
)
242+
})?;
239243

240244
let r = register(&client)
241245
.await

bottlecap/src/http_client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn get_client(config: Arc<config::Config>) -> reqwest::Client {
1717

1818
fn build_client(config: Arc<config::Config>) -> Result<reqwest::Client, reqwest::Error> {
1919
let client = reqwest::Client::builder()
20+
.use_rustls_tls()
2021
.timeout(Duration::from_secs(config.flush_timeout))
2122
// Temporarily not force http2
2223
// Enable HTTP/2 for better multiplexing

bottlecap/src/telemetry/client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ impl TelemetryApiClient {
2020
pub async fn subscribe(&self) -> Result<Response, Box<dyn Error>> {
2121
let url = base_url(TELEMETRY_SUBSCRIPTION_ROUTE)?;
2222
let resp = reqwest::Client::builder()
23+
.use_rustls_tls()
2324
.no_proxy()
2425
.build()
2526
.map_err(|e| {

0 commit comments

Comments
 (0)