Don't return the uuid 50/23150/1
authorJose Bollo <jose.bollo@iot.bzh>
Fri, 15 Nov 2019 15:01:27 +0000 (16:01 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 29 Nov 2019 11:48:14 +0000 (12:48 +0100)
uuid is available in cookies and through
a call to monitor/session

Bug-AGL: SPEC-2968

Change-Id: I72912f3dc7985cca09e77c952e416b608711abbe
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
src/afb-context.c
src/afb-context.h
src/afb-hreq.c
src/afb-msg-json.c
src/afb-ws-json1.c

index 4cdaa6f..8a1938a 100644 (file)
@@ -107,15 +107,6 @@ const char *afb_context_uuid(struct afb_context *context)
        return context->session ? afb_session_uuid(context->session) : "";
 }
 
-const char *afb_context_sent_uuid(struct afb_context *context)
-{
-       if (context->session == NULL || context->closing || context->super)
-               return NULL;
-       if (!context->created)
-               return NULL;
-       return afb_session_uuid(context->session);
-}
-
 void *afb_context_make(struct afb_context *context, int replace, void *(*make_value)(void *closure), void (*free_value)(void *item), void *closure)
 {
        assert(context->session != NULL);
index 83d0121..126987a 100644 (file)
@@ -44,7 +44,6 @@ extern void afb_context_subinit(struct afb_context *context, struct afb_context
 extern int afb_context_connect(struct afb_context *context, const char *uuid, const char *token);
 extern int afb_context_connect_validated(struct afb_context *context, const char *uuid);
 extern void afb_context_disconnect(struct afb_context *context);
-extern const char *afb_context_sent_uuid(struct afb_context *context);
 extern const char *afb_context_uuid(struct afb_context *context);
 
 extern void *afb_context_get(struct afb_context *context);
index 6440a8c..a9010b8 100644 (file)
@@ -166,7 +166,8 @@ static void afb_hreq_reply_v(struct afb_hreq *hreq, unsigned status, struct MHD_
                MHD_add_response_header(response, k, v);
                k = va_arg(args, const char *);
        }
-       v = afb_context_sent_uuid(&hreq->xreq.context);
+
+       v = afb_context_uuid(&hreq->xreq.context);
        if (v != NULL && asprintf(&cookie, cookie_setter, v) > 0) {
                MHD_add_response_header(response, MHD_HTTP_HEADER_SET_COOKIE, cookie);
                free(cookie);
index fc73632..192df54 100644 (file)
@@ -27,7 +27,6 @@ static const char _success_[] = "success";
 struct json_object *afb_msg_json_reply(struct json_object *resp, const char *error, const char *info, struct afb_context *context)
 {
        json_object *msg, *request;
-       const char *uuid;
        json_object *type_reply = NULL;
 
        msg = json_object_new_object();
@@ -44,12 +43,6 @@ struct json_object *afb_msg_json_reply(struct json_object *resp, const char *err
        if (info != NULL)
                json_object_object_add(request, "info", json_object_new_string(info));
 
-       if (context != NULL) {
-               uuid = afb_context_sent_uuid(context);
-               if (uuid != NULL)
-                       json_object_object_add(request, "uuid", json_object_new_string(uuid));
-       }
-
        return msg;
 }
 
index 743f5a5..fd13219 100644 (file)
@@ -68,7 +68,6 @@ struct afb_ws_json1
        struct afb_wsj1 *wsj1;
        struct afb_cred *cred;
        struct afb_apiset *apiset;
-       int new_session;
 };
 
 /* declaration of wsreq structure */
@@ -124,7 +123,6 @@ struct afb_ws_json1 *afb_ws_json1_create(struct fdev *fdev, struct afb_apiset *a
        result->cleanup_closure = cleanup_closure;
        result->session = afb_session_addref(context->session);
        result->token = afb_token_addref(context->token);
-       result->new_session = context->created != 0;
        if (result->session == NULL)
                goto error2;
 
@@ -198,10 +196,6 @@ static void aws_on_call_cb(void *closure, const char *api, const char *verb, str
        afb_context_init(&wsreq->xreq.context, ws->session, afb_wsj1_msg_token(msg));
        if (!wsreq->xreq.context.invalidated)
                wsreq->xreq.context.validated = 1;
-       if (ws->new_session != 0) {
-               wsreq->xreq.context.created = 1;
-               ws->new_session = 0;
-       }
 
        /* fill and record the request */
        afb_wsj1_msg_addref(msg);