summaryrefslogtreecommitdiff
path: root/ext/net
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2024-06-13 21:41:26 +0100
committerGitHub <noreply@github.com>2024-06-13 22:41:26 +0200
commitfb31eaa9ca59f6daaee0210d5cd206185c7041b9 (patch)
tree0c4ebc81ed7b44b683f31281accc47d451d09718 /ext/net
parent518e4d3b3a93838e0f2dbcc4d3b79f8f395db563 (diff)
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)
This commit updates Deno to use `reqwest` at 0.12.4 and `rustls` at 0.22. Other related crates were updated as well to match versions accepted by `reqwest` and `rustls`. Note: we are not using the latest available `rustls` yet, but this upgrade was non-trivial already, so a bump to 0.23 for `rustls` will be done in a separate commit. Closes #23370 --------- Signed-off-by: Ryan Dahl <ry@tinyclouds.org> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'ext/net')
-rw-r--r--ext/net/ops_tls.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs
index c52985908..ccea8eb75 100644
--- a/ext/net/ops_tls.rs
+++ b/ext/net/ops_tls.rs
@@ -31,11 +31,11 @@ use deno_tls::create_client_config;
use deno_tls::load_certs;
use deno_tls::load_private_keys;
use deno_tls::new_resolver;
-use deno_tls::rustls::Certificate;
+use deno_tls::rustls::pki_types::ServerName;
use deno_tls::rustls::ClientConnection;
-use deno_tls::rustls::PrivateKey;
use deno_tls::rustls::ServerConfig;
-use deno_tls::rustls::ServerName;
+use deno_tls::webpki::types::CertificateDer;
+use deno_tls::webpki::types::PrivateKeyDer;
use deno_tls::ServerConfigProvider;
use deno_tls::SocketUse;
use deno_tls::TlsKey;
@@ -48,7 +48,6 @@ use serde::Deserialize;
use std::borrow::Cow;
use std::cell::RefCell;
use std::convert::From;
-use std::convert::TryFrom;
use std::fs::File;
use std::io::BufReader;
use std::io::ErrorKind;
@@ -304,14 +303,14 @@ where
{
let rid = args.rid;
let hostname = match &*args.hostname {
- "" => "localhost",
- n => n,
+ "" => "localhost".to_string(),
+ n => n.to_string(),
};
{
let mut s = state.borrow_mut();
let permissions = s.borrow_mut::<NP>();
- permissions.check_net(&(hostname, Some(0)), "Deno.startTls()")?;
+ permissions.check_net(&(&hostname, Some(0)), "Deno.startTls()")?;
}
let ca_certs = args
@@ -320,8 +319,8 @@ where
.map(|s| s.into_bytes())
.collect::<Vec<_>>();
- let hostname_dns =
- ServerName::try_from(hostname).map_err(|_| invalid_hostname(hostname))?;
+ let hostname_dns = ServerName::try_from(hostname.to_string())
+ .map_err(|_| invalid_hostname(&hostname))?;
let unsafely_ignore_certificate_errors = state
.borrow()
@@ -422,9 +421,9 @@ where
.borrow::<DefaultTlsOptions>()
.root_cert_store()?;
let hostname_dns = if let Some(server_name) = args.server_name {
- ServerName::try_from(server_name.as_str())
+ ServerName::try_from(server_name)
} else {
- ServerName::try_from(&*addr.hostname)
+ ServerName::try_from(addr.hostname.clone())
}
.map_err(|_| invalid_hostname(&addr.hostname))?;
let connect_addr = resolve_addr(&addr.hostname, addr.port)
@@ -466,7 +465,9 @@ where
Ok((rid, IpAddr::from(local_addr), IpAddr::from(remote_addr)))
}
-fn load_certs_from_file(path: &str) -> Result<Vec<Certificate>, AnyError> {
+fn load_certs_from_file(
+ path: &str,
+) -> Result<Vec<CertificateDer<'static>>, AnyError> {
let cert_file = File::open(path)?;
let reader = &mut BufReader::new(cert_file);
load_certs(reader)
@@ -474,7 +475,7 @@ fn load_certs_from_file(path: &str) -> Result<Vec<Certificate>, AnyError> {
fn load_private_keys_from_file(
path: &str,
-) -> Result<Vec<PrivateKey>, AnyError> {
+) -> Result<Vec<PrivateKeyDer<'static>>, AnyError> {
let key_bytes = std::fs::read(path)?;
load_private_keys(&key_bytes)
}
@@ -523,7 +524,6 @@ where
TlsKeys::Null => Err(anyhow!("Deno.listenTls requires a key")),
TlsKeys::Static(TlsKey(cert, key)) => {
let mut tls_config = ServerConfig::builder()
- .with_safe_defaults()
.with_no_client_auth()
.with_single_cert(cert, key)
.map_err(|e| anyhow!(e))?;