summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd.c')
-rw-r--r--src/backend/taler-merchant-httpd.c59
1 files changed, 56 insertions, 3 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 9366c1bf..8e1a0fc0 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -459,6 +459,49 @@ handle_server_options (const struct TMH_RequestHandler *rh,
}
+static MHD_RESULT
+spa_redirect (const struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ struct TMH_HandlerContext *hc)
+{
+ const char *text = "Redirecting to /webui/";
+ struct MHD_Response *response;
+
+ response = MHD_create_response_from_buffer (strlen (text),
+ (void *) text,
+ MHD_RESPMEM_PERSISTENT);
+ if (NULL == response)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
+ TALER_MHD_add_global_headers (response);
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_CONTENT_TYPE,
+ "text/plain"));
+ if (MHD_NO ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_LOCATION,
+ "/webui/"))
+ {
+ GNUNET_break (0);
+ MHD_destroy_response (response);
+ return MHD_NO;
+ }
+
+ {
+ MHD_RESULT ret;
+
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_FOUND,
+ response);
+ MHD_destroy_response (response);
+ return ret;
+ }
+}
+
+
/**
* Extract the token from authorization header value @a auth.
*
@@ -637,7 +680,7 @@ url_handler (void *cls,
{
.url_prefix = "/instances/",
.method = MHD_HTTP_METHOD_DELETE,
- .skip_instance = true,
+ .skip_instance = true,
.default_only = true,
.have_id_segment = true,
.handler = &TMH_private_delete_instances_default_ID
@@ -1034,6 +1077,15 @@ url_handler (void *cls,
.method = MHD_HTTP_METHOD_GET,
.mime_type = "text/html",
.skip_instance = true,
+ .handler = &spa_redirect,
+ .response_code = MHD_HTTP_FOUND
+ },
+ {
+ .url_prefix = "/webui/",
+ .method = MHD_HTTP_METHOD_GET,
+ .mime_type = "text/html",
+ .skip_instance = true,
+ .have_id_segment = true,
.handler = &TMH_return_spa,
.response_code = MHD_HTTP_OK
},
@@ -1381,7 +1433,7 @@ url_handler (void *cls,
{
prefix_strlen = slash - url + 1; /* includes both '/'-es if present! */
infix_url = slash + 1;
- slash = strchr (&infix_url[1], '/');
+ slash = strchr (infix_url, '/');
if (NULL == slash)
{
/* the infix was the rest */
@@ -1903,7 +1955,8 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- TMH_statics_init ();
+ /* /static/ is currently not used */
+ /* (void) TMH_statics_init (); */
elen = TMH_EXCHANGES_init (config);
if (GNUNET_SYSERR == elen)
{