diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-06-18 18:16:22 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-06-18 18:16:22 +0000 |
commit | 5dfc382a9f8467cd15b6a0c3a6e022fca9fc4a30 (patch) | |
tree | 5d285afb370bb3d5800c3541a20760ab3db845d6 /src/namestore | |
parent | d3ba7a63bb47299d70fe7895e5df9a523607492e (diff) | |
download | gnunet-5dfc382a9f8467cd15b6a0c3a6e022fca9fc4a30.tar.gz gnunet-5dfc382a9f8467cd15b6a0c3a6e022fca9fc4a30.zip |
- fix rest plugin
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/Makefile.am | 1 | ||||
-rw-r--r-- | src/namestore/plugin_rest_namestore.c | 26 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am index 5fddebfa8..50b33a18a 100644 --- a/src/namestore/Makefile.am +++ b/src/namestore/Makefile.am | |||
@@ -195,6 +195,7 @@ libgnunet_plugin_rest_namestore_la_LIBADD = \ | |||
195 | $(top_builddir)/src/rest/libgnunetrest.la \ | 195 | $(top_builddir)/src/rest/libgnunetrest.la \ |
196 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 196 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
197 | $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ | 197 | $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ |
198 | $(top_builddir)/src/jsonapi/libgnunetjsonapiutils.la \ | ||
198 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ | 199 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ |
199 | $(LTLIBINTL) -ljansson -lmicrohttpd | 200 | $(LTLIBINTL) -ljansson -lmicrohttpd |
200 | libgnunet_plugin_rest_namestore_la_LDFLAGS = \ | 201 | libgnunet_plugin_rest_namestore_la_LDFLAGS = \ |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 873a12b83..42959bed8 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -358,7 +358,7 @@ static void | |||
358 | do_error (void *cls) | 358 | do_error (void *cls) |
359 | { | 359 | { |
360 | struct RequestHandle *handle = cls; | 360 | struct RequestHandle *handle = cls; |
361 | struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL); | 361 | struct MHD_Response *resp = GNUNET_REST_create_response (NULL); |
362 | 362 | ||
363 | handle->proc (handle->proc_cls, resp, handle->response_code); | 363 | handle->proc (handle->proc_cls, resp, handle->response_code); |
364 | cleanup_handle (handle); | 364 | cleanup_handle (handle); |
@@ -419,9 +419,9 @@ namestore_list_response (void *cls, | |||
419 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 419 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
420 | return; | 420 | return; |
421 | } | 421 | } |
422 | resp = GNUNET_REST_create_json_response (result); | 422 | resp = GNUNET_REST_create_response (result); |
423 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 423 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
424 | GNUNET_free (result); | 424 | GNUNET_free_non_null (result); |
425 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); | 425 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); |
426 | return; | 426 | return; |
427 | } | 427 | } |
@@ -480,7 +480,7 @@ create_finished (void *cls, int32_t success, const char *emsg) | |||
480 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); | 480 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); |
481 | return; | 481 | return; |
482 | } | 482 | } |
483 | resp = GNUNET_REST_create_json_response (NULL); | 483 | resp = GNUNET_REST_create_response (NULL); |
484 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NO_CONTENT); | 484 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NO_CONTENT); |
485 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); | 485 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); |
486 | } | 486 | } |
@@ -517,7 +517,7 @@ create_new_record_cont (void *cls, | |||
517 | if (0 != rd_count) | 517 | if (0 != rd_count) |
518 | { | 518 | { |
519 | handle->proc (handle->proc_cls, | 519 | handle->proc (handle->proc_cls, |
520 | GNUNET_REST_create_json_response (NULL), | 520 | GNUNET_REST_create_response (NULL), |
521 | MHD_HTTP_CONFLICT); | 521 | MHD_HTTP_CONFLICT); |
522 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); | 522 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); |
523 | return; | 523 | return; |
@@ -560,7 +560,7 @@ del_finished (void *cls, | |||
560 | return; | 560 | return; |
561 | } | 561 | } |
562 | handle->proc (handle->proc_cls, | 562 | handle->proc (handle->proc_cls, |
563 | GNUNET_REST_create_json_response (NULL), | 563 | GNUNET_REST_create_response (NULL), |
564 | MHD_HTTP_NO_CONTENT); | 564 | MHD_HTTP_NO_CONTENT); |
565 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); | 565 | GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); |
566 | } | 566 | } |
@@ -767,7 +767,7 @@ namestore_create_cont (struct GNUNET_REST_RequestHandle *con, | |||
767 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 767 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
768 | "Unsupported JSON data type\n"); | 768 | "Unsupported JSON data type\n"); |
769 | GNUNET_JSONAPI_document_delete (json_obj); | 769 | GNUNET_JSONAPI_document_delete (json_obj); |
770 | resp = GNUNET_REST_create_json_response (NULL); | 770 | resp = GNUNET_REST_create_response (NULL); |
771 | handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT); | 771 | handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT); |
772 | cleanup_handle (handle); | 772 | cleanup_handle (handle); |
773 | return; | 773 | return; |
@@ -831,7 +831,7 @@ namestore_zkey_response (void *cls, | |||
831 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 831 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
832 | return; | 832 | return; |
833 | } | 833 | } |
834 | resp = GNUNET_REST_create_json_response (result); | 834 | resp = GNUNET_REST_create_response (result); |
835 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 835 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
836 | GNUNET_JSONAPI_document_delete (json_obj); | 836 | GNUNET_JSONAPI_document_delete (json_obj); |
837 | GNUNET_free (result); | 837 | GNUNET_free (result); |
@@ -916,7 +916,7 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
916 | struct RequestHandle *handle = cls; | 916 | struct RequestHandle *handle = cls; |
917 | 917 | ||
918 | //For now, independent of path return all options | 918 | //For now, independent of path return all options |
919 | resp = GNUNET_REST_create_json_response (NULL); | 919 | resp = GNUNET_REST_create_response (NULL); |
920 | MHD_add_response_header (resp, | 920 | MHD_add_response_header (resp, |
921 | "Access-Control-Allow-Methods", | 921 | "Access-Control-Allow-Methods", |
922 | allow_methods); | 922 | allow_methods); |
@@ -999,7 +999,7 @@ identity_cb (void *cls, | |||
999 | _("Ego `%s' not known to identity service\n"), | 999 | _("Ego `%s' not known to identity service\n"), |
1000 | handle->ego_name); | 1000 | handle->ego_name); |
1001 | } | 1001 | } |
1002 | resp = GNUNET_REST_create_json_response (NULL); | 1002 | resp = GNUNET_REST_create_response (NULL); |
1003 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); | 1003 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); |
1004 | cleanup_handle (handle); | 1004 | cleanup_handle (handle); |
1005 | return; | 1005 | return; |
@@ -1024,7 +1024,7 @@ default_ego_cb (void *cls, | |||
1024 | { | 1024 | { |
1025 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1025 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1026 | _("No default ego configured in identity service\n")); | 1026 | _("No default ego configured in identity service\n")); |
1027 | resp = GNUNET_REST_create_json_response (NULL); | 1027 | resp = GNUNET_REST_create_response (NULL); |
1028 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); | 1028 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); |
1029 | cleanup_handle (handle); | 1029 | cleanup_handle (handle); |
1030 | return; | 1030 | return; |
@@ -1064,7 +1064,7 @@ testservice_id_task (void *cls, int result) | |||
1064 | { | 1064 | { |
1065 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1065 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1066 | _("Identity service is not running\n")); | 1066 | _("Identity service is not running\n")); |
1067 | resp = GNUNET_REST_create_json_response (NULL); | 1067 | resp = GNUNET_REST_create_response (NULL); |
1068 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); | 1068 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); |
1069 | cleanup_handle (handle); | 1069 | cleanup_handle (handle); |
1070 | return; | 1070 | return; |
@@ -1105,7 +1105,7 @@ testservice_id_task (void *cls, int result) | |||
1105 | if (NULL == handle->identity_handle) | 1105 | if (NULL == handle->identity_handle) |
1106 | { | 1106 | { |
1107 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Cannot connect to identity service\n")); | 1107 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Cannot connect to identity service\n")); |
1108 | resp = GNUNET_REST_create_json_response (NULL); | 1108 | resp = GNUNET_REST_create_response (NULL); |
1109 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); | 1109 | handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND); |
1110 | cleanup_handle (handle); | 1110 | cleanup_handle (handle); |
1111 | } | 1111 | } |