diff --git a/src/plugins/http/src/gcHandle.c b/src/plugins/http/src/gcHandle.c
index 4980c9c804..fbe6757ccb 100644
--- a/src/plugins/http/src/gcHandle.c
+++ b/src/plugins/http/src/gcHandle.c
@@ -13,11 +13,13 @@
* along with this program. If not, see .
*/
-#include "gcHandle.h"
+#define _DEFAULT_SOURCE
+#include "os.h"
#include "cJSON.h"
+#include "httpLog.h"
+#include "gcHandle.h"
#include "gcJson.h"
#include "taosdef.h"
-#include "httpLog.h"
static HttpDecodeMethod gcDecodeMethod = {"grafana", gcProcessRequest};
static HttpEncodeMethod gcHeartBeatMethod = {NULL, gcSendHeartBeatResp, NULL, NULL, NULL, NULL, NULL, NULL};
diff --git a/src/plugins/http/src/gcJson.c b/src/plugins/http/src/gcJson.c
index 8f59633714..09990c123e 100644
--- a/src/plugins/http/src/gcJson.c
+++ b/src/plugins/http/src/gcJson.c
@@ -13,10 +13,8 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-
+#define _DEFAULT_SOURCE
+#include "os.h"
#include "gcHandle.h"
#include "gcJson.h"
#include "httpJson.h"
diff --git a/src/plugins/http/src/httpAuth.c b/src/plugins/http/src/httpAuth.c
index adbf980f97..594f51e275 100644
--- a/src/plugins/http/src/httpAuth.c
+++ b/src/plugins/http/src/httpAuth.c
@@ -13,12 +13,14 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
+#include "tkey.h"
#include "tutil.h"
#include "http.h"
#include "httpLog.h"
#include "httpHandle.h"
-#include "tkey.h"
+
#define KEY_DES_4 4971256377704625728L
bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) {
diff --git a/src/plugins/http/src/httpCode.c b/src/plugins/http/src/httpCode.c
index 230c0de2e0..9ec07fd851 100644
--- a/src/plugins/http/src/httpCode.c
+++ b/src/plugins/http/src/httpCode.c
@@ -13,6 +13,9 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
+
+
char* httpMsg[] = {
"success", // 0
"http server is not online", // 1
diff --git a/src/plugins/http/src/httpHandle.c b/src/plugins/http/src/httpHandle.c
index 529714c8e6..4eaff3660a 100644
--- a/src/plugins/http/src/httpHandle.c
+++ b/src/plugins/http/src/httpHandle.c
@@ -13,21 +13,18 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-#include
-
-#include "http.h"
-#include "httpCode.h"
-#include "httpHandle.h"
-#include "httpResp.h"
-#include "shash.h"
+#define _DEFAULT_SOURCE
+#include "os.h"
#include "taos.h"
#include "tglobal.h"
#include "tsocket.h"
#include "ttimer.h"
+#include "shash.h"
+#include "http.h"
#include "httpLog.h"
+#include "httpCode.h"
+#include "httpHandle.h"
+#include "httpResp.h"
void httpToLowerUrl(char* url) {
/*ignore case */
diff --git a/src/plugins/http/src/httpJson.c b/src/plugins/http/src/httpJson.c
index fa74f857b3..cbca19b57f 100644
--- a/src/plugins/http/src/httpJson.c
+++ b/src/plugins/http/src/httpJson.c
@@ -13,20 +13,15 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-#include
-#include
-#include
-
+#define _DEFAULT_SOURCE
+#include "os.h"
+#include "taosmsg.h"
+#include "taoserror.h"
#include "http.h"
+#include "httpLog.h"
#include "httpCode.h"
#include "httpJson.h"
#include "httpResp.h"
-#include "taosmsg.h"
-#include "httpLog.h"
-#include "taoserror.h"
#define MAX_NUM_STR_SZ 25
diff --git a/src/plugins/http/src/httpResp.c b/src/plugins/http/src/httpResp.c
index c0a5c6d7ea..b064b58116 100644
--- a/src/plugins/http/src/httpResp.c
+++ b/src/plugins/http/src/httpResp.c
@@ -13,14 +13,14 @@
* along with this program. If not, see .
*/
-#include "httpResp.h"
-#include
-#include
-#include "httpCode.h"
-#include "httpJson.h"
+#define _DEFAULT_SOURCE
+#include "os.h"
+#include "taoserror.h"
#include "taosmsg.h"
#include "httpLog.h"
-#include "taoserror.h"
+#include "httpResp.h"
+#include "httpCode.h"
+#include "httpJson.h"
const char *httpKeepAliveStr[] = {"", "Connection: Keep-Alive\r\n", "Connection: Close\r\n"};
diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c
index f564863652..f36e0440cb 100644
--- a/src/plugins/http/src/httpServer.c
+++ b/src/plugins/http/src/httpServer.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
#include "taosmsg.h"
#include "tsocket.h"
diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c
index 39b2ff7d24..4b095aeb77 100644
--- a/src/plugins/http/src/httpSession.c
+++ b/src/plugins/http/src/httpSession.c
@@ -13,20 +13,18 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-
-#include "http.h"
-#include "httpCode.h"
-#include "httpHandle.h"
-#include "httpResp.h"
-
+#define _DEFAULT_SOURCE
+#include "os.h"
#include "shash.h"
#include "taos.h"
#include "ttime.h"
#include "ttimer.h"
+#include "http.h"
#include "httpLog.h"
+#include "httpCode.h"
+#include "httpHandle.h"
+#include "httpResp.h"
+
void httpAccessSession(HttpContext *pContext) {
HttpServer *server = pContext->pThread->pServer;
diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c
index 017605093e..22ecdbc7b2 100644
--- a/src/plugins/http/src/httpSql.c
+++ b/src/plugins/http/src/httpSql.c
@@ -13,15 +13,16 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
+#include "tnote.h"
+#include "taos.h"
+#include "tsclient.h"
#include "http.h"
+#include "httpLog.h"
#include "httpCode.h"
#include "httpHandle.h"
#include "httpResp.h"
-#include "taos.h"
-#include "tsclient.h"
-#include "tnote.h"
-#include "httpLog.h"
void *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
void *param, void **taos);
diff --git a/src/plugins/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c
index 9afd5838c8..355fdf2fd0 100644
--- a/src/plugins/http/src/httpSystem.c
+++ b/src/plugins/http/src/httpSystem.c
@@ -15,17 +15,17 @@
#define _DEFAULT_SOURCE
#include "os.h"
+#include "shash.h"
+#include "taos.h"
+#include "tglobal.h"
+#include "tsocket.h"
+#include "ttimer.h"
#include "tadmin.h"
#include "http.h"
#include "httpCode.h"
#include "httpHandle.h"
#include "httpResp.h"
#include "httpLog.h"
-#include "shash.h"
-#include "taos.h"
-#include "tglobal.h"
-#include "tsocket.h"
-#include "ttimer.h"
#include "gcHandle.h"
#include "httpHandle.h"
#include "restHandle.h"
diff --git a/src/plugins/http/src/httpUtil.c b/src/plugins/http/src/httpUtil.c
index c8d4737c41..fc5f771c69 100644
--- a/src/plugins/http/src/httpUtil.c
+++ b/src/plugins/http/src/httpUtil.c
@@ -13,15 +13,16 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
#include "tmd5.h"
+#include "shash.h"
+#include "taos.h"
#include "http.h"
+#include "httpLog.h"
#include "httpCode.h"
#include "httpHandle.h"
#include "httpResp.h"
-#include "shash.h"
-#include "taos.h"
-#include "httpLog.h"
bool httpCheckUsedbSql(char *sql) {
if (strstr(sql, "use ") != NULL) {
diff --git a/src/plugins/http/src/restHandle.c b/src/plugins/http/src/restHandle.c
index 79d6fe5662..a2dc7d06a1 100644
--- a/src/plugins/http/src/restHandle.c
+++ b/src/plugins/http/src/restHandle.c
@@ -13,9 +13,11 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
+#include "os.h"
+#include "httpLog.h"
#include "restHandle.h"
#include "restJson.h"
-#include "httpLog.h"
static HttpDecodeMethod restDecodeMethod = {"rest", restProcessRequest};
static HttpDecodeMethod restDecodeMethod2 = {"restful", restProcessRequest};
diff --git a/src/plugins/http/src/restJson.c b/src/plugins/http/src/restJson.c
index 0489bcdbe0..9277d7d045 100644
--- a/src/plugins/http/src/restJson.c
+++ b/src/plugins/http/src/restJson.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
#include "tglobal.h"
#include "httpLog.h"
diff --git a/src/plugins/http/src/tgHandle.c b/src/plugins/http/src/tgHandle.c
index 5ea5f832d5..c854e0adc3 100644
--- a/src/plugins/http/src/tgHandle.c
+++ b/src/plugins/http/src/tgHandle.c
@@ -13,14 +13,15 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
-#include "tgHandle.h"
-#include "shash.h"
-#include "taosmsg.h"
-#include "tgJson.h"
-#include "taosdef.h"
-#include "httpLog.h"
#include "tglobal.h"
+#include "shash.h"
+#include "taosdef.h"
+#include "taosmsg.h"
+#include "tgHandle.h"
+#include "tgJson.h"
+#include "httpLog.h"
/*
* taos.telegraf.cfg formats like
diff --git a/src/plugins/http/src/tgJson.c b/src/plugins/http/src/tgJson.c
index f19e00fb98..1513d61d82 100644
--- a/src/plugins/http/src/tgJson.c
+++ b/src/plugins/http/src/tgJson.c
@@ -13,13 +13,14 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
+#include "taosmsg.h"
+#include "httpLog.h"
#include "httpJson.h"
#include "httpResp.h"
-#include "taosmsg.h"
#include "tgHandle.h"
#include "tgJson.h"
-#include "httpLog.h"
void tgInitQueryJson(HttpContext *pContext) {
JsonBuf *jsonBuf = httpMallocJsonBuf(pContext);