server端代码
#include "httplib.h"
void deal(const Request &req, Response &res);
void deal(const Request &req, Response &res)
{
}
int main()
{ Http_server *p_http_server = (Http_server *)p_param;
const char *p_ip = 127.0.0.1;
int port = 8080;
Server svr;
//处理Get类型主动查询去请求
svr.Get("/Alive_Check", [](const Request& req, Response& res) {
//std::string content_type=req.get_header_value("Content-Type");
std::string version=req.get_header_value("Version");
res.status=HTTP_OK;//设置code码
res.set_content("", "");//设置content—type
res.set_header("Content-Length", "0");//设置content—length
res.set_header("Version", version.c_str());//设置版本
string buf = GMTStrFromTime();
res.set_header("Date", buf.c_str());//设置时间
});
//处理Post类型主动查询去请求
svr.Post("/Ali