awschunk

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package awschunk decodes the aws-chunked content encoding S3 clients use for streaming uploads. Three x-amz-content-sha256 modes produce it:

STREAMING-AWS4-HMAC-SHA256-PAYLOAD           signed chunks (SigV4 clients, aws-sdk-go v1 & v2)
STREAMING-AWS4-HMAC-SHA256-PAYLOAD-TRAILER   signed chunks + trailing checksum headers
STREAMING-UNSIGNED-PAYLOAD-TRAILER           unsigned chunks + trailers (aws-sdk-go-v2's default for plain HTTP)

The frame format is:

<hex-size>[;chunk-signature=<sig>]\r\n
<size bytes of payload>\r\n
...
0[;chunk-signature=<sig>]\r\n
[trailer-header: value\r\n ...]
[x-amz-trailer-signature: sig\r\n]
\r\n

Chunk signatures are parsed and discarded (doze-aws never verifies signatures); trailers are captured and exposed after EOF so the S3 layer can check declared checksums.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsChunked

func IsChunked(r *http.Request) bool

IsChunked reports whether the request body is aws-chunked, by either signal clients use (some send both, some only one).

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader streams the decoded payload of an aws-chunked body.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader wraps an aws-chunked stream.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read yields decoded payload bytes. After io.EOF, Trailers returns any trailing headers.

func (*Reader) Trailers

func (r *Reader) Trailers() http.Header

Trailers returns the captured trailing headers. Valid after Read has returned io.EOF.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL