Skip to content

Commit 6b0c597

Browse files
committed
Fix test on Windows' SChannel
Same reason as described in bytecodealliance#11064
1 parent a1ddc55 commit 6b0c597

1 file changed

Lines changed: 17 additions & 27 deletions

File tree

crates/test-programs/src/bin/p3_tls_sample_application.rs

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::{Context as _, Result, anyhow};
22
use core::future::Future;
3-
use futures::try_join;
43
use test_programs::p3::wasi::sockets::ip_name_lookup::resolve_addresses;
54
use test_programs::p3::wasi::sockets::types::{IpAddress, IpSocketAddress, TcpSocket};
65
use test_programs::p3::wasi::tls::client::Connector;
@@ -31,32 +30,23 @@ async fn test_tls_sample_application(domain: &str, ip: IpAddress) -> Result<()>
3130
let (tls_tx, tls_tx_err_fut) = conn.send(data_rx);
3231
let sock_tx_fut = sock.send(tls_tx);
3332

34-
try_join!(
35-
async {
36-
Connector::connect(conn, domain.into())
37-
.await
38-
.context("handshake failed")
39-
},
40-
async {
41-
let buf = data_tx.write_all(request.into()).await;
42-
assert!(buf.is_empty());
43-
drop(data_tx);
44-
Ok(())
45-
},
46-
async {
47-
let response = tls_rx.collect().await;
48-
let response = String::from_utf8(response)?;
49-
if response.contains("HTTP/1.1 200 OK") {
50-
Ok(())
51-
} else {
52-
Err(anyhow!("server did not respond with 200 OK: {response}"))
53-
}
54-
},
55-
async { sock_rx_fut.await.context("failed to receive ciphertext") },
56-
async { sock_tx_fut.await.context("failed to send ciphertext") },
57-
async { tls_rx_fut.await.context("failed to receive plaintext") },
58-
async { tls_tx_err_fut.await.context("failed to send plaintext") },
59-
)?;
33+
Connector::connect(conn, domain.into())
34+
.await
35+
.context("tls handshake failed")?;
36+
let buf = data_tx.write_all(request.into()).await;
37+
assert!(buf.is_empty());
38+
39+
let response = tls_rx.collect().await;
40+
let response = String::from_utf8(response)?;
41+
if !response.contains("HTTP/1.1 200 OK") {
42+
return Err(anyhow!("server did not respond with 200 OK: {response}"));
43+
}
44+
drop(data_tx);
45+
sock_rx_fut.await.context("tcp recv")?;
46+
sock_tx_fut.await.context("tcp send")?;
47+
tls_rx_fut.await.context("tls recv")?;
48+
tls_tx_err_fut.await.context("tls send")?;
49+
6050
Ok(())
6151
}
6252

0 commit comments

Comments
 (0)