From e08d57c0e397018f0c463a66adc232f6358caef5 Mon Sep 17 00:00:00 2001 From: Jose Bollo Date: Fri, 15 Nov 2019 16:01:27 +0100 Subject: Don't return the uuid uuid is available in cookies and through a call to monitor/session Bug-AGL: SPEC-2968 Change-Id: I72912f3dc7985cca09e77c952e416b608711abbe Signed-off-by: Jose Bollo --- src/afb-context.c | 9 --------- src/afb-context.h | 1 - src/afb-hreq.c | 3 ++- src/afb-msg-json.c | 7 ------- src/afb-ws-json1.c | 6 ------ 5 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/afb-context.c b/src/afb-context.c index 4cdaa6f7..8a1938a1 100644 --- a/src/afb-context.c +++ b/src/afb-context.c @@ -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); diff --git a/src/afb-context.h b/src/afb-context.h index 83d01218..126987a1 100644 --- a/src/afb-context.h +++ b/src/afb-context.h @@ -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); diff --git a/src/afb-hreq.c b/src/afb-hreq.c index 6440a8cd..a9010b88 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -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); diff --git a/src/afb-msg-json.c b/src/afb-msg-json.c index fc736321..192df545 100644 --- a/src/afb-msg-json.c +++ b/src/afb-msg-json.c @@ -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; } diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 743f5a52..fd132197 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -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); -- cgit 1.2.3-korg