diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-07-05 23:34:36 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-07-20 23:52:55 +0200 |
| commit | 0c0dee59ce0aa48e7d2f156711348da80fa38a9f (patch) | |
| tree | 4d5ea63b32d3719c2800c3690a7bca6bea1af4b4 /http.c | |
| parent | a527164cb5b06055c7696eb4247f8cebee6cf23d (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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) { |
