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);
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);
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);
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();
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;
}
struct afb_wsj1 *wsj1;
struct afb_cred *cred;
struct afb_apiset *apiset;
- int new_session;
};
/* declaration of wsreq structure */
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;
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);