From 3cba8fca791829af8fbf1a97f5c915b865a65900 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Fri, 24 Dec 2021 17:47:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=8C=85=E5=99=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=A4=AA=E5=A4=9A=E6=97=B6=E4=B8=BB=E5=8A=A8=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Http/HttpRequestSplitter.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 88bc73aa..8afa63c3 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 88bc73aa6b7e04e04ca45f4fdbe36d4e359088bf +Subproject commit 8afa63c31522e031c3d4857f0c723ee4e97447fc diff --git a/src/Http/HttpRequestSplitter.cpp b/src/Http/HttpRequestSplitter.cpp index 70a713e6..93bd0dae 100644 --- a/src/Http/HttpRequestSplitter.cpp +++ b/src/Http/HttpRequestSplitter.cpp @@ -19,9 +19,13 @@ static constexpr size_t kMaxCacheSize = 1 * 1024 * 1024; namespace mediakit { void HttpRequestSplitter::input(const char *data,size_t len) { - if (remainDataSize() > kMaxCacheSize) { - //缓存太多数据无法处理则上抛异常 - throw std::out_of_range("remain data size is too huge:" + to_string(remainDataSize())); + { + auto size = remainDataSize(); + if (size > kMaxCacheSize) { + //缓存太多数据无法处理则上抛异常 + reset(); + throw std::out_of_range("remain data size is too huge, now cleared:" + to_string(size)); + } } const char *ptr = data; if(!_remain_data.empty()){