aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-05 19:04:43 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-05-05 19:04:43 +0200
commit157c652b4bb8eba5692bed2a4bc75650f7ae7622 (patch)
tree40e96c2f88d8bed32c3eb5281fe1645465f58455
parent9952955d440866fa061d78fe923cb8282f778667 (diff)
Add default cred to HTTP link
Change-Id: Ibb73cebc99094b33b61820482327296049c2026a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hreq.c3
-rw-r--r--src/afb-ws-json1.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index fe5af73a..389a67e2 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -39,6 +39,7 @@
#include "afb-hreq.h"
#include "afb-subcall.h"
#include "afb-session.h"
+#include "afb-cred.h"
#include "verbose.h"
#include "locale-root.h"
@@ -319,6 +320,7 @@ static void req_destroy(struct afb_xreq *xreq)
json_object_put(hreq->json);
free((char*)hreq->xreq.api);
free((char*)hreq->xreq.verb);
+ afb_cred_unref(hreq->xreq.cred);
free(hreq);
}
@@ -981,6 +983,7 @@ struct afb_hreq *afb_hreq_create()
if (hreq) {
/* init the request */
afb_xreq_init(&hreq->xreq, &afb_hreq_xreq_query_itf);
+ hreq->xreq.cred = afb_cred_current();
hreq->reqid = ++global_reqids;
}
return hreq;
diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c
index 50980d7b..bdd1286c 100644
--- a/src/afb-ws-json1.c
+++ b/src/afb-ws-json1.c
@@ -130,6 +130,8 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_apiset *apiset, stru
goto error4;
result->cred = afb_cred_create_for_socket(fd);
+ if (!result->cred)
+ result->cred = afb_cred_current();
result->apiset = afb_apiset_addref(apiset);
return result;