http: improve response header handling, save cpu cycles

Saving some cpu cycles in http response header processing:
- pass the length of the header line along
- use string constant sizeof() instead of strlen()
- check line length if prefix is possible
- switch on first header char to limit checks

Closes #13143
This commit is contained in:
Stefan Eissing 2024-03-18 12:46:43 +01:00 committed by Daniel Stenberg
parent 6bd4ca0ef6
commit 522ea5420f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 394 additions and 334 deletions

View file

@ -171,7 +171,7 @@ static int hyper_each_header(void *userdata,
len = Curl_dyn_len(&data->state.headerb);
headp = Curl_dyn_ptr(&data->state.headerb);
result = Curl_http_header(data, data->conn, headp);
result = Curl_http_header(data, data->conn, headp, len);
if(result) {
data->state.hresult = result;
return HYPER_ITER_BREAK;