A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
wasi-http: consume the owned request-options in outgoing-handler.handle (#14603)
Xia Chao720a547aa18e
diff --git a/crates/wasi-http/src/p2/http_impl.rs b/crates/wasi-http/src/p2/http_impl.rsindex d9b52124a9..ae21f17952 100644--- a/crates/wasi-http/src/p2/http_impl.rs+++ b/crates/wasi-http/src/p2/http_impl.rs@@ -23,7 +23,12 @@ impl outgoing_handler::Host for WasiHttpCtxView<'_> {request_id: Resource<HostOutgoingRequest>,options: Option<Resource<types::RequestOptions>>,) -> HttpResult<Resource<HostFutureIncomingResponse>> {- let opts = options.and_then(|opts| self.table.get(&opts).ok()).cloned();+ // `options` is an `own` parameter (`outgoing-handler.handle` takes ownership of it, per+ // `wasi:http` types.wit), so it must be consumed from the table like `request` below.+ let opts = match options {+ Some(id) => Some(self.table.delete(id)?),+ None => None,+ };let req = self.table.delete(request_id)?;let mut builder = hyper::Request::builder();