Diff options
| -rw-r--r-- | source/cgit.c | 17 | |
| -rw-r--r-- | source/html.c | 17 | |
| -rw-r--r-- | source/html.h | 2 |
3 files changed, 17 insertions, 19 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, diff --git a/source/html.c b/source/html.c index 94758e5..bc7a722 100644 --- a/source/html.c +++ b/source/html.c @@ -518,20 +518,3 @@ void html_include(const char *filename) html_raw(buf, len); fclose(f); } - -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); - } -} diff --git a/source/html.h b/source/html.h index 1b20cdb..d3cd8fe 100644 --- a/source/html.h +++ b/source/html.h @@ -96,6 +96,4 @@ extern void html_option(const char *value, const char *text, const char *selecte extern void html_intoption(int value, const char *text, int selected_value); extern void html_include(const char *filename); -extern void http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value)); - #endif // CGIT_HTML_H |
