aboutsummaryrefslogtreecommitdiff
path: root/src/gns/plugin_rest_gns.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-30 17:57:20 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-30 17:57:20 +0200
commitc171a099e07baa1afcaf8f6a5030a8b8be8886a5 (patch)
tree9a29c7318a5f61ce32fb071a2d0ea0db4b8fefa8 /src/gns/plugin_rest_gns.c
parentb0b190fb57a4bb5eb4f9c5b1da6a4311496112e1 (diff)
downloadgnunet-c171a099e07baa1afcaf8f6a5030a8b8be8886a5.tar.gz
gnunet-c171a099e07baa1afcaf8f6a5030a8b8be8886a5.zip
REST: ftbfs
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r--src/gns/plugin_rest_gns.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index e41df4085..21638fdf6 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -100,7 +100,7 @@ struct RequestHandle
100 * Rest connection 100 * Rest connection
101 */ 101 */
102 struct GNUNET_REST_RequestHandle *rest_handle; 102 struct GNUNET_REST_RequestHandle *rest_handle;
103 103
104 /** 104 /**
105 * Desired timeout for the lookup (default is no timeout). 105 * Desired timeout for the lookup (default is no timeout).
106 */ 106 */
@@ -172,7 +172,7 @@ cleanup_handle (void *cls)
172 GNUNET_free (handle->name); 172 GNUNET_free (handle->name);
173 if (NULL != handle->emsg) 173 if (NULL != handle->emsg)
174 GNUNET_free (handle->emsg); 174 GNUNET_free (handle->emsg);
175 175
176 GNUNET_free (handle); 176 GNUNET_free (handle);
177} 177}
178 178
@@ -222,8 +222,7 @@ handle_gns_response (void *cls,
222{ 222{
223 struct RequestHandle *handle = cls; 223 struct RequestHandle *handle = cls;
224 struct MHD_Response *resp; 224 struct MHD_Response *resp;
225 json_t *result_array; 225 json_t *result_obj;
226 json_t *record_obj;
227 char *result; 226 char *result;
228 227
229 handle->gns_lookup = NULL; 228 handle->gns_lookup = NULL;
@@ -236,26 +235,14 @@ handle_gns_response (void *cls,
236 return; 235 return;
237 } 236 }
238 237
239 result_array = json_array(); 238 result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count);
240 for (uint32_t i=0;i<rd_count;i++)
241 {
242 if ((rd[i].record_type != handle->record_type) &&
243 (GNUNET_GNSRECORD_TYPE_ANY != handle->record_type) )
244 {
245 continue;
246 }
247
248 record_obj = GNUNET_JSON_from_gns_record(NULL,&rd[i]);
249 json_array_append (result_array, record_obj);
250 json_decref (record_obj);
251 }
252 239
253 result = json_dumps(result_array, 0); 240 result = json_dumps(result_obj, 0);
254 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); 241 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
255 resp = GNUNET_REST_create_response (result); 242 resp = GNUNET_REST_create_response (result);
256 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 243 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
257 GNUNET_free (result); 244 GNUNET_free (result);
258 json_decref (result_array); 245 json_decref (result_obj);
259 GNUNET_SCHEDULER_add_now(&cleanup_handle, handle); 246 GNUNET_SCHEDULER_add_now(&cleanup_handle, handle);
260} 247}
261 248