Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: net/http: add support for the upcoming "Structured Field Values for HTTP" RFC #41046
Structured Field Values for HTTP is an upcoming RFC from the HTTP Wording Group defining a set of well-defined data types to use in HTTP headers and trailers.
This new format will improve the interoperability and the safety of HTTP by allowing to create generic parsers and serializers suitable for all HTTP headers. It is already used in the wild, for instance for the new security headers supported by Google Chrome (
After the RFC publication, it would be nice to be able to parse and generate such headers directly using the standard library.
@rsc thanks, link fixed.
We should at least wait for the Internet-Draft to become a RFC before merging the patch related to this proposal. However, it should happen soon. The specification is in last stages of standardization. The algorithms described in the I-D and implemented in the patch will most likely not change anymore.
The proposal can probably be kept open, and we can use the time window before the publication as a RFC to review and improve the patch.
@rsc we can maybe reduce the API surface a bit, but probably not much. The spec defines many data structures, and several of them cannot be implemented using only Go's builtins: https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#types
The main difference is that SFV's maps (
Another option would be to use
However I may have missed opportunities to reduce the API surface. I'm open to any suggestion to simplify this.