You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
821 B
C

4 months ago
#pragma once
#include "../cpp-httplib/httplib.h"
#include <string>
#include <windows.h>
#include <vector>
using namespace std;
using namespace httplib;
class CHttplibServer
{
public:
CHttplibServer();
virtual ~CHttplibServer();
bool StartHttpServer(string SvrFilesDir="",bool bAsync=true);
void SetFilesDir(string Dir) { m_SvrFilesDir = Dir; }
private:
string m_SvrFilesDir;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
string m_SvrIP = "0.0.0.0";
int m_Port = 1234;
public:
virtual void OnCommand(string cmd, Response& res);
private:
void OnDownloadFile(const Request& req, Response& res);
void OnCommandBase(const Request& req, Response& res);
void OnCommand_GetFileList(const Request& req, Response& res);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
vector<string> get_file_names(const string & Dir);//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
};