Refactor "print request headers" feature #1

Closed
opened 2024-09-06 12:38:28 +00:00 by stephenseo · 0 comments
Owner

Currently the "print request headers" used by option --req-header-to-print=<header> is somewhat inefficient as it re-compares the entire request buffer with each header specified. The ideal way to handle this is as follows:

  1. Set up a hash map with lower-case keys (since the header keys are supposed to be case-insensitive) and lines as values. This involves parsing the request buffer once to populate the map.
  2. Check against the hash map instead of comparing against the entire request buffer while ensuring the checks are case-insensitive (by converting the checking headers to lower-case before querying the hash map).
Currently the "print request headers" used by option `--req-header-to-print=<header>` is somewhat inefficient as it re-compares the entire request buffer with each header specified. The ideal way to handle this is as follows: 1. Set up a hash map with lower-case keys (since the header keys are supposed to be case-insensitive) and lines as values. This involves parsing the request buffer once to populate the map. 2. Check against the hash map instead of comparing against the entire request buffer while ensuring the checks are case-insensitive (by converting the checking headers to lower-case before querying the hash map).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stephenseo/c_simple_http#1
No description provided.