aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-10-02 22:51:54 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2022-10-02 22:51:54 +0200
commit72cbf663952bc95888aa2187894da78725e7590c (patch)
tree0d0f9758e082a36487a85fd4335f0342f5c1e6f6 /src/exchange/taler-exchange-httpd.c
parent04c7e0bb337dd88dde60293d94d2e192a8fc2ff5 (diff)
WiP: added auction_brandt as extension
- added an extension to handle auctions via libbrandt - /extensions/auction_brandt GET and POST handler defined - initial parsing of transcript.json implemented, yet WiP - multiple cleanups and changes to extension handling
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index d7651d79..68fc9fb7 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -1040,6 +1040,42 @@ handle_post_auditors (struct TEH_RequestContext *rc,
root);
}
+/**
+ * Handle GET "/extensions/..." requests.
+ *
+ * @param rc request context
+ * @param args array of additional options
+ * @return MHD result code
+ */
+static MHD_RESULT
+handle_get_extensions (struct TEH_RequestContext *rc,
+ const char *const args[])
+{
+ const struct TALER_Extension *ext = NULL;
+
+ if (NULL == args[0])
+ {
+ GNUNET_break_op (0);
+ return r404 (rc->connection,
+ "/extensions/$EXTENSION");
+ }
+
+ ext = TALER_extensions_get_by_name (args[0]);
+ if (NULL == ext)
+ {
+ GNUNET_break_op (0);
+ return r404 (rc->connection,
+ "/extensions/$EXTENSION unknown");
+ }
+
+ if (NULL == ext->http_get_handler)
+ return MHD_HTTP_NOT_IMPLEMENTED;
+
+ return ext->http_get_handler (
+ rc->connection,
+ &args[1]);
+}
+
/**
* Handle POST "/extensions/..." requests.
@@ -1301,6 +1337,13 @@ handle_mhd_request (void *cls,
/* extensions endpoints */
{
.url = "extensions",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler.get = &handle_get_extensions,
+ .nargs = 4, /* Arbitrary upper bound */
+ .nargs_is_upper_bound = true,
+ },
+ {
+ .url = "extensions",
.method = MHD_HTTP_METHOD_POST,
.handler.post = &handle_post_extensions,
.nargs = 4, /* Arbitrary upper bound */