增加最大上传大小限制

This commit is contained in:
xx
2024-06-16 13:38:01 +08:00
parent 4542dc5679
commit 282fbd9a99
6 changed files with 107 additions and 94 deletions

View File

@@ -161,11 +161,21 @@ namespace ylib
cdn_config cdn;
// 代理
std::vector<proxy_config> proxy;
// GZIP
bool gzip = false;
};
/// <summary>
/// HTTP服务配置
/// </summary>
struct server_config {
// 最大上传大小限制
uint64 max_upload_size = 0;
// Https
bool https = false;
// 端口
ushort port = 0;
};
/// <summary>
/// 启动信息
/// </summary>
@@ -174,7 +184,10 @@ namespace ylib
std::vector<website_config> website;
// 证书
std::map<std::string, ssl_config> cert;
// 最大上传大小限制
uint64 max_upload_size = 0;
};
class agent;
class website;
// 临时接收

View File

@@ -24,7 +24,7 @@ namespace ylib
public:
server();
~server();
bool create(bool https, ushort port);
bool create(server_config config);
/******************************************************************
* Function启动
* Param
@@ -53,12 +53,17 @@ namespace ylib
* Function每秒请求数
******************************************************************/
network::qps* qps();
inline const ushort port() { return m_port; }
/// <summary>
/// 取配置
/// </summary>
/// <returns></returns>
const server_config& config() { return m_config; }
#if USE_NET_HTTP_AGENT == 1
inline network::http::agent* agent() { return m_agent; }
#endif
public:
bool m_init_ssl;
bool m_init_ssl = false;
private:
friend class http_server_lst;
private:
@@ -66,10 +71,8 @@ namespace ylib
void* m_server;
// HP Listener 指针
network::http::http_server_lst* m_listener;
// https
bool m_https;
// 端口
ushort m_port;
// 配置
server_config m_config;
// QPS
network::qps m_qps;
#if USE_NET_HTTP_AGENT == 1