apple / apple/swift-nio-http2

Provide API for adding pseudo headers to HPACKHeaders

Open
#254 0 comments 0 reactions 0 assignees View on GitHub
kind/enhancement
Dominant language
Swift
Stars
503
Forks
103
Avg merge
18h 8m
Merged PRs (30d)
4

Description

Pseudo headers must appear at the beginning of a block of headers. However, there's no API in `HPACKHeaders` to allow for this; it requires up-front knowledge that when constructed the pseudo headers are added first.

When a block of headers is provided (by a user, for example) which must then have pseudo headers added to it, a new block must be created, the pseudo headers added and then all of the headers from the provided block to be copied across. This incurs a potentially large unnecessary extra allocation.

`HPACKHeaders` is currently backed by an array, changing this to a `CircularBuffer` would allow cheap insertion to the front of the block via an `add(pseudoHeader:value:)` API.

Contributor guide

Open the contributing guide

Research direction

Start at HPACKHeaders and inspect its current array-backed storage and header insertion behavior. Confirm that the proposed API preserves pseudo-header-first ordering without rebuilding the supplied block, then validate the behavior with the project's existing HTTP/2 header tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.