Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
438 changes: 186 additions & 252 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ wac-types = "0.11.0"
wasm-pkg-client = "0.11"
wasm-pkg-common = "0.11"
# Dependencies from bytecodealliance/wasmtime
wasmtime = "50.0.2"
wasmtime-wasi = { version = "50.0.2", features = ["p3"] }
wasmtime-wasi-http = { version = "50.0.2", features = ["p3", "component-model-async"] }
wasmtime = "51.0.0"
wasmtime-wasi = { version = "51.0.0", features = ["p3"] }
wasmtime-wasi-http = { version = "51.0.0", features = ["p3", "component-model-async"] }
# Dependencies from bytecodealliance/wasm-tools
wasm-encoder = "0.262.0"
wasm-metadata = "0.262.0"
wasmparser = "0.262.0"
wit-component = "0.262.0"
wit-parser = "0.262.0"
wasm-encoder = "0.263.0"
wasm-metadata = "0.263.0"
wasmparser = "0.263.0"
wit-component = "0.263.0"
wit-parser = "0.263.0"

spin-componentize = { path = "crates/componentize" }

Expand Down
5 changes: 3 additions & 2 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ fn use_pooling_allocator_by_default() -> bool {
let mut store = wasmtime::Store::new(&engine, ());
// NB: the maximum size is in wasm pages so take out the 16-bits
// of wasm page size here from the maximum size.
let ty = wasmtime::MemoryType::new64(0, Some(1 << (BITS_TO_TEST - 16)));
wasmtime::Memory::new(&mut store, ty).is_ok()
wasmtime::MemoryType::new64(0, Some(1 << (BITS_TO_TEST - 16)))
.and_then(|ty| wasmtime::Memory::new(&mut store, ty))
.is_ok()
}
Err(_) => {
tracing::debug!(
Expand Down
8 changes: 8 additions & 0 deletions crates/factor-outbound-http/src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ impl RequestSender {
// Note that we do this _before_ invoking the request interceptor. It may
// decide to add the `host` header back in, regardless of the nginx bug, in
// which case we'll let it do so without interferring.
//
// TODO: This is invalid for HTTP/1.x requests, which require a `host`
// header, but as of this writing there's no way for us to do it only
// for HTTP/2 requests without e.g. forking `hyper-util` since we give
// up ownership of the request when we pass it to `Client::request`, and
// that happens before ALPN negotiation determines the protocol version.
// We could fork or replace `hyper-util`, but neither option is
// appealing at this time.
request.headers_mut().remove(HOST);
Ok(())
}
Expand Down
11 changes: 9 additions & 2 deletions crates/trigger-http/src/outbound_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
sync::Arc,
};

use http::uri::Scheme;
use http::{uri::Scheme, version::Version};
use spin_core::async_trait;
use spin_factor_outbound_http::intercept::{self, InterceptOutcome, InterceptRequest};
use spin_factor_outbound_networking::config::allowed_hosts::parse_service_chaining_target;
Expand Down Expand Up @@ -32,7 +32,14 @@ impl<F: RuntimeFactors> intercept::OutboundHttpInterceptor for OutboundHttpInter
async fn intercept(&self, request: InterceptRequest) -> HttpResult<InterceptOutcome> {
// Handle service chaining requests
if let Some(component_id) = parse_service_chaining_target(request.uri()) {
let req = request.into_hyper_request();
let mut req = request.into_hyper_request();
// `wasmtime-wasi-http` 51.0.0 and later requires HTTP/1.x requests
// to have `host` headers, but we strip them out in
// `spin_factor_outbound_http::wasi::RequestSender::prepare_request`
// to work around an `nginx` bug (see the code comment in that
// function). Setting the version to HTTP/2 here avoids that
// requirement.
*req.version_mut() = Version::HTTP_2;
let path = req.uri().path().to_owned();
let route_match = RouteMatch::synthetic(component_id, path);
let resp = self
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-async/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<D, T: Send + Sync + 'static> wasmtime::component::StreamProducer<D> for Str
use std::task::Poll;
use wasmtime::component::StreamResult;

let remaining = destination.remaining(store);
let remaining = destination.remaining(store)?;
if remaining.is_some_and(|r| r == 0) {
return Poll::Ready(Ok(StreamResult::Completed));
}
Expand Down
Loading
Loading