瀏覽代碼

1.修复http协议,响应的json重复的问题

liyuezong 1 年之前
父節點
當前提交
3d7fab0b51
共有 1 個文件被更改,包括 13 次插入 和 2 次删除
  1. 13 2
      pro/mongoose/mongoose.c

+ 13 - 2
pro/mongoose/mongoose.c

@@ -2692,7 +2692,7 @@ int mg_http_reply2(struct mg_connection *c, int code, const char *headers,
     int r;
     if (c==NULL) return -1;
 
-    mg_printf(c, "HTTP/1.1 %d %s\r\n"
+    /*mg_printf(c, "HTTP/1.1 %d %s\r\n"
     "Content-Type: text/html\n"
     "Content-Length: %d\n"
     "Connection: Keep-Alive\n"
@@ -2702,7 +2702,18 @@ int mg_http_reply2(struct mg_connection *c, int code, const char *headers,
     "X-Xss-Protection: 1: mode=block\n"
     "Accept-Ranges: bytes\n"
     "Vary: Accept-Encoding\n\n"
-    "%s\n", code, mg_http_status_code_str(code),strlen(fmt == NULL ? "" : fmt), fmt == NULL ? "" : fmt);
+    "%s\n", code, mg_http_status_code_str(code),strlen(fmt == NULL ? "" : fmt), fmt == NULL ? "" : fmt);*/
+
+    mg_printf(c, "HTTP/1.1 %d %s\r\n"
+    "Content-Type: text/html\n"
+    "Content-Length: %d\n"
+    "Connection: Keep-Alive\n"
+    "Keep-Alive: timeout=30, max=396\n" 
+    "X-Content-Type-0ptions: nosniff\n"
+    "X-Frame-0ptions:: SAMEORIGIN\n"
+    "X-Xss-Protection: 1: mode=block\n"
+    "Accept-Ranges: bytes\n"
+    "Vary: Accept-Encoding\n\n", code, mg_http_status_code_str(code),strlen(fmt == NULL ? "" : fmt));
 
     len = c->send.len;
     va_start(ap, fmt);