aboutsummaryrefslogtreecommitdiff
path: root/src/mhd
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-06-11 16:19:40 +0200
committerChristian Grothoff <christian@grothoff.org>2024-06-11 16:19:40 +0200
commit4861078ce1529be05213d99a7b2c48315dfb934d (patch)
treefb04db61f1a8cf1555232466cad8dce73e3d9765 /src/mhd
parenteab8ddd7e778adca2a7a71afd2d15f80fb33fc0a (diff)
downloadexchange-4861078ce1529be05213d99a7b2c48315dfb934d.tar.xz
return 501 in /terms if not configured
Diffstat (limited to 'src/mhd')
-rw-r--r--src/mhd/mhd_legal.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index 8353a6901..a3104f1a0 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -179,6 +179,13 @@ MHD_RESULT
TALER_MHD_reply_legal (struct MHD_Connection *conn,
struct TALER_MHD_Legal *legal)
{
+ /* Default terms of service if none are configured */
+ static struct Terms none = {
+ .mime_type = "text/plain",
+ .terms = "not configured",
+ .language = "en",
+ .terms_size = strlen ("not configured")
+ };
struct MHD_Response *resp;
struct Terms *t;
struct GNUNET_TIME_Absolute a;
@@ -297,17 +304,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
}
if (NULL == t)
- {
- /* Default terms of service if none are configured */
- static struct Terms none = {
- .mime_type = "text/plain",
- .terms = "not configured",
- .language = "en",
- .terms_size = strlen ("not configured")
- };
-
- t = &none;
- }
+ t = &none; /* 501 if not configured */
/* try to compress the response */
resp = NULL;
@@ -376,7 +373,9 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
MHD_RESULT ret;
ret = MHD_queue_response (conn,
- MHD_HTTP_OK,
+ t == &none
+ ? MHD_HTTP_NOT_IMPLEMENTED
+ : MHD_HTTP_OK,
resp);
MHD_destroy_response (resp);
return ret;