summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2015-12-22 15:51:22 +0100
committerFulup Ar Foll <fulup@iot.bzh>2015-12-22 15:51:22 +0100
commiteee04b4ac5847f6101b9321e4513c4401e745a0a (patch)
tree12a6386007bd6681f3090b7808fb83df07e97b14
parent1b238baa74d36f144581deee5f3a1834d1d445bb (diff)
Fix Post JSON bug
-rw-r--r--nbproject/configurations.xml128
-rw-r--r--src/rest-api.c2
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 @@
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
<df name="plugins">
+ <df name="afm-main-plugin">
+ <in>afm-main-plugin.c</in>
+ <in>utils-jbus.c</in>
+ </df>
<df name="audio">
<in>audio-alsa.c</in>
<in>audio-api.c</in>
@@ -24,6 +28,7 @@
<in>alsa-api.c</in>
<in>config.c</in>
<in>dbus-api.c</in>
+ <in>helper-api.c</in>
<in>http-svc.c</in>
<in>main.c</in>
<in>radio-api.c</in>
@@ -95,14 +100,26 @@
</incDir>
</cTool>
</folder>
+ <folder path="0/plugins/afm-main-plugin">
+ <cTool>
+ <incDir>
+ <pElem>plugins/afm-main-plugin</pElem>
+ </incDir>
+ </cTool>
+ </folder>
<folder path="0/plugins/audio">
<cTool>
<incDir>
+ <pElem>plugins/audio</pElem>
<pElem>build/plugins/audio</pElem>
</incDir>
<preprocessorList>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
- <Elem>audio_api_EXPORTS</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
+ <Elem>audio_api_EXPORTS=1</Elem>
</preprocessorList>
</cTool>
</folder>
@@ -119,30 +136,72 @@
<folder path="0/plugins/samples">
<cTool>
<incDir>
+ <pElem>plugins/samples</pElem>
<pElem>build/plugins/samples</pElem>
</incDir>
<preprocessorList>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
</preprocessorList>
</cTool>
</folder>
<folder path="0/plugins/session">
<cTool>
<incDir>
+ <pElem>plugins/session</pElem>
<pElem>build/plugins/session</pElem>
</incDir>
<preprocessorList>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
- <Elem>token_api_EXPORTS</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
+ <Elem>token_api_EXPORTS=1</Elem>
</preprocessorList>
</cTool>
</folder>
+ <item path="plugins/afm-main-plugin/afm-main-plugin.c"
+ ex="false"
+ tool="0"
+ flavor2="2">
+ <cTool flags="2">
+ <incDir>
+ <pElem>build/plugins/afm-main-plugin</pElem>
+ </incDir>
+ <preprocessorList>
+ <Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
+ <Elem>afm_main_api_EXPORTS=1</Elem>
+ </preprocessorList>
+ </cTool>
+ </item>
+ <item path="plugins/afm-main-plugin/utils-jbus.c"
+ ex="false"
+ tool="0"
+ flavor2="2">
+ <cTool flags="2">
+ <incDir>
+ <pElem>/usr/lib64/dbus-1.0/include/dbus</pElem>
+ <pElem>/usr/include/dbus-1.0/dbus</pElem>
+ <pElem>/usr/include/dbus-1.0</pElem>
+ <pElem>/usr/lib64/dbus-1.0/include</pElem>
+ <pElem>build/plugins/afm-main-plugin</pElem>
+ </incDir>
+ </cTool>
+ </item>
<item path="plugins/audio/audio-alsa.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="plugins/audio/audio-api.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="plugins/radio/radio-api.c" ex="false" tool="0" flavor2="2">
@@ -154,21 +213,21 @@
</cTool>
</item>
<item path="plugins/samples/HelloWorld.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
<preprocessorList>
- <Elem>helloWorld_api_EXPORTS</Elem>
+ <Elem>helloWorld_api_EXPORTS=1</Elem>
</preprocessorList>
</cTool>
</item>
<item path="plugins/samples/SamplePost.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
<preprocessorList>
- <Elem>samplePost_api_EXPORTS</Elem>
+ <Elem>samplePost_api_EXPORTS=1</Elem>
</preprocessorList>
</cTool>
</item>
<item path="plugins/session/token-api.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="src/afbs-api.c" ex="false" tool="0" flavor2="2">
@@ -200,17 +259,21 @@
</cTool>
</item>
<item path="src/config.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
<incDir>
- <pElem>include</pElem>
+ <pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
<pElem>/usr/include/uuid</pElem>
- <pElem>/usr/include/alsa</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
<Elem>HAVE_AUDIO_PLUGIN=1</Elem>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
</preprocessorList>
</cTool>
</item>
@@ -228,33 +291,44 @@
</incDir>
</cTool>
</item>
- <item path="src/http-svc.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <item path="src/helper-api.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="2">
<incDir>
+ <pElem>src</pElem>
+ <pElem>/usr/include/json-c</pElem>
<pElem>include</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>build/src</pElem>
+ </incDir>
+ </cTool>
+ </item>
+ <item path="src/http-svc.c" ex="false" tool="0" flavor2="2">
+ <cTool flags="2">
+ <incDir>
+ <pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
<pElem>/usr/include/uuid</pElem>
- <pElem>/usr/include/alsa</pElem>
<pElem>build/src</pElem>
</incDir>
- <preprocessorList>
- <Elem>HAVE_AUDIO_PLUGIN=1</Elem>
- <Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
- </preprocessorList>
</cTool>
</item>
<item path="src/main.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
<incDir>
- <pElem>include</pElem>
+ <pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>include</pElem>
<pElem>/usr/include/uuid</pElem>
- <pElem>/usr/include/alsa</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
<Elem>HAVE_AUDIO_PLUGIN=1</Elem>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
</preprocessorList>
</cTool>
</item>
@@ -292,17 +366,21 @@
</cTool>
</item>
<item path="src/session.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <cTool flags="2">
<incDir>
- <pElem>include</pElem>
+ <pElem>src</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>/usr/include/uuid</pElem>
- <pElem>/usr/include/alsa</pElem>
+ <pElem>include</pElem>
<pElem>build/src</pElem>
</incDir>
<preprocessorList>
<Elem>HAVE_AUDIO_PLUGIN=1</Elem>
<Elem>PLUGIN_INSTALL_DIR="/usr/local/lib64/afb"</Elem>
+ <Elem>__PIC__=2</Elem>
+ <Elem>__REGISTER_PREFIX__=</Elem>
+ <Elem>__USER_LABEL_PREFIX__=</Elem>
+ <Elem>__pic__=2</Elem>
</preprocessorList>
</cTool>
</item>
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");