Complete refactor of project file structure

Fix incorrect handing of default node parameters in SSD subscription.
Fix unable to parse some Clash rule-providers (#289).
Fix not filtering inline comments in some Surge rulesets. (#285)
Add Cron task options.
Add clean context option for persisting a JS context across the whole request.
Replace JS engine with QuickJS.
This commit is contained in:
Tindy X committed 2021-03-23 18:09:00 +08:00
1 parent ba058e4e4b
commit 3d67406af6
88 files changed
+9404 -6356

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
#ifndef WEBSERVER_H_INCLUDED
#define WEBSERVER_H_INCLUDED
#include <string>
#include <map>
#include "../utils/map_extra.h"
struct Request
{
std::string method;
std::string url;
std::string argument;
string_icase_map headers;
std::string postdata;
};
struct Response
{
int status_code = 200;
std::string content_type;
string_icase_map headers;
};
using response_callback = std::string (*)(Request&, Response&); //process arguments and POST data and return served-content
#define RESPONSE_CALLBACK_ARGS Request &request, Response &response
struct listener_args
{
std::string listen_address;
int port;
int max_conn;
int max_workers;
void (*looper_callback)() = nullptr;
uint32_t looper_interval = 200;
};
void append_response(const std::string &method, const std::string &uri, const std::string &content_type, response_callback response);
void append_redirect(const std::string &uri, const std::string &target);
void reset_redirect();
int start_web_server(void *argv);
int start_web_server_multi(void *argv);
void stop_web_server();
#endif // WEBSERVER_H_INCLUDED