diff options
author | getsiu <[email protected]> | 2025-07-23 18:26:00 +0300 |
---|---|---|
committer | getsiu <[email protected]> | 2025-07-23 18:54:19 +0300 |
commit | d1dd865223ded83019dc018706973398542a178b (patch) | |
tree | ca89fe4096faee19bb9c6b692b0b0f2c19f3e82e | |
parent | 074c0666848b30c6e58db58577c1797df1532cd3 (diff) |
THttpParser::Reset must also reset internal state of underlying http parser to properly consume next request in case of errors
commit_hash:675fce530fe19d2b21a331550c41bb161054bacc
-rw-r--r-- | yt/yt/core/http/stream.cpp | 5 | ||||
-rw-r--r-- | yt/yt/core/http/stream.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/yt/yt/core/http/stream.cpp b/yt/yt/core/http/stream.cpp index 1de83ced050..f8005a846e4 100644 --- a/yt/yt/core/http/stream.cpp +++ b/yt/yt/core/http/stream.cpp @@ -59,7 +59,8 @@ http_parser_settings THttpParser::GetParserSettings() const http_parser_settings ParserSettings = THttpParser::GetParserSettings(); THttpParser::THttpParser(http_parser_type parserType) - : Headers_(New<THeaders>()) + : ParserType_(parserType) + , Headers_(New<THeaders>()) { http_parser_init(&Parser_, parserType); Parser_.data = reinterpret_cast<void*>(this); @@ -86,6 +87,8 @@ void THttpParser::Reset() YT_VERIFY(FirstLine_.GetLength() == 0); YT_VERIFY(NextField_.GetLength() == 0); YT_VERIFY(NextValue_.GetLength() == 0); + + http_parser_init(&Parser_, ParserType_); } TSharedRef THttpParser::Feed(const TSharedRef& input) diff --git a/yt/yt/core/http/stream.h b/yt/yt/core/http/stream.h index aa41b1d276f..657e4f05f86 100644 --- a/yt/yt/core/http/stream.h +++ b/yt/yt/core/http/stream.h @@ -51,6 +51,8 @@ public: TSharedRef Feed(const TSharedRef& buf); private: + const http_parser_type ParserType_{}; + http_parser Parser_{}; TStringBuilder FirstLine_; |