diff options
Diffstat (limited to 'src/service/rest/gnunet-rest-server.c')
-rw-r--r-- | src/service/rest/gnunet-rest-server.c | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/src/service/rest/gnunet-rest-server.c b/src/service/rest/gnunet-rest-server.c index 7cc4025b0..c4b59de96 100644 --- a/src/service/rest/gnunet-rest-server.c +++ b/src/service/rest/gnunet-rest-server.c | |||
@@ -1028,6 +1028,7 @@ do_shutdown (void *cls) | |||
1028 | kill_httpd (); | 1028 | kill_httpd (); |
1029 | GNUNET_free (allow_credentials); | 1029 | GNUNET_free (allow_credentials); |
1030 | GNUNET_free (allow_headers); | 1030 | GNUNET_free (allow_headers); |
1031 | MHD_destroy_response (failure_response); | ||
1031 | } | 1032 | } |
1032 | 1033 | ||
1033 | 1034 | ||
@@ -1145,10 +1146,10 @@ setup_plugin (const char *name, | |||
1145 | */ | 1146 | */ |
1146 | static void | 1147 | static void |
1147 | run (void *cls, | 1148 | run (void *cls, |
1148 | char *const *args, | 1149 | const struct GNUNET_CONFIGURATION_Handle *c, |
1149 | const char *cfgfile, | 1150 | struct GNUNET_SERVICE_Handle *service) |
1150 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
1151 | { | 1151 | { |
1152 | static const char *err_page = "{}"; | ||
1152 | char *addr_str; | 1153 | char *addr_str; |
1153 | char *basic_auth_file; | 1154 | char *basic_auth_file; |
1154 | uint64_t secret; | 1155 | uint64_t secret; |
@@ -1156,6 +1157,9 @@ run (void *cls, | |||
1156 | cfg = c; | 1157 | cfg = c; |
1157 | plugins_head = NULL; | 1158 | plugins_head = NULL; |
1158 | plugins_tail = NULL; | 1159 | plugins_tail = NULL; |
1160 | failure_response = MHD_create_response_from_buffer (strlen (err_page), | ||
1161 | (void *) err_page, | ||
1162 | MHD_RESPMEM_PERSISTENT); | ||
1159 | /* Get port to bind to */ | 1163 | /* Get port to bind to */ |
1160 | if (GNUNET_OK != | 1164 | if (GNUNET_OK != |
1161 | GNUNET_CONFIGURATION_get_value_number (cfg, "rest", "HTTP_PORT", &port)) | 1165 | GNUNET_CONFIGURATION_get_value_number (cfg, "rest", "HTTP_PORT", &port)) |
@@ -1419,42 +1423,6 @@ run (void *cls, | |||
1419 | } | 1423 | } |
1420 | 1424 | ||
1421 | 1425 | ||
1422 | /** | 1426 | GNUNET_DAEMON_MAIN("rest", _("GNUnet REST service"), &run) |
1423 | * | ||
1424 | * The main function for gnunet-rest-service | ||
1425 | * | ||
1426 | * @param argc number of arguments from the cli | ||
1427 | * @param argv command line arguments | ||
1428 | * @return 0 ok, 1 on error | ||
1429 | * | ||
1430 | */ | ||
1431 | int | ||
1432 | main (int argc, char *const *argv) | ||
1433 | { | ||
1434 | struct GNUNET_GETOPT_CommandLineOption options[] = | ||
1435 | { GNUNET_GETOPT_OPTION_END }; | ||
1436 | static const char *err_page = "{}"; | ||
1437 | int ret; | ||
1438 | |||
1439 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | ||
1440 | return 2; | ||
1441 | GNUNET_log_setup ("gnunet-rest-server", "WARNING", NULL); | ||
1442 | failure_response = MHD_create_response_from_buffer (strlen (err_page), | ||
1443 | (void *) err_page, | ||
1444 | MHD_RESPMEM_PERSISTENT); | ||
1445 | ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, | ||
1446 | argv, | ||
1447 | "gnunet-rest-server", | ||
1448 | _ ("GNUnet REST server"), | ||
1449 | options, | ||
1450 | &run, | ||
1451 | NULL)) | ||
1452 | ? 0 | ||
1453 | : 1; | ||
1454 | MHD_destroy_response (failure_response); | ||
1455 | GNUNET_free_nz ((char *) argv); | ||
1456 | return ret; | ||
1457 | } | ||
1458 | |||
1459 | 1427 | ||
1460 | /* end of gnunet-rest-server.c */ | 1428 | /* end of gnunet-rest-server.c */ |