paivana

HTTP paywall reverse proxy
Log | Files | Refs | Submodules | README | LICENSE

commit 9048cd9bfb20a60910b4f8a2bde80dda51a42a98
parent 7ad6ba5669f36531e38425603aaf63921bc25ff7
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  6 Aug 2026 16:44:42 +0200

empty regex matches everything

Diffstat:
Msrc/backend/paivana-httpd_templates.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/backend/paivana-httpd_templates.c b/src/backend/paivana-httpd_templates.c @@ -437,6 +437,11 @@ static bool parse_template (struct Template *t, const json_t *contract) { + /* An absent website_regex means "every URL". So does an empty one: + it is what a merchant UI stores for a template that was never + given a restriction, and anchoring it would yield "^()$", which + matches only the empty string and therefore no URL at all -- a + template that silently paywalls nothing. */ const char *regex = NULL; const char *summary = NULL; const json_t *choices = NULL; @@ -471,7 +476,8 @@ parse_template (struct Template *t, en); return false; } - if (NULL != regex) + if ( (NULL != regex) && + ('\0' != regex[0]) ) { char *anchored; int rc; @@ -507,7 +513,7 @@ parse_template (struct Template *t, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Using payment template %s for `%s'\n", t->template_id, - regex); + (NULL != t->regex) ? t->regex : "(all URLs)"); return true; }