Add option to CMake to build as static library

This commit is contained in:
Tindy X committed 2021-12-15 00:13:00 +08:00
1 parent 4639ee483e
commit 35809391e9
10 files changed
+376 -294

No files matched your search

+2 -38
View File
@@ -1307,49 +1307,13 @@ std::string getRewriteRemote(RESPONSE_CALLBACK_ARGS)
return output_content;
}
std::string parseHostname(inja::Arguments &args)
{
std::string data = args.at(0)->get<std::string>(), hostname;
const std::string matcher = R"(^(?i:hostname\s*?=\s*?)(.*?)\s$)";
string_array urls = split(data, ",");
if(!urls.size())
return std::string();
std::string input_content, output_content, proxy = parseProxy(global.proxyConfig);
for(std::string &x : urls)
{
input_content = webGet(x, proxy, global.cacheConfig);
regGetMatch(input_content, matcher, 2, 0, &hostname);
if(hostname.size())
{
output_content += hostname + ",";
hostname.clear();
}
}
string_array vArray = split(output_content, ",");
std::set<std::string> hostnames;
for(std::string &x : vArray)
hostnames.emplace(trim(x));
output_content = std::accumulate(hostnames.begin(), hostnames.end(), std::string(), [](std::string a, std::string b)
{
return std::move(a) + "," + std::move(b);
});
return output_content;
}
std::string template_webGet(inja::Arguments &args)
{
std::string data = args.at(0)->get<std::string>(), proxy = parseProxy(global.proxyConfig);
writeLog(0, "Template called fetch with url '" + data + "'.", LOG_LEVEL_INFO);
return webGet(data, proxy, global.cacheConfig);
}
/*
std::string jinja2_webGet(const std::string &url)
{
std::string proxy = parseProxy(global.proxyConfig);
writeLog(0, "Template called fetch with url '" + url + "'.", LOG_LEVEL_INFO);
return webGet(url, proxy, global.cacheConfig);
}
}*/
inline std::string intToStream(unsigned long long stream)
{
+2
View File
@@ -65,8 +65,10 @@ std::shared_future<std::string> fetchFileAsync(const std::string &path, const st
retVal = std::async(std::launch::async, [path](){return vfs::vfs_get(path);});
else */if(fileExist(path, true))
retVal = std::async(std::launch::async, [path](){return fileGet(path, true);});
#ifdef NO_WEBGET
else if(isLink(path))
retVal = std::async(std::launch::async, [path, proxy, cache_ttl](){return webGet(path, proxy, cache_ttl);});
#endif // NO_WEBGET
else
return std::async(std::launch::async, [](){return std::string();});
if(!async)