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

fix(p3): allow taking response/request body at most once#159

Closed
rvolosatovs wants to merge 1 commit intoWebAssembly:mainfrom
rvolosatovs:fix/at-most-once-body-take
Closed

fix(p3): allow taking response/request body at most once#159
rvolosatovs wants to merge 1 commit intoWebAssembly:mainfrom
rvolosatovs:fix/at-most-once-body-take

Conversation

@rvolosatovs
Copy link
Contributor

Similar to #156, specify that the request/response body can be taken only once.

If callers were able to get N references to the body, then they would be able to call body.finish N times, which would require multiplexing in the host to provide N copies of e.g. the trailers to these N references. It's hard to imagine a use case for this pattern and it also not a common pattern in HTTP libraries as far as I know, so specify that body can only be taken once.

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs marked this pull request as draft March 12, 2025 12:18
@lukewagner
Copy link
Member

Similar to my reply in #156, the idea is that a request/response can be handed to component A, it can call body to process a part of the body, and then drop the body handle, and then pass the request/response to component B, which will call body again, picking up where component A left off. That would suggest we add some verbiage to the same effect as on %stream where "you can only call this a second time after dropping the original body".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants