http.c: Accept resources with '&' or '?'

Otherwise, client requests to resources such as '/me & you', '/?' or
'/??preview=1' would fail.
This commit is contained in:
Xavier Del Campo Romero 2023-07-05 23:34:36 +02:00
parent 15c905f150
commit 7bd56e69dc
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
1 changed files with 4 additions and 2 deletions

6
http.c
View File

@ -259,8 +259,10 @@ static int parse_args(struct ctx *const c, const char *const res,
size_t *const reslen)
{
int error;
const char *const arg_start = strchr(res, '?'),
*const ad_arg = strchr(res, '&');
const char *const tmp_arg_start = strrchr(res, '?'),
*const arg_start = tmp_arg_start && *(tmp_arg_start + 1) ?
tmp_arg_start : NULL,
*const ad_arg = arg_start ? strchr(arg_start, '&') : NULL;
if (!arg_start)
{