Skip to content

Commit 4001637

Browse files
committed
Added CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH
1 parent 47044c0 commit 4001637

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

httplib.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits<size_t>::max)())
7575
#endif
7676

77+
#ifndef CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH
78+
#define CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH 8192
79+
#endif
80+
7781
#ifndef CPPHTTPLIB_TCP_NODELAY
7882
#define CPPHTTPLIB_TCP_NODELAY false
7983
#endif
@@ -5189,7 +5193,7 @@ inline bool Server::read_content(Stream &strm, Request &req, Response &res) {
51895193
})) {
51905194
const auto &content_type = req.get_header_value("Content-Type");
51915195
if (!content_type.find("application/x-www-form-urlencoded")) {
5192-
if (req.body.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
5196+
if (req.body.size() > CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH) {
51935197
res.status = 413; // NOTE: should be 414?
51945198
return false;
51955199
}

0 commit comments

Comments
 (0)