aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-05 23:34:36 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-20 23:52:55 +0200
commit0c0dee59ce0aa48e7d2f156711348da80fa38a9f (patch)
tree4d5ea63b32d3719c2800c3690a7bca6bea1af4b4 /http.c
parenta527164cb5b06055c7696eb4247f8cebee6cf23d (diff)
http.c: Accept resources with '&' or '?'
Otherwise, client requests to resources such as '/me & you', '/?' or '/??preview=1' would fail.
Diffstat (limited to 'http.c')
-rw-r--r--http.c6
1 files 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)
{