Skip to content

Commit 009e6df

Browse files
committed
Update wasmtime-wasi-http integration to use version 43.0.0 API changes
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent a22f4a7 commit 009e6df

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/hyperlight_sandbox/src/http.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub async fn send_http_request(req: HttpRequest) -> Result<HttpResponse> {
115115
let (hyper_request, use_tls) = build_hyper_request(req)?;
116116

117117
let timeout = Duration::from_secs(REQUEST_TIMEOUT_SECS);
118-
let config = wasmtime_wasi_http::types::OutgoingRequestConfig {
118+
let config = wasmtime_wasi_http::p2::types::OutgoingRequestConfig {
119119
use_tls,
120120
connect_timeout: timeout,
121121
first_byte_timeout: timeout,
@@ -124,18 +124,20 @@ pub async fn send_http_request(req: HttpRequest) -> Result<HttpResponse> {
124124

125125
// Convert our body error type to wasmtime's ErrorCode at the boundary.
126126
let (parts, body) = hyper_request.into_parts();
127-
let wasi_body: wasmtime_wasi_http::body::HyperOutgoingBody = body
127+
let wasi_body: wasmtime_wasi_http::p2::body::HyperOutgoingBody = body
128128
.map_err(|e| {
129-
wasmtime_wasi_http::bindings::http::types::ErrorCode::InternalError(Some(e.to_string()))
129+
wasmtime_wasi_http::p2::bindings::http::types::ErrorCode::InternalError(Some(
130+
e.to_string(),
131+
))
130132
})
131133
.boxed_unsync();
132134
let hyper_request = hyper::Request::from_parts(parts, wasi_body);
133135

134-
let incoming = wasmtime_wasi_http::types::default_send_request_handler(hyper_request, config)
136+
let incoming = wasmtime_wasi_http::p2::default_send_request_handler(hyper_request, config)
135137
.await
136138
.map_err(|e| anyhow::anyhow!("HTTP request failed: {e:?}"))?;
137139

138-
let wasmtime_wasi_http::types::IncomingResponse {
140+
let wasmtime_wasi_http::p2::types::IncomingResponse {
139141
resp,
140142
worker: _worker,
141143
between_bytes_timeout,
@@ -211,7 +213,7 @@ fn cap_response_headers(raw: &http::HeaderMap) -> HashMap<String, String> {
211213

212214
/// Collect a hyper response body up to [`MAX_RESPONSE_BYTES`].
213215
async fn collect_response_body(
214-
mut body: wasmtime_wasi_http::body::HyperIncomingBody,
216+
mut body: wasmtime_wasi_http::p2::body::HyperIncomingBody,
215217
between_bytes_timeout: Duration,
216218
) -> Result<Vec<u8>> {
217219
let mut body_bytes = Vec::new();

0 commit comments

Comments
 (0)