diff options
author | Luca Casonato <hello@lcas.dev> | 2021-10-29 17:13:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 17:13:31 +0200 |
commit | b7341438f29de88f3458b32a835bfad560bda52e (patch) | |
tree | d58500fae822d3436bb513eb0c6cd9626048ab41 /ext/net/ops_tls.rs | |
parent | 8e0fd1dca1dbf5dd30595a859640067020506668 (diff) |
feat: stabilize Deno.startTls (#12581)
This commit stabilizes `Deno.startTls` and removes `certFile` from the
`StartTlsOptions`.
Diffstat (limited to 'ext/net/ops_tls.rs')
-rw-r--r-- | ext/net/ops_tls.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 129a702bc..93c2ca1e9 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -776,7 +776,6 @@ pub struct ConnectTlsArgs { #[serde(rename_all = "camelCase")] struct StartTlsArgs { rid: ResourceId, - cert_file: Option<String>, ca_certs: Vec<String>, hostname: String, } @@ -794,29 +793,19 @@ where "" => "localhost", n => n, }; - let cert_file = args.cert_file.as_deref(); + { - super::check_unstable2(&state, "Deno.startTls"); let mut s = state.borrow_mut(); let permissions = s.borrow_mut::<NP>(); permissions.check_net(&(hostname, Some(0)))?; - if let Some(path) = cert_file { - permissions.check_read(Path::new(path))?; - } } - let mut ca_certs = args + let ca_certs = args .ca_certs .into_iter() .map(|s| s.into_bytes()) .collect::<Vec<_>>(); - if let Some(path) = cert_file { - let mut buf = Vec::new(); - File::open(path)?.read_to_end(&mut buf)?; - ca_certs.push(buf); - }; - let hostname_dns = DNSNameRef::try_from_ascii_str(hostname) .map_err(|_| invalid_hostname(hostname))?; |