aboutsummaryrefslogtreecommitdiff
path: root/src/identity/plugin_rest_identity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity/plugin_rest_identity.c')
-rw-r--r--src/identity/plugin_rest_identity.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index dba1d478d..d7cd0e826 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -322,7 +322,9 @@ do_error (void *cls)
322 handle->response_code = MHD_HTTP_OK; 322 handle->response_code = MHD_HTTP_OK;
323 response = json_dumps (json_error, 0); 323 response = json_dumps (json_error, 0);
324 resp = GNUNET_REST_create_response (response); 324 resp = GNUNET_REST_create_response (response);
325 MHD_add_response_header (resp, "Content-Type", "application/json"); 325 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
326 "Content-Type",
327 "application/json"));
326 handle->proc (handle->proc_cls, resp, handle->response_code); 328 handle->proc (handle->proc_cls, resp, handle->response_code);
327 json_decref (json_error); 329 json_decref (json_error);
328 GNUNET_free (response); 330 GNUNET_free (response);
@@ -412,7 +414,9 @@ ego_get_for_subsystem (void *cls,
412 result_str = json_dumps (json_root, 0); 414 result_str = json_dumps (json_root, 0);
413 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 415 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
414 resp = GNUNET_REST_create_response (result_str); 416 resp = GNUNET_REST_create_response (result_str);
415 MHD_add_response_header (resp, "Content-Type", "application/json"); 417 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
418 "Content-Type",
419 "application/json"));
416 json_decref (json_root); 420 json_decref (json_root);
417 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 421 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
418 GNUNET_free (result_str); 422 GNUNET_free (result_str);
@@ -514,7 +518,9 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
514 result_str = json_dumps (json_root, 0); 518 result_str = json_dumps (json_root, 0);
515 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
516 resp = GNUNET_REST_create_response (result_str); 520 resp = GNUNET_REST_create_response (result_str);
517 MHD_add_response_header (resp, "Content-Type", "application/json"); 521 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
522 "Content-Type",
523 "application/json"));
518 json_decref (json_root); 524 json_decref (json_root);
519 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 525 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
520 GNUNET_free (result_str); 526 GNUNET_free (result_str);
@@ -561,7 +567,9 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry)
561 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
562 resp = GNUNET_REST_create_response (result_str); 568 resp = GNUNET_REST_create_response (result_str);
563 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 569 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
564 MHD_add_response_header (resp, "Content-Type", "application/json"); 570 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
571 "Content-Type",
572 "application/json"));
565 json_decref (json_ego); 573 json_decref (json_ego);
566 GNUNET_free (result_str); 574 GNUNET_free (result_str);
567 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 575 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
@@ -1195,7 +1203,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle,
1195 1203
1196 // For now, independent of path return all options 1204 // For now, independent of path return all options
1197 resp = GNUNET_REST_create_response (NULL); 1205 resp = GNUNET_REST_create_response (NULL);
1198 MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); 1206 GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
1207 "Access-Control-Allow-Methods",
1208 allow_methods));
1199 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 1209 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
1200 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 1210 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
1201 return; 1211 return;
@@ -1216,6 +1226,12 @@ list_ego (void *cls,
1216 state = ID_REST_STATE_POST_INIT; 1226 state = ID_REST_STATE_POST_INIT;
1217 return; 1227 return;
1218 } 1228 }
1229 if (NULL == ego)
1230 {
1231 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1232 "Called with NULL ego\n");
1233 return;
1234 }
1219 if (ID_REST_STATE_INIT == state) 1235 if (ID_REST_STATE_INIT == state)
1220 { 1236 {
1221 ego_entry = GNUNET_new (struct EgoEntry); 1237 ego_entry = GNUNET_new (struct EgoEntry);