改用自行实现的http读取与解析,同时修复部分bug
This commit is contained in:
@ -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));
|
||||
|
||||
Reference in New Issue
Block a user