Hi internals,
Currently, PHP only supports sending one set of headers. HTTP 1xx status
codes may require sending multiple sets of headers. In particular, to use
103 Early Hints you need to first send Link headers for early hints, and
then, once your actual response is ready, send the usual 200/whatever
response headers and response body.
It's possible to do this currently, but rather awkward: You send the first
set of headers (the early hints) using header()
, and then you output the
second set of headers manually (direct echo). This also isn't compatible
with any internal functions (e.g. the session module) that add headers
automatically.
https://github.com/php/php-src/pull/7025 adds a function for sending a set
of headers early and resetting the current header/response code state, so
you can send normal response headers afterwards.
Any thoughts on supporting this feature? There's already some ongoing
bikeshedding regarding the function name on the PR...
Regards,
Nikita