http: handle user-defined connection headers

When there is more than one user-supplied 'Connection: ' header, add
values that curl needs internally to the first one and emit all
subsequent ones thereafter.

Fixes #18662
Reported-by: Evgeny Grin (Karlson2k)
Closes #18686
This commit is contained in:
Stefan Eissing 2025-09-22 15:48:07 +02:00 committed by Daniel Stenberg
parent 500ea90829
commit 061e265502
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 132 additions and 11 deletions

View file

@ -55,6 +55,10 @@ without content (no data on the right side of the colon) as in `Accept:`, the
internally used header is removed. To forcibly add a header without content
(nothing after the colon), use the form `name;` (using a trailing semicolon).
There are exceptions when suppressing headers. The `Connection:` header in
HTTP/1.1 cannot be overridden. You can provide values for it, but should a
request require specific ones, they are always added to your own.
The headers included in the linked list **must not** be CRLF-terminated, since
libcurl adds CRLF after each header item itself. Failure to comply with this
might result in strange behavior. libcurl passes on the verbatim strings you