Skip to main content

wrap_streaming_body

Function wrap_streaming_body 

Source
pub async fn wrap_streaming_body(
    session: &mut Session,
    upstream_request: &mut RequestHeader,
    region: &str,
    access_key: &str,
    secret_key: &str,
) -> Result<(), Box<dyn Error>>
Expand description

Build a stream whose items are already wrapped in “AWS-chunk-signed” envelopes.

  • body - raw payload implementing AsyncRead
  • signing_key - result of the usual signing_key() step
  • scope - e.g. "20250501/eu-west-3/s3/aws4_request"
  • ts - the X-Amz-Date you put in the header (YYYYMMDDThhmmssZ)
  • seed_sig - the Signature= value you computed for the headers (the one that goes into Authorization:)
┌──── header chunk ────┐┌── data ─┐┌─ CRLF ─┐
<hex-len>;chunk-signature=<sig>\r\n<bytes>\r\n

The very last frame is

0;chunk-signature=<final-sig>\r\n\r\n