добавил обновление прошивки из веб морды
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "request_parser.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "request.hpp"
|
||||
|
||||
@@ -14,16 +13,16 @@ namespace http::server {
|
||||
*/
|
||||
static bool requestBodySizeResolver(Request& req, size_t reqSize) {
|
||||
// разрешаем тело только для POST запросов
|
||||
if (req.method != "POST") {
|
||||
return false;
|
||||
if (req.method == "POST") {
|
||||
return reqSize < 0x4000; // 16кб на все POST-запросы к API будет более чем достаточно
|
||||
}
|
||||
|
||||
// для обновления прошивки разрешаем большое тело
|
||||
if (req.url->path == "/api/firmwareUpdate") {
|
||||
// это для обновления прошивки
|
||||
if (req.method == "PUT" && req.url->path == "/api/firmwareUpdate") {
|
||||
return reqSize <= HTTP_MAX_PAYLOAD;
|
||||
}
|
||||
|
||||
return reqSize < 0x4000; // 16кб на все POST-запросы к API будет более чем достаточно
|
||||
return false;
|
||||
}
|
||||
|
||||
static void parseParams(Url& u, const std::string& query) {
|
||||
@@ -277,7 +276,7 @@ namespace http::server {
|
||||
if (content_len.empty()) {
|
||||
return good;
|
||||
}
|
||||
contentLenghtHeader = std::stol(content_len);
|
||||
contentLenghtHeader = std::stoul(content_len);
|
||||
if (contentLenghtHeader == 0) {
|
||||
return good;
|
||||
}
|
||||
|
Reference in New Issue
Block a user