From eee04b4ac5847f6101b9321e4513c4401e745a0a Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Tue, 22 Dec 2015 15:51:22 +0100 Subject: [PATCH] Fix Post JSON bug --- nbproject/configurations.xml | 128 ++++++++++++++++++++++++++++++++++--------- src/rest-api.c | 2 +- 2 files changed, 104 insertions(+), 26 deletions(-) diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 449cdafc..a04af66c 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -3,6 +3,10 @@ + + afm-main-plugin.c + utils-jbus.c + audio-alsa.c audio-api.c @@ -24,6 +28,7 @@ alsa-api.c config.c dbus-api.c + helper-api.c http-svc.c main.c radio-api.c @@ -95,14 +100,26 @@ + + + + plugins/afm-main-plugin + + + + plugins/audio build/plugins/audio PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" - audio_api_EXPORTS + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + audio_api_EXPORTS=1 @@ -119,30 +136,72 @@ + plugins/samples build/plugins/samples PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + plugins/session build/plugins/session PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" - token_api_EXPORTS + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + token_api_EXPORTS=1 + + + + build/plugins/afm-main-plugin + + + PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + afm_main_api_EXPORTS=1 + + + + + + + /usr/lib64/dbus-1.0/include/dbus + /usr/include/dbus-1.0/dbus + /usr/include/dbus-1.0 + /usr/lib64/dbus-1.0/include + build/plugins/afm-main-plugin + + + - + - + @@ -154,21 +213,21 @@ - + - helloWorld_api_EXPORTS + helloWorld_api_EXPORTS=1 - + - samplePost_api_EXPORTS + samplePost_api_EXPORTS=1 - + @@ -200,17 +259,21 @@ - + - include + src /usr/include/json-c + include /usr/include/uuid - /usr/include/alsa build/src HAVE_AUDIO_PLUGIN=1 PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 @@ -228,33 +291,44 @@ - - + + + src + /usr/include/json-c include + /usr/include/uuid + build/src + + + + + + + src /usr/include/json-c + include /usr/include/uuid - /usr/include/alsa build/src - - HAVE_AUDIO_PLUGIN=1 - PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" - - + - include + src /usr/include/json-c + include /usr/include/uuid - /usr/include/alsa build/src HAVE_AUDIO_PLUGIN=1 PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 @@ -292,17 +366,21 @@ - + - include + src /usr/include/json-c /usr/include/uuid - /usr/include/alsa + include build/src HAVE_AUDIO_PLUGIN=1 PLUGIN_INSTALL_DIR="/usr/local/lib64/afb" + __PIC__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 diff --git a/src/rest-api.c b/src/rest-api.c index c1a20f13..3d9ffeb7 100644 --- a/src/rest-api.c +++ b/src/rest-api.c @@ -367,6 +367,7 @@ PUBLIC int doRestApi(struct MHD_Connection *connection, AFB_session *session, co // allocate application POST processor handle to zero postHandle = calloc(1, sizeof (AFB_PostHandle)); postHandle->uid = postcount++; // build a UID for DEBUG + *con_cls = postHandle; // update context with posthandle // Let make sure we have the right encoding and a valid length encoding = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE); @@ -390,7 +391,6 @@ PUBLIC int doRestApi(struct MHD_Connection *connection, AFB_session *session, co postHandle->type = AFB_POST_FORM; postHandle->pp = MHD_create_post_processor (connection, MAX_POST_SIZE, doPostIterate, postHandle); postHandle->private= (void*)request; - *con_cls = postHandle; // update context with posthandle if (NULL == postHandle->pp) { fprintf(stderr,"OOPS: Internal error fail to allocate MHD_create_post_processor\n"); -- 2.16.6