OCT 1. 修正接口返回2次数据问题
This commit is contained in:
parent
db7bcabdd9
commit
f8a9209f5b
|
@ -45,7 +45,7 @@ static void rsp_err_msg(struct mg_connection *c, int httpCode, int errCode) {
|
||||||
|
|
||||||
mg_http_reply(c, httpCode, "Content-Type: application/json\r\n", "%s\n", pStrPro ? pStrPro : "");
|
mg_http_reply(c, httpCode, "Content-Type: application/json\r\n", "%s\n", pStrPro ? pStrPro : "");
|
||||||
|
|
||||||
LOG_MOD(trace, ZLOG_MOD_HTTPD, "Response(%d): %s\n", httpCode, pStrPro);
|
LOG_MOD(info, ZLOG_MOD_HTTPD, "Response(%d): %s\n", httpCode, pStrPro);
|
||||||
|
|
||||||
if (pStrPro) {
|
if (pStrPro) {
|
||||||
free((void *)pStrPro);
|
free((void *)pStrPro);
|
||||||
|
@ -67,11 +67,7 @@ static void on_mg_event_cb(struct mg_connection *c, int ev, void *ev_data, void
|
||||||
pItem->pCallbackHandler(hm, pItem->pUserData, pCtx);
|
pItem->pCallbackHandler(hm, pItem->pUserData, pCtx);
|
||||||
if (pCtx->errCode == ERR_SUCCESS && pCtx->pRspData) {
|
if (pCtx->errCode == ERR_SUCCESS && pCtx->pRspData) {
|
||||||
mg_http_reply(c, pCtx->httpCode, pCtx->pRspHeads, "%s\n", pCtx->pRspData);
|
mg_http_reply(c, pCtx->httpCode, pCtx->pRspHeads, "%s\n", pCtx->pRspData);
|
||||||
LOG_MOD(trace,
|
LOG_MOD(info, ZLOG_MOD_HTTPD, "Response:(%d) %s\n", pCtx->httpCode, (char *)pCtx->pRspData);
|
||||||
ZLOG_MOD_HTTPD,
|
|
||||||
"Response:(%d) %s\n",
|
|
||||||
pCtx->httpCode,
|
|
||||||
(char *)pCtx->pRspData);
|
|
||||||
} else {
|
} else {
|
||||||
rsp_err_msg(c, pCtx->httpCode, pCtx->errCode);
|
rsp_err_msg(c, pCtx->httpCode, pCtx->errCode);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +82,8 @@ static void on_mg_event_cb(struct mg_connection *c, int ev, void *ev_data, void
|
||||||
} else {
|
} else {
|
||||||
rsp_err_msg(c, 405, ERR_HTTP_UNSUP_METHOD);
|
rsp_err_msg(c, 405, ERR_HTTP_UNSUP_METHOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matched = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue