增加最大上传限制
This commit is contained in:
@@ -50,8 +50,9 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
m_lastErrorDesc = "open config failed, " + config->last_error();
|
||||
return false;
|
||||
}
|
||||
config->write_runtime(ylib::json());
|
||||
// 虚拟机管理器
|
||||
if(state->start() == false)
|
||||
if (state->start() == false)
|
||||
{
|
||||
m_lastErrorDesc = state->last_error();
|
||||
return false;
|
||||
@@ -60,7 +61,7 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
m_center = new network::http::center();
|
||||
network::http::start_config config;
|
||||
network::http::website_config ws_config;
|
||||
|
||||
config.max_upload_size = this->config->website.max_upload_size;
|
||||
for_iter(iter, this->config->domain)
|
||||
{
|
||||
network::http::host_config host_config;
|
||||
@@ -80,7 +81,7 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
}
|
||||
|
||||
ws_config.name = "master";
|
||||
|
||||
|
||||
ws_config.router.threadpool.size = 40;
|
||||
ws_config.router.threadpool.queuemax = 10000;
|
||||
ws_config.session.dirpath = this->config->website.session_dir;
|
||||
@@ -88,7 +89,7 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
config.website.push_back(ws_config);
|
||||
for_iter(iter, this->config->domain)
|
||||
{
|
||||
if(iter->second.https)
|
||||
if (iter->second.https)
|
||||
config.cert.emplace(iter->first, iter->second.ssl);
|
||||
}
|
||||
|
||||
@@ -99,11 +100,11 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
}
|
||||
auto website = m_center->website_byname(ws_config.name);
|
||||
router = website->router();
|
||||
|
||||
|
||||
// 初始化脚本
|
||||
if (initialization_script() == false)
|
||||
return false;
|
||||
|
||||
|
||||
this->subscribe->start();
|
||||
|
||||
if (m_center->start() == false)
|
||||
@@ -111,6 +112,13 @@ bool fastweb::app::start(const std::string& config_filepath)
|
||||
m_lastErrorDesc = m_center->last_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
ylib::json data;
|
||||
data["started"] = true;
|
||||
this->config->write_runtime(data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -133,6 +141,7 @@ void fastweb::app::stop()
|
||||
delete m_state_init;
|
||||
m_state_init = nullptr;
|
||||
state->close();
|
||||
|
||||
}
|
||||
|
||||
bool fastweb::app::initialization_script()
|
||||
|
||||
@@ -22,6 +22,7 @@ fastweb::config::config(fastweb::app* ptr):Interface(ptr)
|
||||
}
|
||||
bool fastweb::config::open(const std::string& ini_filepath)
|
||||
{
|
||||
m_ini_filepath = ini_filepath;
|
||||
if (ylib::file::exist(ini_filepath) == false)
|
||||
{
|
||||
LOG_ERROR("not found file: " + ini_filepath);
|
||||
@@ -83,6 +84,14 @@ std::vector<std::string> fastweb::config::lua_lib_files()
|
||||
|
||||
return results;
|
||||
}
|
||||
void fastweb::config::write_runtime(const ylib::json& data)
|
||||
{
|
||||
ylib::file::write(ylib::file::parent_dir(m_ini_filepath) + "/.fastweb_runtime", data.to_string());
|
||||
}
|
||||
ylib::json fastweb::config::read_runtime()
|
||||
{
|
||||
return ylib::json::from(ylib::file::read(ylib::file::parent_dir(m_ini_filepath) + "/.fastweb_runtime"));
|
||||
}
|
||||
std::vector<std::string> fastweb::config::extractVariableNames(const std::string& text)
|
||||
{
|
||||
std::regex pattern("\\$\\{([^}]+)\\}"); // 使用捕获组提取中间的内容
|
||||
@@ -116,6 +125,7 @@ void fastweb::config::cache()
|
||||
website.debug = m_ini.read("website", "debug") == "1";
|
||||
website.domain = strutils::split(m_ini.read("website", "domain"),',');
|
||||
website.direct_url_mapping = m_ini.read("website", "direct_url_mapping") == "1";
|
||||
website.max_upload_size = ylib::stoll(m_ini.read("website", "max_upload_size"));
|
||||
|
||||
log.enable = m_ini.read("log", "enable") == "1";
|
||||
log.dir = PATH_EX(m_ini.read("log", "dir"));
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace fastweb
|
||||
bool debug = false;
|
||||
std::vector<std::string> domain;
|
||||
bool direct_url_mapping = false;
|
||||
uint64 max_upload_size = 0;
|
||||
};
|
||||
|
||||
struct log {
|
||||
@@ -47,8 +48,12 @@ namespace fastweb
|
||||
public:
|
||||
config(fastweb::app* ptr);
|
||||
bool open(const std::string& ini_filepath);
|
||||
|
||||
std::vector<std::string> lua_lib_files();
|
||||
|
||||
|
||||
void write_runtime(const ylib::json& data);
|
||||
ylib::json read_runtime();
|
||||
|
||||
private:
|
||||
// INI配置文件
|
||||
ylib::ini m_ini;
|
||||
@@ -64,6 +69,7 @@ namespace fastweb
|
||||
/// </summary>
|
||||
void cache();
|
||||
public:
|
||||
std::string m_ini_filepath;
|
||||
scripts scripts;
|
||||
website website;
|
||||
log log;
|
||||
|
||||
Reference in New Issue
Block a user