summaryrefslogtreecommitdiffhomepage
path: root/http.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-26 13:50:49 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-26 13:50:49 +0200
commit856c181b7fd9451ce9a6d8181e1cbd0410e4bad4 (patch)
tree8df5a798afac3793b20b2b442928c67cc26c78f4 /http.cpp
parentaebe139d00b44684158edb3616da5c37b12db6d1 (diff)
Fixed upload limit (now 1GB)
Diffstat (limited to 'http.cpp')
-rw-r--r--http.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/http.cpp b/http.cpp
index a4709bb..ce3309f 100644
--- a/http.cpp
+++ b/http.cpp
@@ -56,6 +56,7 @@ class session : public std::enable_shared_from_this<session>
#endif
beast::flat_buffer buffer_;
Server& m_server;
+ http::request_parser<http::string_body> parser_;
request_type req_;
std::shared_ptr<response_type> res_;
@@ -106,6 +107,7 @@ public:
#endif
, m_server(server)
{
+ parser_.body_limit(1000000000); // 1GB limit
}
// Start the asynchronous operation
@@ -136,13 +138,13 @@ public:
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(socket_, buffer_, req_,
+ http::async_read(socket_, buffer_, parser_,
boost::asio::bind_executor(
strand_,
std::bind(
@@ -173,6 +175,9 @@ public:
if(ec)
return fail(ec, "read");
+ req_ = parser_.get();
+ parser_.release();
+
// Send the response
handle_request(m_server, std::move(req_));
}