Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Sep 15, 2023
1 parent 11f0ccf commit c911a1c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ ring = "=0.16.20"
rusqlite = { version = "=0.29.0", features = ["unlock_notify", "bundled"] }
rustls = "0.21.0"
rustls-pemfile = "1.0.0"
rustls-tokio-stream = "0"
rustls-webpki = "0.101.4"
rustls-native-certs = "0.6.2"
webpki-roots = "0.25.2"
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/websocket_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Deno.test("websocket error", async () => {
// Error message got changed because we don't use warp in test_util
assertEquals(
err.message,
"InvalidData: received corrupt message of type InvalidContentType",
"InvalidData: invalid data",
);
promise1.resolve();
};
Expand Down
3 changes: 2 additions & 1 deletion ext/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fastwebsockets = { workspace = true, features = ["upgrade"] }
http.workspace = true
hyper = { workspace = true, features = ["backports"] }
once_cell.workspace = true
rustls.workspace = true
rustls-tokio-stream.workspace = true
serde.workspace = true
tokio.workspace = true
tokio-rustls.workspace = true
12 changes: 6 additions & 6 deletions ext/websocket/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ use std::sync::Arc;
use tokio::io::AsyncRead;
use tokio::io::AsyncWrite;
use tokio::net::TcpStream;
use tokio_rustls::rustls::RootCertStore;
use tokio_rustls::rustls::ServerName;
use tokio_rustls::TlsConnector;
use rustls::RootCertStore;
use rustls::ServerName;
use rustls_tokio_stream::TlsStream;

use fastwebsockets::CloseCode;
use fastwebsockets::FragmentCollector;
Expand Down Expand Up @@ -278,11 +278,11 @@ where
unsafely_ignore_certificate_errors,
None,
)?;
let tls_connector = TlsConnector::from(Arc::new(tls_config));
let dnsname = ServerName::try_from(domain.as_str())
.map_err(|_| invalid_hostname(domain))?;
let tls_socket = tls_connector.connect(dnsname, tcp_socket).await?;
handshake(cancel_resource, request, tls_socket).await?
let mut tls_connector = TlsStream::new_client_side(tcp_socket, tls_config.into(), dnsname);
let _hs = tls_connector.handshake().await?;
handshake(cancel_resource, request, tls_connector).await?
}
_ => unreachable!(),
};
Expand Down

0 comments on commit c911a1c

Please sign in to comment.