aboutsummaryrefslogtreecommitdiff
path: root/src/rest
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2015-07-10 16:17:30 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2015-07-10 16:17:30 +0000
commit9246b5973e3ae5eec1d51b35d942dd7e5e9f95d8 (patch)
tree45a4fad135ae25cb58be97e631e6116efce9e9f8 /src/rest
parent57eb2ec3125dbbf60a9d1a2635ddc19345e2e5c1 (diff)
downloadgnunet-9246b5973e3ae5eec1d51b35d942dd7e5e9f95d8.tar.gz
gnunet-9246b5973e3ae5eec1d51b35d942dd7e5e9f95d8.zip
- Identity token support
Diffstat (limited to 'src/rest')
-rw-r--r--src/rest/gnunet-rest-server.c23
-rw-r--r--src/rest/rest.c4
-rw-r--r--src/rest/rest.conf4
3 files changed, 13 insertions, 18 deletions
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index b2357bdf3..ba18c5dfa 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -336,20 +336,17 @@ create_response (void *cls,
336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
337 "Queueing response from plugin with MHD\n"); 337 "Queueing response from plugin with MHD\n");
338 //Handle Preflights 338 //Handle Preflights
339 if (0 == strcmp(meth, MHD_HTTP_METHOD_OPTIONS)) 339 if (NULL != allow_origin)
340 { 340 {
341 if (NULL != allow_origin) 341 MHD_add_response_header (con_handle->response,
342 { 342 MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
343 MHD_add_response_header (con_handle->response, 343 allow_origin);
344 MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, 344 }
345 allow_origin); 345 if (NULL != allow_headers)
346 } 346 {
347 if (NULL != allow_headers) 347 MHD_add_response_header (con_handle->response,
348 { 348 "Access-Control-Allow-Headers",
349 MHD_add_response_header (con_handle->response, 349 allow_headers);
350 "Access-Control-Allow-Headers",
351 allow_headers);
352 }
353 } 350 }
354 int ret = MHD_queue_response (con, 351 int ret = MHD_queue_response (con,
355 con_handle->status, 352 con_handle->status,
diff --git a/src/rest/rest.c b/src/rest/rest.c
index 02eca77e0..3a27c6813 100644
--- a/src/rest/rest.c
+++ b/src/rest/rest.c
@@ -227,11 +227,9 @@ add_json_resource (struct JsonApiObject *obj,
227{ 227{
228 struct JsonApiResource *res; 228 struct JsonApiResource *res;
229 json_t *type_json; 229 json_t *type_json;
230 json_t *id_json;
231 230
232 id_json = json_object_get (res_json, GNUNET_REST_JSONAPI_KEY_ID);
233 type_json = json_object_get (res_json, GNUNET_REST_JSONAPI_KEY_TYPE); 231 type_json = json_object_get (res_json, GNUNET_REST_JSONAPI_KEY_TYPE);
234 if (!json_is_string (id_json) || !json_is_string (type_json)) 232 if (!json_is_string (type_json))
235 return; 233 return;
236 res = GNUNET_new (struct JsonApiResource); 234 res = GNUNET_new (struct JsonApiResource);
237 res->next = NULL; 235 res->next = NULL;
diff --git a/src/rest/rest.conf b/src/rest/rest.conf
index 2ee3ba4b2..6cd013345 100644
--- a/src/rest/rest.conf
+++ b/src/rest/rest.conf
@@ -1,5 +1,5 @@
1[rest] 1[rest]
2BINARY=gnunet-rest-server 2BINARY=gnunet-rest-server
3REST_PORT=7776 3REST_PORT=7776
4REST_ALLOW_HEADERS=Authorization 4REST_ALLOW_HEADERS=Authorization,Accept,Content-Type
5REST_ALLOW_ORIGIN=localhost 5REST_ALLOW_ORIGIN=*