From 856c181b7fd9451ce9a6d8181e1cbd0410e4bad4 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 26 Apr 2020 13:50:49 +0200 Subject: Fixed upload limit (now 1GB) --- https.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'https.cpp') diff --git a/https.cpp b/https.cpp index 7c94099..f02a1b7 100644 --- a/https.cpp +++ b/https.cpp @@ -90,6 +90,7 @@ class session : public std::enable_shared_from_this #endif beast::flat_buffer buffer_; Server& m_server; + http::request_parser parser_; http::request req_; std::shared_ptr res_; @@ -142,6 +143,7 @@ public: #endif , m_server(server) { + parser_.body_limit(1000000000); // 1GB limit } // Start the asynchronous operation @@ -212,12 +214,12 @@ public: beast::get_lowest_layer(stream_).expires_after(std::chrono::seconds(30)); // Read a request - http::async_read(stream_, buffer_, req_, + http::async_read(stream_, buffer_, parser_, beast::bind_front_handler( &session::on_read, shared_from_this())); #else - http::async_read(stream_, buffer_, req_, + http::async_read(stream_, buffer_, parser_, boost::asio::bind_executor( strand_, std::bind( @@ -246,6 +248,9 @@ public: if(ec) return fail(ec, "read"); + req_ = parser_.get(); + parser_.release(); + // Send the response handle_request(m_server, std::move(req_)); } -- cgit v1.2.3