MCPcopy Create free account
hub / github.com/boostorg/beast / do_read

Method do_read

example/advanced/server-flex/advanced_server_flex.cpp:472–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470 }
471
472 void
473 do_read()
474 {
475 // Construct a new parser for each message
476 parser_.emplace();
477
478 // Apply a reasonable limit to the allowed size
479 // of the body in bytes to prevent abuse.
480 parser_->body_limit(10000);
481
482 // Set the timeout.
483 beast::get_lowest_layer(
484 derived().stream()).expires_after(std::chrono::seconds(30));
485
486 // Read a request using the parser-oriented interface
487 http::async_read(
488 derived().stream(),
489 buffer_,
490 *parser_,
491 beast::bind_front_handler(
492 &http_session::on_read,
493 derived().shared_from_this()));
494 }
495
496 void
497 on_read(beast::error_code ec, std::size_t bytes_transferred)

Callers 1

runMethod · 0.45

Calls 4

bind_front_handlerFunction · 0.85
emplaceMethod · 0.80
body_limitMethod · 0.80
async_readFunction · 0.50

Tested by

no test coverage detected