Browse Source

INT32_MAX is now maximum message size

pull/1/head
Volker Birk 2 years ago
parent
commit
a3190c46ab
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      webserver.cc

+ 13
- 5
webserver.cc View File

@ -171,14 +171,21 @@ Webserver::handler_t Webserver::find_handler(const request& req, boost::cmatch&
void Webserver::do_session(tcp::socket *socket)
{
beast::error_code ec;
beast::multi_buffer buffer{1024*1024*1024};
beast::flat_buffer buffer;
while (_running)
{
http::request<http::string_body> req;
http::read(*socket, buffer, req, ec);
if (ec)
break;
http::request_parser<http::string_body> parser;
parser.body_limit((std::numeric_limits<std::int32_t>::max)());
http::read(*socket, buffer, parser, ec);
if (ec) {
std::cerr << ec.message() << "\n";
goto the_end;
}
http::request<http::string_body> req = parser.get();
std::cerr << req.body() << "\n";
const auto method = req.method();
switch (method)
@ -217,6 +224,7 @@ void Webserver::do_session(tcp::socket *socket)
break;
}
the_end:
socket->shutdown(tcp::socket::shutdown_send, ec);
delete socket;
}


Loading…
Cancel
Save