改用自行实现的http读取与解析,同时修复部分bug

This commit is contained in:
2025-12-17 18:13:39 +08:00
parent e0a3f0d3f1
commit a73b317547
7 changed files with 76 additions and 30 deletions

View File

@ -74,7 +74,6 @@ int rbt_parse_json(const char *json_text, rbt_msg *out)
out->message_type = 'p';
/* else 保持 0 */
}
cJSON_Delete(root);
return 0; // 成功
}
@ -99,15 +98,7 @@ int process_message(char *req, log_manager *logger,rbt_msg *swap) {
return -1;
}
char *req_buf = recv_http_request(fd);
if(!req_buf) { // 检查返回值
close(fd);
free(req);
return -1;
}
const char *body = http_get_body(req_buf);
free(req_buf);
const char *body = recv_http_request(fd);
if(rbt_parse_json(body,swap) == 0) {
logs *log = malloc(sizeof(logs));