diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-10-11 17:07:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-10-11 17:07:02 +0300 |
commit | 0b931ad6e6868bca7e7ec4617999c0d6befd7003 (patch) | |
tree | c10d4fcf9f5a638745e9c2b725852f03e5a175ce /library/cpp/actors/http/http.cpp | |
parent | e6c9b17192c56494adba359d5e132c431b241191 (diff) | |
download | ydb-0b931ad6e6868bca7e7ec4617999c0d6befd7003.tar.gz |
Ydb stable 22-4-3022.4.30
x-stable-origin-commit: a5971297427891237b5f05b5389146b6ca2fff93
Diffstat (limited to 'library/cpp/actors/http/http.cpp')
-rw-r--r-- | library/cpp/actors/http/http.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/library/cpp/actors/http/http.cpp b/library/cpp/actors/http/http.cpp index ef25a17a8a..7da6ace0b9 100644 --- a/library/cpp/actors/http/http.cpp +++ b/library/cpp/actors/http/http.cpp @@ -108,7 +108,9 @@ void THttpParser<THttpRequest, TSocketBuffer>::Advance(size_t len) { case EParseStage::Header: { if (ProcessData(Header, data, "\r\n", MaxHeaderSize)) { if (Header.empty()) { - if (HaveBody()) { + if (HaveBody() && (ContentLength.empty() || ContentLength != "0")) { + Stage = EParseStage::Body; + } else if (TotalSize.has_value() && !data.empty()) { Stage = EParseStage::Body; } else { Stage = EParseStage::Done; @@ -118,7 +120,10 @@ void THttpParser<THttpRequest, TSocketBuffer>::Advance(size_t len) { } Headers = TStringBuf(Headers.data(), data.data() - Headers.data()); } - break; + if (Stage != EParseStage::Body) { + break; + } + [[fallthrough]]; } case EParseStage::Body: { if (!ContentLength.empty()) { @@ -271,7 +276,10 @@ void THttpParser<THttpResponse, TSocketBuffer>::Advance(size_t len) { } Headers = TStringBuf(Headers.data(), data.data() - Headers.data()); } - break; + if (Stage != EParseStage::Body) { + break; + } + [[fallthrough]]; } case EParseStage::Body: { if (!ContentLength.empty()) { |