paivana

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

commit e903d20ba7614ff8010e4177b9542767c612167b
parent bc3e31a173fd251b3348b99951afc3e91cc967ce
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  6 Aug 2026 18:02:15 +0200

refuse to start if templates are not valid

Diffstat:
MREADME | 6+++++-
Msrc/backend/paivana-httpd_templates.c | 26+++++++++++++-------------
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/README b/README @@ -126,7 +126,11 @@ Pass `-n` / `--no-payment` to bypass the paywall entirely (pure reverse proxy, useful for testing upstream plumbing). The daemon does not serve requests until it has fetched paywall templates -from the merchant backend. If template loading fails, startup is aborted. +from the merchant backend. If template loading fails, startup is aborted: +a template that could not be loaded would otherwise leave everything it +covers unpaywalled. Transient backend outages are the service manager's +job to ride out -- the shipped `paivana-httpd.service` restarts with an +increasing back-off, and does not restart on a configuration error. Deployment behind a reverse proxy diff --git a/src/backend/paivana-httpd_templates.c b/src/backend/paivana-httpd_templates.c @@ -536,23 +536,23 @@ setup_template ( if (! parse_template (t, tgr->details.ok.template_contract)) { - GNUNET_free (t->template_id); - GNUNET_CONTAINER_DLL_remove (t_head, - t_tail, - t); - GNUNET_free (t); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to parse template %s, refusing to start\n", + t->template_id); + PH_global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); + return; } break; default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to load template %s from backend\n", - t->template_id); - GNUNET_free (t->template_id); - GNUNET_CONTAINER_DLL_remove (t_head, - t_tail, - t); - GNUNET_free (t); - break; + "Failed to load template %s from backend" + " (HTTP status %u), refusing to start\n", + t->template_id, + tgr->hr.http_status); + PH_global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); + return; } for (struct Template *p = t_head; NULL != p; p = p->next) if (NULL != p->gt)