mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-24 04:38:00 +00:00
Motivation: We don't always require an array of header values to be extracted. Sometimes we just need to be able to iterate through them. For 'regular' header values we incur an allocation for the array, for values in their canonical form we incure at least two allocations. We can do better than this by providing a header value sequence. Modifications: - Add new API to `HPACKHeaders` for getting a sequence of header values which can optionally be in their canonical form. - Update the API of the two existing subscripts to use this new API. For `subscript(canonicalForm:)` we save an allocation by not going via `subscript(name:)`. Result: - Fewer allocations in `subscript(canonicalForm:)` - Header values can be iterated without allocating