headers: make sure the trailing newline is not stored

extended test1940 to verify blank header fields too

Bug: https://curl.se/mail/lib-2024-01/0019.html
Reported-by: Dmitry Karpov
Closes #12675
This commit is contained in:
Daniel Stenberg 2024-01-10 09:22:59 +01:00
parent 77c3c1a8fb
commit a9e128d569
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 8 additions and 2 deletions

View file

@ -295,7 +295,7 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
if(!end)
return CURLE_BAD_FUNCTION_ARGUMENT;
}
hlen = end - header + 1;
hlen = end - header;
if((header[0] == ' ') || (header[0] == '\t')) {
if(data->state.prevhead)