fix(libhttp,dnfs2): HttpClient 新增超时接口,dnfs2 启用配置超时
修复 dnfs2 审计 L-3(P2-N5): libhttp HttpClient 硬编码 CURLOPT_TIMEOUT=30L/CONNECTTIMEOUT=10L, dnfs2 的 gateway_timeout/review_timeout 配置加载后从未使用,实际超时恒为 30s。 修复: - libhttp HttpClient 新增 set_timeout/set_connect_timeout 接口 (默认 30s/10s,向后兼容 gateway/core) - request_stream_sync 使用成员变量替代硬编码值 - dnfs2 decode_token 设置 gateway_timeout - dnfs2 review_content 设置 review_timeout 安全评级 A- → A,已知限制 6→5 项。
This commit is contained in:
1 parent
9804838e96
commit
117fc0241e
5 files changed
+70
-16
No files matched your search
@@ -65,6 +65,14 @@ public:
|
||||
void set_max_response_size(size_t bytes);
|
||||
size_t get_max_response_size() const;
|
||||
|
||||
// ===== 请求超时控制 =====
|
||||
// 设置整体请求超时(秒,含连接+传输)。默认 30s。
|
||||
void set_timeout(long seconds);
|
||||
long get_timeout() const;
|
||||
// 设置连接建立超时(秒)。默认 10s。
|
||||
void set_connect_timeout(long seconds);
|
||||
long get_connect_timeout() const;
|
||||
|
||||
// ===== WebSocket Methods (Synchronous, Boost.Beast-based) =====
|
||||
bool ws_connect(const std::string& url, int timeout_ms = 5000);
|
||||
bool ws_connect(const std::string& host, const std::string& port,
|
||||
@@ -84,6 +92,8 @@ private:
|
||||
std::map<std::string, std::string> response_headers_;
|
||||
long response_code_ = 0;
|
||||
size_t max_response_size_ = 10 * 1024 * 1024; // 默认 10MB,对齐 WAF;0 表示不限制
|
||||
long timeout_ = 30; // 整体请求超时(秒),默认 30s
|
||||
long connect_timeout_ = 10; // 连接建立超时(秒),默认 10s
|
||||
|
||||
struct WsState {
|
||||
asio::io_context ioc;
|
||||
|
||||
Reference in new issue
Block a user