summaryrefslogtreecommitdiff
path: root/ext/websocket/lib.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2021-12-06 18:48:11 -0500
committerGitHub <noreply@github.com>2021-12-07 00:48:11 +0100
commita2f1357fe81fe212451567cc433c0e6b4a85edc5 (patch)
tree1e4267d9f6e6bb3ddbdf030b4d6d1c547a33b6be /ext/websocket/lib.rs
parentb91e6fd02f61ea34881226bc4b202e38ed75123e (diff)
chore: upgrade to rustls 0.20 (#12488)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'ext/websocket/lib.rs')
-rw-r--r--ext/websocket/lib.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index cf2ab6cac..13d3ddfca 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -20,25 +20,28 @@ use deno_core::Resource;
use deno_core::ResourceId;
use deno_core::ZeroCopyBuf;
use deno_tls::create_client_config;
-use deno_tls::webpki::DNSNameRef;
-
-use http::{Method, Request, Uri};
+use http::Method;
+use http::Request;
+use http::Uri;
use serde::Deserialize;
use serde::Serialize;
use std::borrow::Cow;
use std::cell::RefCell;
+use std::convert::TryFrom;
use std::fmt;
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
use tokio::net::TcpStream;
use tokio_rustls::rustls::RootCertStore;
+use tokio_rustls::rustls::ServerName;
use tokio_rustls::TlsConnector;
use tokio_tungstenite::client_async;
-use tokio_tungstenite::tungstenite::{
- handshake::client::Response, protocol::frame::coding::CloseCode,
- protocol::CloseFrame, protocol::Role, Message,
-};
+use tokio_tungstenite::tungstenite::handshake::client::Response;
+use tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode;
+use tokio_tungstenite::tungstenite::protocol::CloseFrame;
+use tokio_tungstenite::tungstenite::protocol::Message;
+use tokio_tungstenite::tungstenite::protocol::Role;
use tokio_tungstenite::MaybeTlsStream;
use tokio_tungstenite::WebSocketStream;
@@ -284,7 +287,7 @@ where
None,
)?;
let tls_connector = TlsConnector::from(Arc::new(tls_config));
- let dnsname = DNSNameRef::try_from_ascii_str(domain)
+ let dnsname = ServerName::try_from(domain.as_str())
.map_err(|_| invalid_hostname(domain))?;
let tls_socket = tls_connector.connect(dnsname, tcp_socket).await?;
MaybeTlsStream::Rustls(tls_socket)