为提高性能,改用c替换原本的flask
This commit is contained in:
24
c/network/http_rel.c
Normal file
24
c/network/http_rel.c
Normal file
@ -0,0 +1,24 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user