diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-26 18:30:11 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-26 18:30:11 +0000 |
commit | 569c29270cb9fdc4c236795ecef2d895a3ecbd76 (patch) | |
tree | 81d9be207d60c796f3deaaf3bef91ae1d883cf18 /src/gns/plugin_rest_gns.c | |
parent | ddbe636f3a013cde33ce94ecb9435bfd39f6355f (diff) | |
download | gnunet-569c29270cb9fdc4c236795ecef2d895a3ecbd76.tar.gz gnunet-569c29270cb9fdc4c236795ecef2d895a3ecbd76.zip |
-minor
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r-- | src/gns/plugin_rest_gns.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 1859a76e1..6922c7d79 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -34,10 +34,11 @@ | |||
34 | #include <gnunet_rest_lib.h> | 34 | #include <gnunet_rest_lib.h> |
35 | #include <jansson.h> | 35 | #include <jansson.h> |
36 | 36 | ||
37 | #define API_NAMESPACE "/gns" | 37 | #define API_NAMESPACE "/resolver" |
38 | 38 | ||
39 | #define GNUNET_REST_JSONAPI_GNS_RECORD_TYPE "record_type" | ||
39 | 40 | ||
40 | #define GNUNET_REST_JSONAPI_GNS_RECORD_TYPE "type" | 41 | #define GNUNET_REST_JSONAPI_GNS_TYPEINFO "gns_name" |
41 | 42 | ||
42 | #define GNUNET_REST_JSONAPI_GNS_RECORD "records" | 43 | #define GNUNET_REST_JSONAPI_GNS_RECORD "records" |
43 | 44 | ||
@@ -215,7 +216,7 @@ do_error (void *cls, | |||
215 | { | 216 | { |
216 | struct LookupHandle *handle = cls; | 217 | struct LookupHandle *handle = cls; |
217 | struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL); | 218 | struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL); |
218 | handle->proc (handle->proc_cls, resp, GNUNET_SYSERR); | 219 | handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST); |
219 | cleanup_handle (handle); | 220 | cleanup_handle (handle); |
220 | } | 221 | } |
221 | 222 | ||
@@ -291,7 +292,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
291 | 292 | ||
292 | result_array = json_array(); | 293 | result_array = json_array(); |
293 | json_object = GNUNET_REST_jsonapi_object_new (); | 294 | json_object = GNUNET_REST_jsonapi_object_new (); |
294 | json_resource = GNUNET_REST_jsonapi_resource_new (GNUNET_REST_JSONAPI_GNS_RECORD, handle->name); | 295 | json_resource = GNUNET_REST_jsonapi_resource_new (GNUNET_REST_JSONAPI_GNS_TYPEINFO, handle->name); |
295 | handle->lookup_request = NULL; | 296 | handle->lookup_request = NULL; |
296 | for (i=0; i<rd_count; i++) | 297 | for (i=0; i<rd_count; i++) |
297 | { | 298 | { |
@@ -521,6 +522,8 @@ rest_gns_process_request(struct RestConnectionDataHandle *conndata_handle, | |||
521 | struct GNUNET_HashCode key; | 522 | struct GNUNET_HashCode key; |
522 | 523 | ||
523 | handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 524 | handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
525 | handle->proc_cls = proc_cls; | ||
526 | handle->proc = proc; | ||
524 | //parse name and type from url | 527 | //parse name and type from url |
525 | if (GNUNET_OK != parse_url (conndata_handle->url, handle)) | 528 | if (GNUNET_OK != parse_url (conndata_handle->url, handle)) |
526 | { | 529 | { |
@@ -528,8 +531,6 @@ rest_gns_process_request(struct RestConnectionDataHandle *conndata_handle, | |||
528 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 531 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
529 | return; | 532 | return; |
530 | } | 533 | } |
531 | handle->proc_cls = proc_cls; | ||
532 | handle->proc = proc; | ||
533 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 534 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
534 | "Connecting...\n"); | 535 | "Connecting...\n"); |
535 | handle->gns = GNUNET_GNS_connect (cfg); | 536 | handle->gns = GNUNET_GNS_connect (cfg); |