write-out: make %header{} able to output *all* occurances of a header

By appending `:all:[separator]` to the header name. The `[separator]` string
is output between each header value if there are more than one to output.

Test 764 and 765 verify

Idea-by: kapsiR on github
Ref: #18449
Closes #18491
This commit is contained in:
Daniel Stenberg 2025-09-08 00:18:52 +02:00
parent 522c991336
commit 6abe788bb8
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 249 additions and 17 deletions

View file

@ -93,6 +93,14 @@ The value of header `name` from the transfer's most recent server response.
Unlike other variables, the variable name `header` is not in braces. For
example `%header{date}`. Refer to --write-out remarks. (Added in 7.84.0)
Starting with 8.17.0, this output the contents of *all* header fields using a
specific name - even for a whole redirect "chain" by appending
`:all:[separator]` to the header name. The `[separator]` string (if not blank)
is output between the headers if there are more than one. When more than one
header is shown, they are output in the chronological order of appearance over
the wire. To include a close brace (`}`) in the separator, escape it with a
backslash: `\}`.
## `header_json`
A JSON object with all HTTP response headers from the recent transfer. Values
are provided as arrays, since in the case of multiple headers there can be