static gboolean meta1_dispatch_v2_SRV_UNLINK(struct gridd_reply_ctx_s *reply, struct meta1_backend_s *m1, gpointer ignored) { gchar **urlv = NULL; GError *err; gchar *srvtype = metautils_message_extract_string_copy (reply->request, NAME_MSGKEY_TYPENAME); struct oio_url_s *url = metautils_message_extract_url (reply->request); reply->subject("%s|%s|%s", oio_url_get(url, OIOURL_WHOLE), oio_url_get(url, OIOURL_HEXID), srvtype); (void) ignored; if (!srvtype) reply->send_error(CODE_BAD_REQUEST, NEWERROR(CODE_BAD_REQUEST, "Missing srvtype")); else if (NULL != (err = metautils_message_extract_body_strv(reply->request, &urlv))) reply->send_error(CODE_BAD_REQUEST, err); else if (NULL != (err = meta1_backend_services_unlink(m1, url, srvtype, urlv))) reply->send_error(0, err); else reply->send_reply(CODE_FINAL_OK, "OK"); if (urlv) g_strfreev (urlv); oio_url_clean (url); g_free0 (srvtype); return TRUE; }
static gboolean meta1_dispatch_v2_SRV_UNLINK(struct gridd_reply_ctx_s *reply, struct meta1_backend_s *m1, gpointer ignored UNUSED) { gchar *srvtype = metautils_message_extract_string_copy (reply->request, NAME_MSGKEY_TYPENAME); struct oio_url_s *url = metautils_message_extract_url (reply->request); reply->subject("%s|%s|%s", oio_url_get(url, OIOURL_WHOLE), oio_url_get(url, OIOURL_HEXID), srvtype); if (!srvtype) reply->send_error(CODE_BAD_REQUEST, NEWERROR(CODE_BAD_REQUEST, "Missing srvtype")); else { gsize length = 0; void *body = metautils_message_get_BODY(reply->request, &length); gchar **urlv = NULL; GError *err = STRV_decode_buffer(body, length, &urlv); if (NULL != err) reply->send_error(CODE_BAD_REQUEST, err); else { err = meta1_backend_services_unlink(m1, url, srvtype, urlv); if (NULL != err) reply->send_error(0, err); else reply->send_reply(CODE_FINAL_OK, "OK"); g_strfreev (urlv); } } oio_url_clean (url); g_free0 (srvtype); return TRUE; }