Skip to content

Commit

Permalink
http: improve response header handling, save cpu cycles
Browse files Browse the repository at this point in the history
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 curl#13143
  • Loading branch information
icing authored and bagder committed Mar 19, 2024
1 parent 6bd4ca0 commit 522ea54
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 328 deletions.
2 changes: 1 addition & 1 deletion lib/c-hyper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 522ea54

Please sign in to comment.