Client: async request handlers are now called multiple times if response content is larger than Config::max_response_streambuf_size. Also improved streambuf to streambuf copy, and streambuf to string copy. Finally, string() functions no longer consume streambuf.

This commit is contained in:
eidheim 2020-01-14 14:32:36 +01:00
commit 3be67623fa
5 changed files with 285 additions and 146 deletions

View file

@ -85,7 +85,7 @@ namespace SimpleWeb {
if(!lock)
return;
if(!ec) {
std::shared_ptr<Response> response(new Response(this->config.max_response_streambuf_size));
std::shared_ptr<Response> response(new Response(this->config.max_response_streambuf_size, session->connection));
session->connection->set_timeout(this->config.timeout_connect);
asio::async_read_until(session->connection->socket->next_layer(), response->streambuf, "\r\n\r\n", [this, session, response](const error_code &ec, std::size_t /*bytes_transferred*/) {
session->connection->cancel_timeout();