gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37273 - in gnunet/src: gns identity include namestore


From: gnunet
Subject: [GNUnet-SVN] r37273 - in gnunet/src: gns identity include namestore
Date: Sat, 18 Jun 2016 20:16:22 +0200

Author: schanzen
Date: 2016-06-18 20:16:22 +0200 (Sat, 18 Jun 2016)
New Revision: 37273

Modified:
   gnunet/src/gns/Makefile.am
   gnunet/src/gns/plugin_rest_gns.c
   gnunet/src/identity/Makefile.am
   gnunet/src/identity/plugin_rest_identity.c
   gnunet/src/include/gnunet_rest_lib.h
   gnunet/src/namestore/Makefile.am
   gnunet/src/namestore/plugin_rest_namestore.c
Log:
- fix rest plugin


Modified: gnunet/src/gns/Makefile.am
===================================================================
--- gnunet/src/gns/Makefile.am  2016-06-18 18:03:42 UTC (rev 37272)
+++ gnunet/src/gns/Makefile.am  2016-06-18 18:16:22 UTC (rev 37273)
@@ -237,6 +237,7 @@
        $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \
+  $(top_builddir)/src/jsonapi/libgnunetjsonapiutils.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson -lmicrohttpd
 libgnunet_plugin_rest_gns_la_LDFLAGS = \

Modified: gnunet/src/gns/plugin_rest_gns.c
===================================================================
--- gnunet/src/gns/plugin_rest_gns.c    2016-06-18 18:03:42 UTC (rev 37272)
+++ gnunet/src/gns/plugin_rest_gns.c    2016-06-18 18:16:22 UTC (rev 37273)
@@ -228,7 +228,7 @@
   struct LookupHandle *handle = cls;
   struct MHD_Response *resp;
 
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   handle->proc (handle->proc_cls, resp, handle->response_code);
   cleanup_handle (handle);
 }
@@ -324,7 +324,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
   json_decref (result_array);
   GNUNET_JSONAPI_document_delete (json_document);
-  resp = GNUNET_REST_create_json_response (result);
+  resp = GNUNET_REST_create_response (result);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result);
   cleanup_handle (handle);
@@ -640,7 +640,7 @@
   struct LookupHandle *handle = cls;
 
   //For GNS, independent of path return all options
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   MHD_add_response_header (resp,
                            "Access-Control-Allow-Methods",
                            MHD_HTTP_METHOD_GET);

Modified: gnunet/src/identity/Makefile.am
===================================================================
--- gnunet/src/identity/Makefile.am     2016-06-18 18:03:42 UTC (rev 37272)
+++ gnunet/src/identity/Makefile.am     2016-06-18 18:16:22 UTC (rev 37273)
@@ -70,6 +70,7 @@
        libgnunetidentity.la \
   $(top_builddir)/src/rest/libgnunetrest.la \
        $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \
+  $(top_builddir)/src/jsonapi/libgnunetjsonapiutils.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson -lmicrohttpd
 libgnunet_plugin_rest_identity_la_LDFLAGS = \

Modified: gnunet/src/identity/plugin_rest_identity.c
===================================================================
--- gnunet/src/identity/plugin_rest_identity.c  2016-06-18 18:03:42 UTC (rev 
37272)
+++ gnunet/src/identity/plugin_rest_identity.c  2016-06-18 18:16:22 UTC (rev 
37273)
@@ -279,7 +279,7 @@
                    "{Error while processing request: %s}",
                    &handle->emsg);
 
-  resp = GNUNET_REST_create_json_response (json_error);
+  resp = GNUNET_REST_create_response (json_error);
   handle->proc (handle->proc_cls,
                resp,
                handle->response_code);
@@ -339,7 +339,7 @@
   }
   GNUNET_JSONAPI_document_serialize (json_document, &result_str);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
-  resp = GNUNET_REST_create_json_response (result_str);
+  resp = GNUNET_REST_create_response (result_str);
   GNUNET_JSONAPI_document_delete (json_document);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result_str);
@@ -372,7 +372,7 @@
 
   if (GNUNET_NO == GNUNET_REST_namespace_match (handle->url, 
GNUNET_REST_API_NS_IDENTITY))
   {
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST);
     cleanup_handle (handle);
     return;
@@ -444,7 +444,7 @@
   }
   GNUNET_JSONAPI_document_serialize (json_document, &result_str);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
-  resp = GNUNET_REST_create_json_response (result_str);
+  resp = GNUNET_REST_create_response (result_str);
   GNUNET_JSONAPI_document_delete (json_document);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result_str);
@@ -470,7 +470,7 @@
     GNUNET_SCHEDULER_add_now (&do_error, handle);
     return;
   }
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_NO_CONTENT);
   cleanup_handle (handle);
 }
