http1: parse header from uint8_t buffer

To save casting the passed buffer when parsing HTTP/1 request
headers from an uint8_t buffer.

Closes #19742
This commit is contained in:
Stefan Eissing 2025-11-28 10:25:59 +01:00 committed by Daniel Stenberg
parent b06cd929bd
commit 8c68887d2d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 13 additions and 13 deletions

View file

@ -77,7 +77,7 @@ static CURLcode trim_line(struct h1_req_parser *parser, int options)
}
static CURLcode detect_line(struct h1_req_parser *parser,
const char *buf, const size_t buflen,
const uint8_t *buf, const size_t buflen,
size_t *pnread)
{
const char *line_end;
@ -87,14 +87,14 @@ static CURLcode detect_line(struct h1_req_parser *parser,
line_end = memchr(buf, '\n', buflen);
if(!line_end)
return CURLE_AGAIN;
parser->line = buf;
parser->line_len = line_end - buf + 1;
parser->line = (const char *)buf;
parser->line_len = line_end - parser->line + 1;
*pnread = parser->line_len;
return CURLE_OK;
}
static CURLcode next_line(struct h1_req_parser *parser,
const char *buf, const size_t buflen, int options,
const uint8_t *buf, const size_t buflen, int options,
size_t *pnread)
{
CURLcode result;
@ -262,7 +262,7 @@ out:
}
CURLcode Curl_h1_req_parse_read(struct h1_req_parser *parser,
const char *buf, size_t buflen,
const uint8_t *buf, size_t buflen,
const char *scheme_default,
const char *custom_method,
int options, size_t *pnread)