Skip to content

Commit

Permalink
prtest:full
Browse files Browse the repository at this point in the history
Fix formatting, also disable tls on s390x
  • Loading branch information
brendandburns committed Apr 5, 2023
1 parent 8caa666 commit 6d6feeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/wasi-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
22 changes: 11 additions & 11 deletions crates/wasi-http/src/http_impl.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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?;
Expand Down

0 comments on commit 6d6feeb

Please sign in to comment.