boostorg / boostorg/beast

How to clear recveive buffer after read when buffer is reused.

Open
#1,656 3 comments 1 reaction 0 assignees View on GitHub
Design
Dominant language
C++
Stars
4.8k
Forks
694
Avg merge
12h 48m
Merged PRs (30d)
1

Description

I am using REST protocol with BEAST https. I try to reuse the beast::buffer::flat_buffer.

But I found each time I send a request and read from http::response. the buffer didn't clear the result from previous request.
For example, first time the server send back "[]", the second time I read is "[][next time result]".

I called response->clear() and buff->consume(0); it does'nt work.

How to clear the buffer after I have processed the result and prepare the buffer for next time read?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.