apple / apple/swift-nio-http2

Consider returning [Substring] from HPACKHeaders.subscript(canonicalForm:)

Open
#253 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

Both `HTTPHeaders` and `HPACKHeaders` have very similar APIs. One slight difference is that `HTTPHeaders` `subscript(canonicalForm:)` returns `[Substring]` while `HPACKHeaders` returns `[String]`.

Returning `[Substring]` would allow us to potentially avoid some heap allocations as well as bringing the API more in line with `HTTPHeaders`.

We should consider adding an alternative subscript API now or at least changing this in the next major version of NIO HTTP/2.

Contributor guide

Open the contributing guide

Research direction

Locate HPACKHeaders.subscript(canonicalForm:) and compare its API with HTTPHeaders.subscript(canonicalForm:), as described in the issue. Check how the return type is exposed and used, then determine whether an alternative subscript or a next-major-version change is appropriate; done means the HPACKHeaders API can return [Substring] without breaking the intended compatibility plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.