aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/plugin_rest_namestore.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2017-05-12 19:20:53 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2017-05-12 19:20:53 +0200
commit56e4af789bcffac72eecacbec7156597a4b1c5b7 (patch)
treee09aaa1e55b05b2a27eae20f80931b4e13e0137d /src/namestore/plugin_rest_namestore.c
parent80a88ff17fd8e37f0ce27fe6a5d6c5dfa1dcfdf7 (diff)
downloadgnunet-56e4af789bcffac72eecacbec7156597a4b1c5b7.tar.gz
gnunet-56e4af789bcffac72eecacbec7156597a4b1c5b7.zip
-fix
Diffstat (limited to 'src/namestore/plugin_rest_namestore.c')
-rw-r--r--src/namestore/plugin_rest_namestore.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 50957a5b4..05776801b 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -401,11 +401,16 @@ namestore_list_finished (void *cls)
401 struct MHD_Response *resp; 401 struct MHD_Response *resp;
402 402
403 handle->list_it = NULL; 403 handle->list_it = NULL;
404 if (NULL == handle->resp_object)
405 handle->resp_object = GNUNET_JSONAPI_document_new ();
406
404 if (GNUNET_SYSERR == 407 if (GNUNET_SYSERR ==
405 GNUNET_JSONAPI_document_serialize (handle->resp_object, 408 GNUNET_JSONAPI_document_serialize (handle->resp_object,
406 &result)) 409 &result))
407 { 410 {
408 do_error (handle); 411 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
412 GNUNET_SCHEDULER_add_now (&do_error,
413 handle);
409 return; 414 return;
410 } 415 }
411 resp = GNUNET_REST_create_response (result); 416 resp = GNUNET_REST_create_response (result);
@@ -467,10 +472,10 @@ namestore_list_response (void *cls,
467 if (0 < json_array_size(result_array)) 472 if (0 < json_array_size(result_array))
468 { 473 {
469 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_NAMESTORE_TYPEINFO, 474 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_NAMESTORE_TYPEINFO,
470 rname); 475 rname);
471 GNUNET_JSONAPI_resource_add_attr (json_resource, 476 GNUNET_JSONAPI_resource_add_attr (json_resource,
472 GNUNET_REST_JSONAPI_NAMESTORE_RECORD, 477 GNUNET_REST_JSONAPI_NAMESTORE_RECORD,
473 result_array); 478 result_array);
474 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource); 479 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
475 } 480 }
476 481
@@ -767,8 +772,8 @@ namestore_create_cont (struct GNUNET_REST_RequestHandle *con,
767 } 772 }
768 term_data[handle->rest_handle->data_size] = '\0'; 773 term_data[handle->rest_handle->data_size] = '\0';
769 GNUNET_memcpy (term_data, 774 GNUNET_memcpy (term_data,
770 handle->rest_handle->data, 775 handle->rest_handle->data,
771 handle->rest_handle->data_size); 776 handle->rest_handle->data_size);
772 data_js = json_loads (term_data, 777 data_js = json_loads (term_data,
773 JSON_DECODE_ANY, 778 JSON_DECODE_ANY,
774 &err); 779 &err);
@@ -902,7 +907,7 @@ namestore_zkey_cont (struct GNUNET_REST_RequestHandle *con,
902 if ((NULL == handle->zkey_str) || 907 if ((NULL == handle->zkey_str) ||
903 (GNUNET_OK != 908 (GNUNET_OK !=
904 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str, 909 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str,
905 strlen (handle->zkey_str), 910 strlen (handle->zkey_str),
906 &pubkey))) 911 &pubkey)))
907 { 912 {
908 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 913 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1021,13 +1026,13 @@ identity_cb (void *cls,
1021 1026
1022 if (GNUNET_OK != 1027 if (GNUNET_OK !=
1023 GNUNET_JSONAPI_handle_request (handle->rest_handle, 1028 GNUNET_JSONAPI_handle_request (handle->rest_handle,
1024 handlers, 1029 handlers,
1025 &err, 1030 &err,
1026 handle)) 1031 handle))
1027 { 1032 {
1028 handle->response_code = err.error_code; 1033 handle->response_code = err.error_code;
1029 GNUNET_SCHEDULER_add_now (&do_error, 1034 GNUNET_SCHEDULER_add_now (&do_error,
1030 (void *) handle); 1035 (void *) handle);
1031 } 1036 }
1032} 1037}
1033 1038