apple / apple/swift-http-types
Add unsafe initialisers for HTTPField and HTTPField.Name
- Dominant language
- Swift
- Stars
- 1k
- Forks
- 80
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 12
Description
Currently when constructing an `HTTPField` or `HTTPField.Name` the values are checked to see if they are valid. This is the correct thing to do obviously when the source of the headers is unknown, but if we know in advance the headers are valid this is wasted effort.
The situation I am describing comes from building a SwiftNIO server which has constructed the header values via LLHTTP which validates they are correct and then we build a HTTPField from these that does the validation again.
Is there an argument for providing an unsafe initialiser for both `HTTPField` and `HTTPField.Name` to avoid this duplicate work
Contributor guide
Research direction
Start by reviewing the existing HTTPField and HTTPField.Name initialisers and how they validate input. Determine the API shape and safety expectations for initialisers that accept values already validated by LLHTTP. Done means both types offer a clearly documented way to skip duplicate validation without weakening the checked construction path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- backend-api-design, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100