aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-01-26 09:16:56 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-01-26 09:16:56 +0100
commitb2247ca634420ed0d5ecc1743834ea4e0666aa2a (patch)
tree0e8c72dadd5410ba42c26193d899d7df2d621fda
parentd809e9b8fc03a0a08060034c6ddbd4b4c4176399 (diff)
GetPostPath Ongoing
-rw-r--r--include/proto-def.h1
-rw-r--r--plugins/samples/SamplePost.c2
-rw-r--r--src/helper-api.c12
3 files changed, 14 insertions, 1 deletions
diff --git a/include/proto-def.h b/include/proto-def.h
index 0f5ca048..65f34666 100644
--- a/include/proto-def.h
+++ b/include/proto-def.h
@@ -26,6 +26,7 @@ PUBLIC int getQueryAll(AFB_request * request, char *query, size_t len);
PUBLIC AFB_PostHandle* getPostHandle (AFB_request *request);
PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) ;
PUBLIC AFB_PostCtx* getPostContext (AFB_request *request);
+PUBLIC char* getPostPath (AFB_request *request);
// rest-api
PUBLIC void endPostRequest(AFB_PostHandle *posthandle);
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index 13e1ad67..9828349a 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -53,7 +53,7 @@ STATIC json_object* UploadAppli (AFB_request *request, AFB_PostItem *item) {
// Do something intelligent here to install application
postFileCtx->errcode = MHD_HTTP_OK; // or error is something went wrong;
- postFileCtx->jresp = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli done");
+ postFileCtx->jresp = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli=%s done", getPostPath (request));
}
}
diff --git a/src/helper-api.c b/src/helper-api.c
index a166027a..12539978 100644
--- a/src/helper-api.c
+++ b/src/helper-api.c
@@ -93,6 +93,18 @@ PUBLIC AFB_PostCtx* getPostContext (AFB_request *request) {
return ((AFB_PostCtx*) postHandle->ctx);
}
+PUBLIC char* getPostPath (AFB_request *request) {
+ AFB_PostHandle *postHandle = getPostHandle(request);
+ AFB_PostCtx *postFileCtx;
+
+ if (postHandle == NULL) return NULL;
+
+ postFileCtx = (AFB_PostCtx*) postHandle->ctx;
+ if (postFileCtx == NULL) return NULL;
+
+ return (postFileCtx->path);
+}
+
PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) {
AFB_PostHandle *postHandle = getPostHandle(request);