From aefc564fa72c07a3afc8a4cc8b460476f3c35a35 Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Wed, 21 Aug 2024 18:29:09 +0000 Subject: [PATCH] basic_parser: remove `skip_` usage --- include/boost/beast/http/basic_parser.hpp | 1 - include/boost/beast/http/impl/basic_parser.ipp | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/boost/beast/http/basic_parser.hpp b/include/boost/beast/http/basic_parser.hpp index ce22520d55..fbc44273e8 100644 --- a/include/boost/beast/http/basic_parser.hpp +++ b/include/boost/beast/http/basic_parser.hpp @@ -78,7 +78,6 @@ class basic_parser std::uint64_t len0_ = 0; // content length if known std::unique_ptr buf_; // temp storage std::size_t buf_len_ = 0; // size of buf_ - std::size_t skip_ = 0; // resume search here std::uint32_t header_limit_ = 8192; // max header size unsigned short status_ = 0; // response status state state_ = state::nothing_yet; // initial state diff --git a/include/boost/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp index c02554f154..d2c28d1beb 100644 --- a/include/boost/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -164,7 +164,6 @@ loop: parse_chunk_header(p, n, ec); if(ec) goto done; - BOOST_ASSERT(! skip_); if(state_ != state::trailer_fields) break; n = static_cast(p1 - p); @@ -584,7 +583,7 @@ parse_chunk_header(char const*& in, auto p = in; auto const pend = p + n; - if(n < skip_ + 2) + if(n < 2) { BOOST_BEAST_ASSIGN_EC(ec, error::need_more); return; @@ -601,17 +600,14 @@ parse_chunk_header(char const*& in, } } - auto const eol = find_eol(p + skip_, pend, ec); + auto const eol = find_eol(p, pend, ec); if(ec) return; if(! eol) { BOOST_BEAST_ASSIGN_EC(ec, error::need_more); - if(p != pend) - skip_ = pend - p - 1; return; } - skip_ = static_cast(eol - p - 2); std::uint64_t size; if(! parse_hex(p, size)) @@ -644,7 +640,6 @@ parse_chunk_header(char const*& in, return; len_ = size; - skip_ = 0; in = eol; f_ |= flagExpectCRLF; if(size != 0)