diff --git a/crates/wasi-http/Cargo.toml b/crates/wasi-http/Cargo.toml index 996b5ec67012..a8fe9548edb6 100644 --- a/crates/wasi-http/Cargo.toml +++ b/crates/wasi-http/Cargo.toml @@ -19,7 +19,7 @@ http-body-util = "0.1.0-rc.2" thiserror = { workspace = true } wasmtime = { workspace = true, features = ['component-model'] } -[target.'cfg(not(target_arch = "riscv64gc"))'.dependencies] +[target.'cfg(not(any(target_arch = "riscv64gc", target_arch = "s390x")))'.dependencies] tokio-rustls = { version = "0.24.0" } rustls = { version = "0.21.0" } webpki-roots = { version = "0.23.0" } diff --git a/crates/wasi-http/src/http_impl.rs b/crates/wasi-http/src/http_impl.rs index cbef4b729197..1a8990efa68e 100644 --- a/crates/wasi-http/src/http_impl.rs +++ b/crates/wasi-http/src/http_impl.rs @@ -1,21 +1,21 @@ use crate::r#struct::ActiveResponse; pub use crate::r#struct::WasiHttp; use crate::types::{RequestOptions, Scheme}; +#[cfg(not(any(target_arch = "riscv64gc", target_arch = "s390x")))] +use anyhow::anyhow; use anyhow::bail; use bytes::{BufMut, Bytes, BytesMut}; use http_body_util::{BodyExt, Full}; use hyper::Method; use hyper::Request; +#[cfg(not(any(target_arch = "riscv64gc", target_arch = "s390x")))] +use std::sync::Arc; use std::time::Duration; use tokio::net::TcpStream; use tokio::runtime::Runtime; use tokio::time::timeout; -#[cfg(not(target_arch = "riscv64gc"))] -use std::sync::Arc; -#[cfg(not(target_arch = "riscv64gc"))] +#[cfg(not(any(target_arch = "riscv64gc", target_arch = "s390x")))] use tokio_rustls::rustls::{self, OwnedTrustAnchor}; -#[cfg(not(target_arch = "riscv64gc"))] -use anyhow::anyhow; impl crate::default_outgoing_http::Host for WasiHttp { fn handle( @@ -105,7 +105,7 @@ impl WasiHttp { None => request.authority.clone() + port_for_scheme(&request.scheme), }; let mut sender = if scheme == "https://" { - #[cfg(not(target_arch = "riscv64gc"))] + #[cfg(not(any(target_arch = "riscv64gc", target_arch = "s390x")))] { let stream = TcpStream::connect(authority.clone()).await?; //TODO: uncomment this code and make the tls implementation a feature decision. @@ -116,15 +116,15 @@ impl WasiHttp { // derived from https://github.com/tokio-rs/tls/blob/master/tokio-rustls/examples/client/src/main.rs let mut root_cert_store = rustls::RootCertStore::empty(); - root_cert_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map( - |ta| { + root_cert_store.add_server_trust_anchors( + webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| { OwnedTrustAnchor::from_subject_spki_name_constraints( ta.subject, ta.spki, ta.name_constraints, ) - }, - )); + }), + ); let config = rustls::ClientConfig::builder() .with_safe_defaults() .with_root_certificates(root_cert_store) @@ -149,7 +149,7 @@ impl WasiHttp { }); s } - #[cfg(target_arch = "riscv64gc")] + #[cfg(any(target_arch = "riscv64gc", target_arch = "s390x"))] bail!("unsupported architecture for SSL") } else { let tcp = TcpStream::connect(authority).await?;