优化http服务器

This commit is contained in:
xiongziliang
2019-10-29 00:35:44 +08:00
parent fd10ef1187
commit 43e1cc69a8
3 changed files with 177 additions and 155 deletions

View File

@@ -616,12 +616,7 @@ void installWebApi() {
//测试url http://127.0.0.1/index/api/downloadBin
API_REGIST_INVOKER(api,downloadBin,{
CHECK_SECRET();
auto body = std::make_shared<HttpFileBody>(exePath());
if(!body->remainSize()){
invoker("404 Not Found", HttpSession::KeyValue(), "");
return;
}
invoker("200 OK", HttpSession::KeyValue(), body);
invoker.responseFile(headerIn,StrCaseMap(),exePath());
});
////////////以下是注册的Hook API////////////