Rust SDK 0.13.0

rust-sdk
  • Make HTTP guest caching compatible with send_async.
  • Add PendingRequest::send_to_client method for handing off responsibility to the host for sending eventual responses to in-flight requests back to the client.
  • Use LazyLock/OnceLock instead of lazy_static
  • Support stale-if-error in the HTTP cache when using guest caching (default). See Fastly's documentation on stale-if-error for more details.

The HTTP cache will now store and serve stale-if-error responses. The duration is configurable via Request::set_stale_if_error or CandidateResponse::set_stale_if_error. If you wish to disable this behavior, you can use Request::set_stale_if_error(Duration::ZERO) to avoid storing any cache entries with a stale-if-error period.

If the HTTP cache has a response in its stale-if-error period and if Request::send or Request::send_async would otherwise return a SendError instead of a Response, Request::send and Request::send_async will instead provide the cached response. For the request collapse leader, Response::masked_error returns the error that would otherwise have been returned.

Note that 5xx responses from a server are not, by default, replaced with a stale-if-error response. You can override this behavior by returning an error from the after_send cache hook.

Prior change: Rust SDK 0.12.1