Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 0f3b002

Browse files
dicejrvolosatovs
authored andcommitted
fix rebase breakage
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 1538d09 commit 0f3b002

File tree

7 files changed

+113
-86
lines changed

7 files changed

+113
-86
lines changed

crates/wasi-http/src/p3/body.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use core::task::{ready, Context, Poll};
66
use anyhow::Context as _;
77
use bytes::Bytes;
88
use http::HeaderMap;
9-
use http_body_util::{combinators::BoxBody, BodyExt as _};
9+
use http_body_util::{combinators::UnsyncBoxBody, BodyExt as _};
1010
use tokio::sync::oneshot;
1111
use wasmtime::{
1212
component::{AbortOnDropHandle, ErrorContext, FutureWriter, Resource, StreamReader},
@@ -20,7 +20,6 @@ pub(crate) type OutgoingContentsStreamFuture = Pin<
2020
Box<
2121
dyn Future<Output = Result<(StreamReader<Bytes>, Bytes), Option<ErrorContext>>>
2222
+ Send
23-
+ Sync
2423
+ 'static,
2524
>,
2625
>;
@@ -33,7 +32,6 @@ pub(crate) type OutgoingTrailerFuture = Pin<
3332
Option<ErrorContext>,
3433
>,
3534
> + Send
36-
+ Sync
3735
+ 'static,
3836
>,
3937
>;
@@ -45,7 +43,6 @@ pub(crate) type OutgoingTrailerFutureMut<'a> = Pin<
4543
Option<ErrorContext>,
4644
>,
4745
> + Send
48-
+ Sync
4946
+ 'static),
5047
>;
5148

@@ -77,7 +74,7 @@ pub enum Body {
7774
/// Body constructed by the host
7875
Host {
7976
/// Underlying body stream
80-
stream: Option<BoxBody<Bytes, ErrorCode>>,
77+
stream: Option<UnsyncBoxBody<Bytes, ErrorCode>>,
8178
/// Buffered frame, if any
8279
buffer: Option<BodyFrame>,
8380
},
@@ -89,19 +86,23 @@ impl Body {
8986
/// Construct a new [Body]
9087
pub fn new<T>(body: T) -> Self
9188
where
92-
T: http_body::Body<Data = Bytes> + Send + Sync + 'static,
89+
T: http_body::Body<Data = Bytes> + Send + 'static,
9390
T::Error: Into<ErrorCode>,
9491
{
9592
Self::Host {
96-
stream: Some(body.map_err(Into::into).boxed()),
93+
stream: Some(body.map_err(Into::into).boxed_unsync()),
9794
buffer: None,
9895
}
9996
}
10097

10198
/// Construct a new empty [Body]
10299
pub fn empty() -> Self {
103100
Self::Host {
104-
stream: Some(http_body_util::Empty::new().map_err(Into::into).boxed()),
101+
stream: Some(
102+
http_body_util::Empty::new()
103+
.map_err(Into::into)
104+
.boxed_unsync(),
105+
),
105106
buffer: None,
106107
}
107108
}

crates/wasi-http/src/p3/client.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub trait Client: Clone + Send + Sync {
8282
fn send_request(
8383
&mut self,
8484
request: http::Request<
85-
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + Sync + 'static,
85+
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + 'static,
8686
>,
8787
options: Option<RequestOptions>,
8888
) -> impl Future<
@@ -94,20 +94,17 @@ pub trait Client: Clone + Send + Sync {
9494
http::Response<
9595
impl http_body::Body<Data = Bytes, Error = Self::Error>
9696
+ Send
97-
+ Sync
9897
+ 'static,
9998
>,
10099
ErrorCode,
101100
>,
102-
> + Send
103-
+ Sync,
104-
impl Future<Output = Result<(), Self::Error>> + Send + Sync + 'static,
101+
> + Send,
102+
impl Future<Output = Result<(), Self::Error>> + Send + 'static,
105103
),
106104
ErrorCode,
107105
>,
108106
>,
109-
> + Send
110-
+ Sync;
107+
> + Send;
111108
}
112109

113110
/// Default HTTP client
@@ -120,7 +117,7 @@ impl Client for DefaultClient {
120117
async fn send_request(
121118
&mut self,
122119
request: http::Request<
123-
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + Sync + 'static,
120+
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + 'static,
124121
>,
125122
options: Option<RequestOptions>,
126123
) -> wasmtime::Result<
@@ -177,7 +174,7 @@ impl http_body::Body for IncomingBody {
177174
/// default implementation.
178175
pub async fn default_send_request(
179176
mut request: http::Request<
180-
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + Sync + 'static,
177+
impl http_body::Body<Data = Bytes, Error = Option<ErrorCode>> + Send + 'static,
181178
>,
182179
options: Option<RequestOptions>,
183180
) -> Result<

crates/wasi-http/src/p3/host/handle.rs

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ where
135135
}));
136136
let task = task.abort_handle();
137137
match response.await {
138-
Ok(response) => {
139-
(response.map(|body| body.map_err(Into::into).boxed()), task)
140-
}
138+
Ok(response) => (
139+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
140+
task,
141+
),
141142
Err(err) => return Ok(Err(err)),
142143
}
143144
}
@@ -165,9 +166,10 @@ where
165166
}));
166167
let task = task.abort_handle();
167168
match response.await {
168-
Ok(response) => {
169-
(response.map(|body| body.map_err(Into::into).boxed()), task)
170-
}
169+
Ok(response) => (
170+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
171+
task,
172+
),
171173
Err(err) => return Ok(Err(err)),
172174
}
173175
}
@@ -211,9 +213,10 @@ where
211213
eprintln!("[host] return Ok response");
212214
let task = task.abort_handle();
213215
match response.await {
214-
Ok(response) => {
215-
(response.map(|body| body.map_err(Into::into).boxed()), task)
216-
}
216+
Ok(response) => (
217+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
218+
task,
219+
),
217220
Err(err) => return Ok(Err(err)),
218221
}
219222
}
@@ -256,9 +259,10 @@ where
256259
eprintln!("[host] return Ok response");
257260
let task = task.abort_handle();
258261
match response.await {
259-
Ok(response) => {
260-
(response.map(|body| body.map_err(Into::into).boxed()), task)
261-
}
262+
Ok(response) => (
263+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
264+
task,
265+
),
262266
Err(err) => return Ok(Err(err)),
263267
}
264268
}
@@ -280,9 +284,10 @@ where
280284
}));
281285
let task = task.abort_handle();
282286
match response.await {
283-
Ok(response) => {
284-
(response.map(|body| body.map_err(Into::into).boxed()), task)
285-
}
287+
Ok(response) => (
288+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
289+
task,
290+
),
286291
Err(err) => return Ok(Err(err)),
287292
}
288293
}
@@ -304,9 +309,10 @@ where
304309
}));
305310
let task = task.abort_handle();
306311
match response.await {
307-
Ok(response) => {
308-
(response.map(|body| body.map_err(Into::into).boxed()), task)
309-
}
312+
Ok(response) => (
313+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
314+
task,
315+
),
310316
Err(err) => return Ok(Err(err)),
311317
}
312318
}
@@ -331,9 +337,10 @@ where
331337
}));
332338
let task = task.abort_handle();
333339
match response.await {
334-
Ok(response) => {
335-
(response.map(|body| body.map_err(Into::into).boxed()), task)
336-
}
340+
Ok(response) => (
341+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
342+
task,
343+
),
337344
Err(err) => return Ok(Err(err)),
338345
}
339346
}
@@ -354,9 +361,10 @@ where
354361
}));
355362
let task = task.abort_handle();
356363
match response.await {
357-
Ok(response) => {
358-
(response.map(|body| body.map_err(Into::into).boxed()), task)
359-
}
364+
Ok(response) => (
365+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
366+
task,
367+
),
360368
Err(err) => return Ok(Err(err)),
361369
}
362370
}
@@ -379,9 +387,10 @@ where
379387
}));
380388
let task = task.abort_handle();
381389
match response.await {
382-
Ok(response) => {
383-
(response.map(|body| body.map_err(Into::into).boxed()), task)
384-
}
390+
Ok(response) => (
391+
response.map(|body| body.map_err(Into::into).boxed_unsync()),
392+
task,
393+
),
385394
Err(err) => return Ok(Err(err)),
386395
}
387396
}

0 commit comments

Comments
 (0)