Skip to content

Commit

Permalink
basic_parser: remove skip_ usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Aug 21, 2024
1 parent b1f377b commit aefc564
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion include/boost/beast/http/basic_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class basic_parser
std::uint64_t len0_ = 0; // content length if known
std::unique_ptr<char[]> 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
Expand Down
9 changes: 2 additions & 7 deletions include/boost/beast/http/impl/basic_parser.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::size_t>(p1 - p);
Expand Down Expand Up @@ -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;
Expand All @@ -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<std::size_t>(eol - p - 2);

std::uint64_t size;
if(! parse_hex(p, size))
Expand Down Expand Up @@ -644,7 +640,6 @@ parse_chunk_header(char const*& in,
return;

len_ = size;
skip_ = 0;
in = eol;
f_ |= flagExpectCRLF;
if(size != 0)
Expand Down

0 comments on commit aefc564

Please sign in to comment.