Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/cgit.c | 17 |
1 file changed, 17 insertions, 0 deletions
diff --git a/source/cgit.c b/source/cgit.c index ed9b62b..2bb761d 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -757,6 +757,23 @@ static void apply_query_param(const char *name, const char *value) } } +static void http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value)) +{ + const char *p = txt; + + while (p && *p) { + char *name = url_decode_parameter_name(&p); + // A name ends at an equals sign or an ampersand, and only the + // first is followed by a value. + if (*name) { + char *value = p[-1] == '=' ? url_decode_parameter_value(&p) : xstrdup(""); + fn(name, value); + free(value); + } + free(name); + } +} + static void open_auth_filter(const char *action) { cgit_open_filter(ctx.cfg.auth_filter, action, |
