From 0c0dee59ce0aa48e7d2f156711348da80fa38a9f Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 5 Jul 2023 23:34:36 +0200 Subject: http.c: Accept resources with '&' or '?' Otherwise, client requests to resources such as '/me & you', '/?' or '/??preview=1' would fail. --- http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index d843bb5..3862fa7 100644 --- a/http.c +++ b/http.c @@ -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) { -- cgit v1.2.3