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

@ -103,7 +103,7 @@ CURLcode Curl_http_target(struct Curl_easy *data, struct connectdata *conn,
CURLcode Curl_http_statusline(struct Curl_easy *data,
struct connectdata *conn);
CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
char *headp);
char *headp, size_t hdlen);
CURLcode Curl_transferencode(struct Curl_easy *data);
CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
Curl_HttpReq httpreq,