X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-hreq.c;h=4ca8441e280ca0de6a9c074cd0421a617104ec5f;hb=b57505f0f80f6394f04a041df6e808c857b01d4b;hp=a325fd4f938a372c53fbc12339465daf20b3542e;hpb=a4487d8a46d3e4400bf73ce817fa1a34cde31a6f;p=src%2Fapp-framework-binder.git diff --git a/src/afb-hreq.c b/src/afb-hreq.c index a325fd4f..4ca8441e 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -359,7 +359,7 @@ int afb_hreq_reply_file_if_exist(struct afb_hreq *hreq, int dirfd, const char *f int fd; unsigned int status; struct stat st; - char etag[1 + 2 * sizeof(int)]; + char etag[1 + 2 * 8]; const char *inm; struct MHD_Response *response; const char *mimetype; @@ -774,20 +774,15 @@ static ssize_t send_json_cb(json_object *obj, uint64_t pos, char *buf, size_t ma static void req_reply(struct afb_hreq *hreq, unsigned retcode, const char *status, const char *info, json_object *resp) { - struct json_object *reply, *request; - const char *token, *uuid, *reqid; + struct json_object *reply; + const char *reqid; struct MHD_Response *response; - token = afb_context_sent_token(&hreq->context); - uuid = afb_context_sent_uuid(&hreq->context); - - reply = afb_msg_json_reply(status, info, resp, token, uuid); - reqid = afb_hreq_get_argument(hreq, long_key_for_reqid); if (reqid == NULL) reqid = afb_hreq_get_argument(hreq, short_key_for_reqid); - if (reqid != NULL && json_object_object_get_ex(reply, "request", &request)) - json_object_object_add (request, short_key_for_reqid, json_object_new_string(reqid)); + + reply = afb_msg_json_reply(status, info, resp, &hreq->context, reqid); response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string_ext(reply, JSON_C_TO_STRING_PLAIN)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put); afb_hreq_reply(hreq, retcode, response, NULL);