From: Casey Bodley Date: Tue, 11 Jul 2017 20:12:02 +0000 (-0400) Subject: rgw: set header/body size limits on beast parser X-Git-Tag: v13.0.1~300^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1f72684eb4c6fb9fd021240ae55812894afc19e9;p=ceph.git rgw: set header/body size limits on beast parser Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index f64f435920d..cd753eb323c 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -72,12 +72,21 @@ static void handle_connection(RGWProcessEnv& env, tcp::socket socket, auto cct = env.store->ctx(); boost::system::error_code ec; - beast::flat_buffer buffer{4096}; + // limit header to 4k, since we read it all into a single buffer + constexpr size_t header_limit = 4096; + // don't impose a limit on the body, since we read it in pieces + constexpr size_t body_limit = std::numeric_limits::max(); + + beast::flat_buffer buffer; // read messages from the socket until eof for (;;) { - // parse the header + // configure the parser rgw::asio::parser_type parser; + parser.header_limit(header_limit); + parser.body_limit(body_limit); + + // parse the header beast::http::async_read_header(socket, buffer, parser, yield[ec]); if (ec == boost::asio::error::connection_reset ||