Commit 511638f
authored
Refactor
* Refactor `wasi:http` headers' host representation
This commit is a follow-on/extension of bytecodealliance#12748 and extends the changes
made for WASIp2 headers in bytecodealliance#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:
* `FieldMap` now has its own dedicated module at the crate root instead
of intermingling with other WASIp2 types.
* `FieldMap` is now internally-`Arc`'d and is cheaply clonable.
`FieldMap` itself now tracks whether it's mutable or immutable (WASI
semantics) and doesn't need different wrappers in WASIp2 and WASIp3.
* Creation of an immutable `FieldMap` can be done without needing a size
limit. Flagging a `FieldMap` as mutable, however, requires a size limit.
* `FieldMap::set` was added to be a bit more efficient w.r.t. clones.
* `FieldMapError` is a new error type that covers all of the possible
error modes of operating with a `FieldMap`. Conversions from this to
WASIp{2,3} `header-error` types are now implemented as well.
* WASIp2 now flags `header-error` as 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 vs `FieldMap`, some
minor idioms, etc.
* WASIp3 no longer uses `MaybeMutable` for headers and instead uses
`FieldMap` directly.
cc bytecodealliance#12674
* Clippy warningswasi:http headers' host representation (bytecodealliance#12754)1 parent 9593a3a commit 511638f
19 files changed
Lines changed: 714 additions & 544 deletions
File tree
- crates
- test-programs/src/bin
- wasi-http
- src
- p2
- p3
- host
- tests/all
- tests/all
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
6 | 39 | | |
7 | 40 | | |
8 | 41 | | |
9 | 42 | | |
10 | 43 | | |
11 | 44 | | |
12 | | - | |
| 45 | + | |
| 46 | + | |
13 | 47 | | |
14 | 48 | | |
15 | 49 | | |
16 | 50 | | |
17 | 51 | | |
18 | 52 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
22 | 59 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
27 | 67 | | |
28 | | - | |
| 68 | + | |
29 | 69 | | |
30 | 70 | | |
31 | 71 | | |
| |||
0 commit comments