Skip to content

Commit 62f2e59

Browse files
authored
feat(http): size-exceeded error variant (#891)
* feat(http): size-exceeded error variant Opting for documenting two floors, one for individual fields and the other for aggregate. Exceeding either will fail with `header-error.size-exceeded`. Resolves #889 * feat(http): add other to variants Defensively extend the variants for http, related to #892 I used option<string> to match error-code's internal-error(option<string>) * fix(http): remove implementation limit recommendations Specific minimum sizes are intentionally left unspecified. Implementations operate in diverse environments with varying constraints, so limits are implementation-defined. Making operations fallible with size-exceeded is sufficient to ensure correct error handling without prescribing specific thresholds.
1 parent 053770a commit 62f2e59

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

proposals/cli/wit-0.3.0-draft/deps.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ sha512 = "f08a2828b88fc6ddea935af584531c484ad4a7a5f30340265e11e91b2bfe0f81e74a66
55

66
[filesystem]
77
path = "../../filesystem/wit-0.3.0-draft"
8-
sha256 = "184861e98785957311bfaab242cdf9e66a9ecca11fe2c493b840c461b2361088"
9-
sha512 = "50fa8801fc0a2c1ecfa3cea52af57836f98a12bb0a264439c13bbdcc0e269b3b37ade38b903d6ce10594d1f585d02ef993f3f769c4cddeebdfc00bf93734ed25"
8+
sha256 = "8808ea3adfbc1a025d649b82ddf4f38232ca4377100cfe671d80d5ee37fa3147"
9+
sha512 = "19f4eb8fa62e96ba37b3ea231af6a3bc396c28f82935018a3322441321936b34fb0e44360b378145fcb681d9fea810745969d8baab02ae6017be1784be8abe45"
1010

1111
[random]
1212
path = "../../random/wit-0.3.0-draft"
13-
sha256 = "5794796c909d6656fcbae6bed28265210ca57308a624119ac0a472326a75aa8f"
14-
sha512 = "812ce57aa13ff3128779d41f4dad50714365e4f9cfd2e1b13458a885fa65da05e409f145deefa25c4a82e0e301a41e2e6572705b35752dc33908d565a73a2e9c"
13+
sha256 = "2d54fe2815781a7462f3540b0959842b7e15d9fe8530c2b961b35451b6922670"
14+
sha512 = "ac1a04d180f8aa11ac82529a0de7ff01c8d51d10424806aefe1c1d52ea9ade9911eaee2b3f7d9c23f4b3bfdff469af6482f4a9e5b800c465b9fb7b73ccc635c7"
1515

1616
[sockets]
1717
path = "../../sockets/wit-0.3.0-draft"
18-
sha256 = "985821e86f2643d90b7a100420a44a5a60a6838adcf76fdb90a66255e3926dde"
19-
sha512 = "9ba1e9456c0dc02800ba738acd382a4113103bed72127396546c5f0ad3d38dd5c8e077443bd508b15f86f6095706907e9cb258cccab37c273b4c597a238987e7"
18+
sha256 = "5e7010b31fc80b5484cdcad7bfaae9dbb2134d3debfa6a90c69c30ec8cf7d55e"
19+
sha512 = "3863bd53d4ef1815f0f0f48d4032e3232322a3dbfa875eb573df2940264aacfe55d672886323406e5942ffc38ed5ad7dce91fcff3ff1e2e072773bb6dd9c7cd1"

proposals/http/wit-0.3.0-draft/deps.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ sha256 = "888647625fec3eaaf276cb884e426bc32bfa79ced22955f10eb239df74c8550c"
1010
sha512 = "f08a2828b88fc6ddea935af584531c484ad4a7a5f30340265e11e91b2bfe0f81e74a660a512f72e5197d60278feccc00534833ebd73868e801859dd31a61bdbb"
1111

1212
[filesystem]
13-
sha256 = "184861e98785957311bfaab242cdf9e66a9ecca11fe2c493b840c461b2361088"
14-
sha512 = "50fa8801fc0a2c1ecfa3cea52af57836f98a12bb0a264439c13bbdcc0e269b3b37ade38b903d6ce10594d1f585d02ef993f3f769c4cddeebdfc00bf93734ed25"
13+
sha256 = "8808ea3adfbc1a025d649b82ddf4f38232ca4377100cfe671d80d5ee37fa3147"
14+
sha512 = "19f4eb8fa62e96ba37b3ea231af6a3bc396c28f82935018a3322441321936b34fb0e44360b378145fcb681d9fea810745969d8baab02ae6017be1784be8abe45"
1515

1616
[random]
17-
sha256 = "5794796c909d6656fcbae6bed28265210ca57308a624119ac0a472326a75aa8f"
18-
sha512 = "812ce57aa13ff3128779d41f4dad50714365e4f9cfd2e1b13458a885fa65da05e409f145deefa25c4a82e0e301a41e2e6572705b35752dc33908d565a73a2e9c"
17+
sha256 = "2d54fe2815781a7462f3540b0959842b7e15d9fe8530c2b961b35451b6922670"
18+
sha512 = "ac1a04d180f8aa11ac82529a0de7ff01c8d51d10424806aefe1c1d52ea9ade9911eaee2b3f7d9c23f4b3bfdff469af6482f4a9e5b800c465b9fb7b73ccc635c7"
1919

2020
[sockets]
21-
sha256 = "985821e86f2643d90b7a100420a44a5a60a6838adcf76fdb90a66255e3926dde"
22-
sha512 = "9ba1e9456c0dc02800ba738acd382a4113103bed72127396546c5f0ad3d38dd5c8e077443bd508b15f86f6095706907e9cb258cccab37c273b4c597a238987e7"
21+
sha256 = "5e7010b31fc80b5484cdcad7bfaae9dbb2134d3debfa6a90c69c30ec8cf7d55e"
22+
sha512 = "3863bd53d4ef1815f0f0f48d4032e3232322a3dbfa875eb573df2940264aacfe55d672886323406e5942ffc38ed5ad7dce91fcff3ff1e2e072773bb6dd9c7cd1"

proposals/http/wit-0.3.0-draft/types.wit

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ interface types {
116116
/// This error indicates that the operation on the `fields` was not
117117
/// permitted because the fields are immutable.
118118
immutable,
119+
120+
/// This error indicates that the operation would exceed an
121+
/// implementation-defined limit on field sizes. This may apply to
122+
/// an individual `field-value`, a single `field-name` plus all its
123+
/// values, or the total aggregate size of all fields.
124+
size-exceeded,
125+
126+
/// This is a catch-all error for anything that doesn't fit cleanly into a
127+
/// more specific case. Implementations can use this to extend the error
128+
/// type without breaking existing code. It also includes an optional
129+
/// string for an unstructured description of the error. Users should not
130+
/// depend on the string for diagnosing errors, as it's not required to be
131+
/// consistent between implementations.
132+
other(option<string>),
119133
}
120134

121135
/// This type enumerates the different kinds of errors that may occur when
@@ -128,6 +142,14 @@ interface types {
128142
/// Indicates that the operation on the `request-options` was not permitted
129143
/// because it is immutable.
130144
immutable,
145+
146+
/// This is a catch-all error for anything that doesn't fit cleanly into a
147+
/// more specific case. Implementations can use this to extend the error
148+
/// type without breaking existing code. It also includes an optional
149+
/// string for an unstructured description of the error. Users should not
150+
/// depend on the string for diagnosing errors, as it's not required to be
151+
/// consistent between implementations.
152+
other(option<string>),
131153
}
132154

133155
/// Field names are always strings.
@@ -158,6 +180,10 @@ interface types {
158180
/// original casing used to construct or mutate the `fields` resource. The `fields`
159181
/// resource should use that original casing when serializing the fields for
160182
/// transport or when returning them from a method.
183+
///
184+
/// Implementations may impose limits on individual field values and on total
185+
/// aggregate field section size. Operations that would exceed these limits
186+
/// fail with `header-error.size-exceeded`
161187
@since(version = 0.3.0-rc-2026-02-09)
162188
resource fields {
163189

@@ -180,7 +206,8 @@ interface types {
180206
/// well-formed, so they are represented as a raw list of bytes.
181207
///
182208
/// An error result will be returned if any header or value was
183-
/// syntactically invalid, or if a header was forbidden.
209+
/// syntactically invalid, if a header was forbidden, or if the
210+
/// entries would exceed an implementation size limit.
184211
from-list: static func(
185212
entries: list<tuple<field-name,field-value>>
186213
) -> result<fields, header-error>;
@@ -199,6 +226,9 @@ interface types {
199226
/// name, if they have been set.
200227
///
201228
/// Fails with `header-error.immutable` if the `fields` are immutable.
229+
///
230+
/// Fails with `header-error.size-exceeded` if the name or values would
231+
/// exceed an implementation-defined size limit.
202232
set: func(name: field-name, value: list<field-value>) -> result<_, header-error>;
203233

204234
/// Delete all values for a name. Does nothing if no values for the name
@@ -219,6 +249,9 @@ interface types {
219249
/// values for that name.
220250
///
221251
/// Fails with `header-error.immutable` if the `fields` are immutable.
252+
///
253+
/// Fails with `header-error.size-exceeded` if the value would exceed
254+
/// an implementation-defined size limit.
222255
append: func(name: field-name, value: field-value) -> result<_, header-error>;
223256

224257
/// Retrieve the full set of names and values in the Fields. Like the

0 commit comments

Comments
 (0)