Skip to content

Commit 6b462c1

Browse files
committed
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
1 parent 2bf9c47 commit 6b462c1

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ 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+
///
125+
/// Implementations MUST accept individual field values of at least
126+
/// 8192 bytes and total aggregate field sections of at least 16384
127+
/// bytes. These minimums ensure portability across common HTTP
128+
/// servers and match HTTP/2's minimum SETTINGS_MAX_FRAME_SIZE.
129+
size-exceeded,
119130
}
120131

121132
/// This type enumerates the different kinds of errors that may occur when
@@ -158,6 +169,12 @@ interface types {
158169
/// original casing used to construct or mutate the `fields` resource. The `fields`
159170
/// resource should use that original casing when serializing the fields for
160171
/// transport or when returning them from a method.
172+
///
173+
/// Implementations may impose limits on individual field values and on total
174+
/// aggregate field section size. Operations that would exceed these limits
175+
/// fail with `header-error.size-exceeded`. Implementations MUST accept
176+
/// individual field values of at least 8192 bytes and total aggregate field
177+
/// sections of at least 16384 bytes.
161178
@since(version = 0.3.0-rc-2026-02-09)
162179
resource fields {
163180

@@ -180,7 +197,8 @@ interface types {
180197
/// well-formed, so they are represented as a raw list of bytes.
181198
///
182199
/// An error result will be returned if any header or value was
183-
/// syntactically invalid, or if a header was forbidden.
200+
/// syntactically invalid, if a header was forbidden, or if the
201+
/// entries would exceed an implementation size limit.
184202
from-list: static func(
185203
entries: list<tuple<field-name,field-value>>
186204
) -> result<fields, header-error>;
@@ -199,6 +217,9 @@ interface types {
199217
/// name, if they have been set.
200218
///
201219
/// Fails with `header-error.immutable` if the `fields` are immutable.
220+
///
221+
/// Fails with `header-error.size-exceeded` if the name or values would
222+
/// exceed an implementation-defined size limit.
202223
set: func(name: field-name, value: list<field-value>) -> result<_, header-error>;
203224

204225
/// Delete all values for a name. Does nothing if no values for the name
@@ -219,6 +240,9 @@ interface types {
219240
/// values for that name.
220241
///
221242
/// Fails with `header-error.immutable` if the `fields` are immutable.
243+
///
244+
/// Fails with `header-error.size-exceeded` if the value would exceed
245+
/// an implementation-defined size limit.
222246
append: func(name: field-name, value: field-value) -> result<_, header-error>;
223247

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

0 commit comments

Comments
 (0)