alexcrichton requested wasmtime-wasi-reviewers for a review on PR #12754.
alexcrichton requested dicej for a review on PR #12754.
alexcrichton opened PR #12754 from alexcrichton:p3-limit-headers to bytecodealliance:main:
This commit is a follow-on/extension of #12748 and extends the changes made for WASIp2 headers in #12652 to the WASIp3 implementation as well. This is done through a number of refactorings to make the WASIp2 and WASIp3 implementations more similar in terms of how they represent headers. Changes here are:
FieldMapnow has its own dedicated module at the crate root instead of intermingling with other WASIp2 types.FieldMapis now internally-Arc'd and is cheaply clonable.FieldMapitself now tracks whether it's mutable or immutable (WASI semantics) and doesn't need different wrappers in WASIp2 and WASIp3.- Creation of an immutable
FieldMapcan be done without needing a size limit. Flagging aFieldMapas mutable, however, requires a size limit.FieldMap::setwas added to be a bit more efficient w.r.t. clones.FieldMapErroris a new error type that covers all of the possible error modes of operating with aFieldMap. Conversions from this to WASIp{2,3}header-errortypes are now implemented as well.- WASIp2 now flags
header-erroras a trappable-error-type, allowing the use of?in implementing header functions (like WASIp3).- Much of WASIp2's header implementation was refactored with
?, moving methods around, shuffling where headers are made vsFieldMap, some minor idioms, etc.- WASIp3 no longer uses
MaybeMutablefor headers and instead usesFieldMapdirectly.cc #12674
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested wasmtime-core-reviewers for a review on PR #12754.
alexcrichton updated PR #12754.
alexcrichton updated PR #12754.
alexcrichton commented on PR #12754:
Another caveat to this implementation: WASIp2 no longer uses child resources for headers, meaning that we're probably technically in violation of the spec. That being said the WASIp2 semantics now mirror WASIp3, so I'd personally consider this ok since WASIp3 is the defacto-expectations in the future.
pchickey commented on PR #12754:
WASIp2 no longer uses child resources for headers, meaning that we're probably technically in violation of the spec.
As I've said elsewhere previously, child resources were the wrong way to go about literally everything they were used for and I am glad we are getting rid of them in WASIp3. I don't think that lifting the restriction from the implementation in p2 is harmful - all existing guest programs that expected to follow the child rules will continue to work properly. Though there is some risk that a new p2 guest is written without expectation of the child rules and is non-portable to hosts with an older version of wasmtime-wasi-http, I don't know if we need to worry about this in practice.
Also, FWIW, in the two private embeddings Chris and I work on, we didn't use child resources for headers.
pchickey submitted PR review:
Thanks, this is a much nicer structure.
alexcrichton added PR #12754 Refactor wasi:http headers' host representation to the merge queue.
alexcrichton merged PR #12754.
alexcrichton removed PR #12754 Refactor wasi:http headers' host representation from the merge queue.
Last updated: Mar 23 2026 at 16:19 UTC