1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00
This commit is contained in:
snek 2025-01-20 23:27:15 +01:00 committed by GitHub
commit 95e32c3c66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 2 deletions

2
Cargo.lock generated
View file

@ -2421,8 +2421,10 @@ dependencies = [
"async-trait", "async-trait",
"deno_core", "deno_core",
"deno_error", "deno_error",
"deno_tls",
"http-body-util", "http-body-util",
"hyper 1.4.1", "hyper 1.4.1",
"hyper-rustls",
"hyper-util", "hyper-util",
"log", "log",
"once_cell", "once_cell",

View file

@ -17,8 +17,10 @@ path = "lib.rs"
async-trait.workspace = true async-trait.workspace = true
deno_core.workspace = true deno_core.workspace = true
deno_error.workspace = true deno_error.workspace = true
deno_tls.workspace = true
http-body-util.workspace = true http-body-util.workspace = true
hyper.workspace = true hyper.workspace = true
hyper-rustls.workspace = true
hyper-util.workspace = true hyper-util.workspace = true
log.workspace = true log.workspace = true
once_cell.workspace = true once_cell.workspace = true

View file

@ -477,10 +477,14 @@ mod hyper_client {
use std::task::Poll; use std::task::Poll;
use std::task::{self}; use std::task::{self};
use deno_tls::create_client_config;
use deno_tls::SocketUse;
use deno_tls::TlsKeys;
use http_body_util::BodyExt; use http_body_util::BodyExt;
use http_body_util::Full; use http_body_util::Full;
use hyper::body::Body as HttpBody; use hyper::body::Body as HttpBody;
use hyper::body::Frame; use hyper::body::Frame;
use hyper_rustls::HttpsConnector;
use hyper_util::client::legacy::connect::HttpConnector; use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::client::legacy::Client; use hyper_util::client::legacy::Client;
use opentelemetry_http::Bytes; use opentelemetry_http::Bytes;
@ -494,13 +498,23 @@ mod hyper_client {
// same as opentelemetry_http::HyperClient except it uses OtelSharedRuntime // same as opentelemetry_http::HyperClient except it uses OtelSharedRuntime
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct HyperClient { pub struct HyperClient {
inner: Client<HttpConnector, Body>, inner: Client<HttpsConnector<HttpConnector>, Body>,
} }
impl HyperClient { impl HyperClient {
pub fn new() -> Self { pub fn new() -> Self {
let tls_config = create_client_config(
None,
vec![],
None,
TlsKeys::Null,
SocketUse::Http,
)
.unwrap();
let http_connector = HttpConnector::new();
let connector = HttpsConnector::from((http_connector, tls_config));
Self { Self {
inner: Client::builder(OtelSharedRuntime).build(HttpConnector::new()), inner: Client::builder(OtelSharedRuntime).build(connector),
} }
} }
} }