paivana

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

commit 5afb0c93618785c6b0fed4cb8f5130f854f0dd2a
parent df35b6a8a3273a262bf7d0e4314f669888e2bc72
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 31 May 2026 01:00:02 +0200

-misc bugfixes

Diffstat:
Msrc/backend/paivana-httpd_cookie.c | 2++
Msrc/backend/paivana-httpd_reverse.c | 10+++++++---
Msrc/backend/paivana-httpd_templates.c | 22+++++++++++++++-------
3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/backend/paivana-httpd_cookie.c b/src/backend/paivana-httpd_cookie.c @@ -168,6 +168,8 @@ PAIVANA_HTTPD_compute_cookie (struct GNUNET_TIME_Timestamp cur_time, if (NULL != dslash) url = strchr (dslash + 2, '/'); + if (NULL == url) + url = "/"; } compute_cookie_hash (cur_time, website, diff --git a/src/backend/paivana-httpd_reverse.c b/src/backend/paivana-httpd_reverse.c @@ -809,7 +809,10 @@ build_host_header (const char *url) hostname = strstr (dup, MARKER); if (NULL == hostname) + { + GNUNET_free (dup); return NULL; + } hostname += 3; end = strchrnul (hostname, '/'); *end = '\0'; @@ -842,7 +845,6 @@ con_val_iter (void *cls, { struct HttpRequest *hr = cls; char *hdr; - char *new_value = NULL; (void) kind; if (0 == strcasecmp (MHD_HTTP_HEADER_HOST, @@ -900,7 +902,6 @@ con_val_iter (void *cls, hr->headers = curl_slist_append (hr->headers, hdr); GNUNET_free (hdr); - GNUNET_free (new_value); return MHD_YES; } @@ -946,7 +947,10 @@ PAIVANA_HTTPD_reverse_cleanup (struct HttpRequest *hr) hr->headers = NULL; } if ( (NULL != hr->response) && - (curl_failure_response != hr->response) ) + (curl_failure_response != hr->response) && + (method_failure_response != hr->response) && + (upload_failure_response != hr->response) && + (internal_failure_response != hr->response) ) /* Destroy non-error responses... (?) */ MHD_destroy_response (hr->response); diff --git a/src/backend/paivana-httpd_templates.c b/src/backend/paivana-httpd_templates.c @@ -284,9 +284,10 @@ load_paywall (struct MHD_Connection *conn, GNUNET_JSON_pack_string ( "summary", t->summary)), - GNUNET_JSON_pack_array_incref ( - "choices", - t->choices), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_array_incref ( + "choices", + t->choices)), GNUNET_JSON_pack_bool ( "has_choices", 1 < json_array_size (t->choices)), @@ -456,7 +457,14 @@ setup_template ( tgr->details.ok.template_contract); break; default: - GNUNET_break (0); + 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; } for (struct Template *p = t_head; NULL != p; p = p->next) @@ -590,9 +598,9 @@ PAIVANA_HTTPD_search_templates (struct MHD_Connection *connection, TALER_EC_GENERIC_HTTP_HEADERS_MALFORMED, "Host or X-Forwarded-Host required"); } - GNUNET_STRINGS_base64url_encode (website, - strlen (website), - &enc); + (void) GNUNET_STRINGS_base64url_encode (website, + strlen (website), + &enc); GNUNET_buffer_write_str (&buf, "/.well-known/paivana/templates/"); GNUNET_buffer_write_str (&buf,