When parsing the header, if there is a space after the key, the parsing will fail.
- Dominant language
- C
- Stars
- 2.1k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
unittest:
```c++
phr_header headers[10];
std::string head = "Host: www.test.com\r\nCookie: c1=c1;\r\nKey : Value\r\n\r\n";
size_t max_headers = 10;
int ret = phr_parse_headers(head.data(), head.size(), headers, &max_headers, 0);
ASSERT_NE(-1, ret); // Expected: (-1) != (ret), actual: -1 vs -1
ASSERT_EQ(3, max_headers);
ASSERT_EQ("Key", std::string(headers[2].name, headers[2].name_len));
ASSERT_EQ("Value", std::string(headers[2].value, headers[2].value_len));
```
phr_parse_headers parse fail
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the shown unittest and tracing the phr_parse_headers entry point for handling spaces around header names. Done means the example with "Key : Value" parses successfully and preserves the expected name and value assertions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100