From 377938403bb4d53317843b59f67b407082281d47 Mon Sep 17 00:00:00 2001 From: Jackarain Date: Thu, 5 Sep 2024 00:45:40 +0800 Subject: [PATCH] Improve http get rate limit --- proxy/include/proxy/proxy_server.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/include/proxy/proxy_server.hpp b/proxy/include/proxy/proxy_server.hpp index b7eaf523e..6f55a1284 100644 --- a/proxy/include/proxy/proxy_server.hpp +++ b/proxy/include/proxy/proxy_server.hpp @@ -4235,7 +4235,10 @@ R"x*x*x( co_return; } - const auto buf_size = 5 * 1024 * 1024; + auto buf_size = 5 * 1024 * 1024; + if (m_option.tcp_rate_limit_ > 0 && m_option.tcp_rate_limit_ < buf_size) + buf_size = m_option.tcp_rate_limit_; + auto bufs = std::make_unique(buf_size); char* buf = bufs.get(); std::streamsize total = 0;