@@ -528,7 +528,7 @@
   if (GNUNET_NO == GNUNET_JSONAPI_resource_check_type (json_res, 
GNUNET_REST_JSONAPI_IDENTITY_EGO))
   {
     GNUNET_JSONAPI_document_delete (json_obj);
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
     cleanup_handle (handle);
     return;
@@ -549,7 +549,7 @@
     if (0 == strcasecmp (egoname, ego_entry->identifier))
     {
       GNUNET_JSONAPI_document_delete (json_obj);
-      resp = GNUNET_REST_create_json_response (NULL);
+      resp = GNUNET_REST_create_response (NULL);
       handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
       cleanup_handle (handle);
       return;
@@ -610,7 +610,7 @@
 
   if (GNUNET_NO == ego_exists)
   {
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
     cleanup_handle (handle);
     return;
@@ -667,7 +667,7 @@
       {
         //Ego with same name not allowed
         GNUNET_JSONAPI_document_delete (json_obj);
-        resp = GNUNET_REST_create_json_response (NULL);
+        resp = GNUNET_REST_create_response (NULL);
         handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
         cleanup_handle (handle);
         return;
@@ -731,7 +731,7 @@
   }
   if (GNUNET_NO == ego_exists)
   {
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
     cleanup_handle (handle);
     return;
@@ -760,7 +760,7 @@
   struct RequestHandle *handle = cls;
 
   //For now, independent of path return all options
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   MHD_add_response_header (resp,
                            "Access-Control-Allow-Methods",
                            allow_methods);

Modified: gnunet/src/include/gnunet_rest_lib.h
===================================================================
--- gnunet/src/include/gnunet_rest_lib.h        2016-06-18 18:03:42 UTC (rev 
37272)
+++ gnunet/src/include/gnunet_rest_lib.h        2016-06-18 18:16:22 UTC (rev 
37273)
@@ -95,13 +95,13 @@
 GNUNET_REST_namespace_match (const char *url, const char *namespace);
 
 /**
- * Create JSON API MHD response
+ * Create REST MHD response
  *
- * @param data JSON result
+ * @param data result
  * @retun MHD response
  */
  struct MHD_Response*
-GNUNET_REST_create_json_response (const char *data);
+GNUNET_REST_create_response (const char *data);
 
 
 int

Modified: gnunet/src/namestore/Makefile.am
===================================================================
--- gnunet/src/namestore/Makefile.am    2016-06-18 18:03:42 UTC (rev 37272)
+++ gnunet/src/namestore/Makefile.am    2016-06-18 18:16:22 UTC (rev 37273)
@@ -195,6 +195,7 @@
   $(top_builddir)/src/rest/libgnunetrest.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \
+  $(top_builddir)/src/jsonapi/libgnunetjsonapiutils.la \  
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
   $(LTLIBINTL) -ljansson -lmicrohttpd
 libgnunet_plugin_rest_namestore_la_LDFLAGS = \

Modified: gnunet/src/namestore/plugin_rest_namestore.c
===================================================================
--- gnunet/src/namestore/plugin_rest_namestore.c        2016-06-18 18:03:42 UTC 
(rev 37272)
+++ gnunet/src/namestore/plugin_rest_namestore.c        2016-06-18 18:16:22 UTC 
(rev 37273)
@@ -358,7 +358,7 @@
 do_error (void *cls)
 {
   struct RequestHandle *handle = cls;
-  struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL);
+  struct MHD_Response *resp = GNUNET_REST_create_response (NULL);
 
   handle->proc (handle->proc_cls, resp, handle->response_code);
   cleanup_handle (handle);
@@ -419,9 +419,9 @@
       GNUNET_SCHEDULER_add_now (&do_error, handle);
       return;
     }
-    resp = GNUNET_REST_create_json_response (result);
+    resp = GNUNET_REST_create_response (result);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-    GNUNET_free (result);
+    GNUNET_free_non_null (result);
     GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
     return;
   }
@@ -480,7 +480,7 @@
     GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
     return;
   }
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_NO_CONTENT);
   GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
 }
@@ -517,7 +517,7 @@
   if (0 != rd_count)
   {
     handle->proc (handle->proc_cls,
-                  GNUNET_REST_create_json_response (NULL),
+                  GNUNET_REST_create_response (NULL),
                   MHD_HTTP_CONFLICT);
     GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
     return;
@@ -560,7 +560,7 @@
     return;
   }
   handle->proc (handle->proc_cls,
-                GNUNET_REST_create_json_response (NULL),
+                GNUNET_REST_create_response (NULL),
                 MHD_HTTP_NO_CONTENT);
   GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
 }
@@ -767,7 +767,7 @@
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unsupported JSON data type\n");
     GNUNET_JSONAPI_document_delete (json_obj);
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_CONFLICT);
     cleanup_handle (handle);
     return;
@@ -831,7 +831,7 @@
     GNUNET_SCHEDULER_add_now (&do_error, handle);
     return;
   }
-  resp = GNUNET_REST_create_json_response (result);
+  resp = GNUNET_REST_create_response (result);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_JSONAPI_document_delete (json_obj);
   GNUNET_free (result);
@@ -916,7 +916,7 @@
   struct RequestHandle *handle = cls;
 
   //For now, independent of path return all options
-  resp = GNUNET_REST_create_json_response (NULL);
+  resp = GNUNET_REST_create_response (NULL);
   MHD_add_response_header (resp,
                            "Access-Control-Allow-Methods",
                            allow_methods);
@@ -999,7 +999,7 @@
                   _("Ego `%s' not known to identity service\n"),
                   handle->ego_name);
     }
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
     cleanup_handle (handle);
     return;
@@ -1024,7 +1024,7 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("No default ego configured in identity service\n"));
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
     cleanup_handle (handle);
     return;
@@ -1064,7 +1064,7 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("Identity service is not running\n"));
-    resp = GNUNET_REST_create_json_response (NULL);
+    resp = GNUNET_REST_create_response (NULL);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
     cleanup_handle (handle);
     return;
@@ -1105,7 +1105,7 @@
     if (NULL == handle->identity_handle)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Cannot connect to identity 
service\n"));
-      resp = GNUNET_REST_create_json_response (NULL);
+      resp = GNUNET_REST_create_response (NULL);
       handle->proc (handle->proc_cls, resp, MHD_HTTP_NOT_FOUND);
       cleanup_handle (handle);
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]