Files
chat_rebot-connect-with-one…/c/network/http_rel.c

25 lines
546 B
C

#include <stddef.h>
#include <string.h>
#include "http_rel.h"
const char *http_get_body(const char *buf)
{
if (!buf) return NULL;
/* 找到 header 与 body 之间的空行 "\r\n\r\n" */
const char *sep = strstr(buf, "\r\n\r\n");
if (!sep) return NULL; /* 格式错误 */
const char *body = sep + 4; /* 跳过 "\r\n\r\n" */
/* 简单判断:如果后面还有数据,就认为是 body */
if (*body == '\0') return NULL; /* 没有 body */
return body;
}
const char *resave_http(int fd)
{
}