X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-hreq.c;h=495bf06c24c94e23430684fe55c20062c5536fcb;hb=refs%2Fheads%2Fsandbox%2FDDTLK%2Fpakage;hp=fa16565ab677bccab1c6718cd8beab89b651fb6b;hpb=7bf0d9c6f807ffae6d9871c606afeccb9b478d3d;p=src%2Fapp-framework-binder.git diff --git a/src/afb-hreq.c b/src/afb-hreq.c index fa16565a..495bf06c 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -27,6 +27,9 @@ #include #include +#if !defined(JSON_C_TO_STRING_NOSLASHESCAPE) +#define JSON_C_TO_STRING_NOSLASHESCAPE 0 +#endif #if defined(USE_MAGIC_MIME_TYPE) #include @@ -36,6 +39,7 @@ #include "afb-msg-json.h" #include "afb-context.h" #include "afb-hreq.h" +#include "afb-hsrv.h" #include "afb-session.h" #include "afb-cred.h" #include "verbose.h" @@ -168,10 +172,9 @@ static void afb_hreq_reply_v(struct afb_hreq *hreq, unsigned status, struct MHD_ hreq->replied = 1; if (hreq->suspended != 0) { - extern void run_micro_httpd(struct afb_hsrv *hsrv); MHD_resume_connection (hreq->connection); hreq->suspended = 0; - run_micro_httpd(hreq->hsrv); + afb_hsrv_run(hreq->hsrv); } } @@ -897,7 +900,7 @@ static struct json_object *req_json(struct afb_xreq *xreq) static ssize_t send_json_cb(json_object *obj, uint64_t pos, char *buf, size_t max) { - ssize_t len = stpncpy(buf, json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)+pos, max) - buf; + ssize_t len = stpncpy(buf, json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN|JSON_C_TO_STRING_NOSLASHESCAPE)+pos, max) - buf; return len ? : (ssize_t)MHD_CONTENT_READER_END_OF_STREAM; } @@ -918,7 +921,7 @@ static void req_reply(struct afb_xreq *xreq, struct json_object *object, const c if (reqid != NULL && json_object_object_get_ex(reply, "request", &sub)) json_object_object_add(sub, "reqid", json_object_new_string(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); + response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string_ext(reply, JSON_C_TO_STRING_PLAIN|JSON_C_TO_STRING_NOSLASHESCAPE)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put); afb_hreq_reply(hreq, MHD_HTTP_OK, response, NULL); }