diff --git a/lib/compute-at-edge-abi/compute-at-edge.witx b/lib/compute-at-edge-abi/compute-at-edge.witx index 506cbcf0..83c2b3e5 100644 --- a/lib/compute-at-edge-abi/compute-at-edge.witx +++ b/lib/compute-at-edge-abi/compute-at-edge.witx @@ -303,6 +303,13 @@ (param $encodings $content_encodings) (result $err (expected (error $fastly_status))) ) + + ;;; Adjust how this requests's framing headers are determined. + (@interface func (export "framing_headers_mode_set") + (param $h $request_handle) + (param $mode $framing_headers_mode) + (result $err (expected (error $fastly_status))) + ) ) (module $fastly_http_resp @@ -404,6 +411,13 @@ (param $h $response_handle) (result $err (expected (error $fastly_status))) ) + + ;;; Adjust how this response's framing headers are determined. + (@interface func (export "framing_headers_mode_set") + (param $h $response_handle) + (param $mode $framing_headers_mode) + (result $err (expected (error $fastly_status))) + ) ) (module $fastly_dictionary diff --git a/lib/compute-at-edge-abi/typenames.witx b/lib/compute-at-edge-abi/typenames.witx index 4e789e3a..c164b746 100644 --- a/lib/compute-at-edge-abi/typenames.witx +++ b/lib/compute-at-edge-abi/typenames.witx @@ -113,3 +113,8 @@ (typename $content_encodings (flags (@witx repr u32) $gzip)) + +(typename $framing_headers_mode + (enum (@witx tag u32) + $automatic + $manually_from_headers)) diff --git a/lib/src/config.rs b/lib/src/config.rs index 23a8f201..1a5ae73b 100644 --- a/lib/src/config.rs +++ b/lib/src/config.rs @@ -130,10 +130,10 @@ impl TryInto for TomlFastlyConfig { .transpose()? .unwrap_or_default(); Ok(FastlyConfig { - name: name.unwrap_or_else(String::new), - description: description.unwrap_or_else(String::new), - authors: authors.unwrap_or_else(Vec::new), - language: language.unwrap_or_else(String::new), + name: name.unwrap_or_default(), + description: description.unwrap_or_default(), + authors: authors.unwrap_or_default(), + language: language.unwrap_or_default(), local_server, }) } diff --git a/lib/src/wiggle_abi/req_impl.rs b/lib/src/wiggle_abi/req_impl.rs index 6f27b211..ceb1ba77 100644 --- a/lib/src/wiggle_abi/req_impl.rs +++ b/lib/src/wiggle_abi/req_impl.rs @@ -9,8 +9,9 @@ use { fastly_http_req::FastlyHttpReq, headers::HttpHeaders, types::{ - BodyHandle, CacheOverrideTag, ContentEncodings, HttpVersion, MultiValueCursor, - MultiValueCursorResult, PendingRequestHandle, RequestHandle, ResponseHandle, + BodyHandle, CacheOverrideTag, ContentEncodings, FramingHeadersMode, HttpVersion, + MultiValueCursor, MultiValueCursorResult, PendingRequestHandle, RequestHandle, + ResponseHandle, }, }, }, @@ -113,6 +114,19 @@ impl FastlyHttpReq for Session { Err(Error::NotAvailable("Client TLS data")) } + fn framing_headers_mode_set( + &mut self, + _h: RequestHandle, + mode: FramingHeadersMode, + ) -> Result<(), Error> { + match mode { + FramingHeadersMode::ManuallyFromHeaders => { + Err(Error::NotAvailable("Manual framing headers")) + } + FramingHeadersMode::Automatic => Ok(()), + } + } + fn new(&mut self) -> Result { let (parts, _) = Request::new(()).into_parts(); Ok(self.insert_request_parts(parts)) diff --git a/lib/src/wiggle_abi/resp_impl.rs b/lib/src/wiggle_abi/resp_impl.rs index c57167af..c1527d99 100644 --- a/lib/src/wiggle_abi/resp_impl.rs +++ b/lib/src/wiggle_abi/resp_impl.rs @@ -8,8 +8,8 @@ use { fastly_http_resp::FastlyHttpResp, headers::HttpHeaders, types::{ - BodyHandle, HttpStatus, HttpVersion, MultiValueCursor, MultiValueCursorResult, - ResponseHandle, + BodyHandle, FramingHeadersMode, HttpStatus, HttpVersion, MultiValueCursor, + MultiValueCursorResult, ResponseHandle, }, }, }, @@ -166,6 +166,19 @@ impl FastlyHttpResp for Session { Ok(()) } + fn framing_headers_mode_set( + &mut self, + _h: ResponseHandle, + mode: FramingHeadersMode, + ) -> Result<(), Error> { + match mode { + FramingHeadersMode::ManuallyFromHeaders => { + Err(Error::NotAvailable("Manual framing headers")) + } + FramingHeadersMode::Automatic => Ok(()), + } + } + fn close(&mut self, resp_handle: ResponseHandle) -> Result<(), Error> { // We don't do anything with the parts, but we do pass the error up if // the handle given doesn't exist