summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-08-12 01:46:11 +0200
committerPhil <phil.buschmann@tum.de>2018-08-12 01:46:11 +0200
commit89485145a0f33984a70bffdf0f766667b4a3e75e (patch)
tree6ae988962cd9ea31ceee7e7f20feaea3fb82c244
parent4898de50936164f8adb067c4f32fab62bec92e19 (diff)
rewrite error handling and subsystem PUT
-rw-r--r--src/identity/plugin_rest_identity.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index 89f6e7f8b..9f1765a63 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -560,6 +560,7 @@ ego_get_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_PUBKEY) >= strlen (handle->url))
{
+ handle->response_code = MHD_HTTP_NOT_FOUND;
handle->emsg = GNUNET_strdup(GNUNET_REST_IDENTITY_MISSING_PUBKEY);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
@@ -598,6 +599,7 @@ ego_get_name (struct GNUNET_REST_RequestHandle *con_handle,
if (strlen (GNUNET_REST_API_NS_IDENTITY_NAME) >= strlen (handle->url))
{
+ handle->response_code = MHD_HTTP_NOT_FOUND;
handle->emsg = GNUNET_strdup(GNUNET_REST_IDENTITY_MISSING_NAME);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
@@ -1036,7 +1038,6 @@ ego_delete_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
{
struct RequestHandle *handle = cls;
struct EgoEntry *ego_entry;
- struct MHD_Response *resp;
char *keystring;
keystring = NULL;
@@ -1053,9 +1054,9 @@ ego_delete_pubkey (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- resp = GNUNET_REST_create_response (NULL);
- handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
- GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
+ handle->response_code = MHD_HTTP_NOT_FOUND;
+ handle->emsg = GNUNET_strdup(GNUNET_REST_IDENTITY_NOT_FOUND);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -1081,7 +1082,6 @@ ego_delete_name (struct GNUNET_REST_RequestHandle *con_handle,
{
struct RequestHandle *handle = cls;
struct EgoEntry *ego_entry;
- struct MHD_Response *resp;
char *name;
name = NULL;
@@ -1098,9 +1098,9 @@ ego_delete_name (struct GNUNET_REST_RequestHandle *con_handle,
if (NULL == ego_entry)
{
- resp = GNUNET_REST_create_response (NULL);
- handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
- GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
+ handle->response_code = MHD_HTTP_NOT_FOUND;
+ handle->emsg = GNUNET_strdup(GNUNET_REST_IDENTITY_NOT_FOUND);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}