#define RESPONSE_STREAM_BUFFER_SIZE 1460

This commit is contained in:
Mathieu Carbou
2024-09-11 21:56:23 +02:00
parent 02063bd929
commit e28aa5e3fc
2 changed files with 5 additions and 4 deletions

View File

@@ -340,7 +340,7 @@ void AsyncWebServerRequest::_parsePlainPostChar(uint8_t data) {
void AsyncWebServerRequest::_handleUploadByte(uint8_t data, bool last) {
_itemBuffer[_itemBufferIndex++] = data;
if (last || _itemBufferIndex == 1460) {
if (last || _itemBufferIndex == RESPONSE_STREAM_BUFFER_SIZE) {
// check if authenticated before calling the upload
if (_handler)
_handler->handleUpload(this, _itemFilename, _itemSize - _itemBufferIndex, _itemBuffer, _itemBufferIndex, false);
@@ -444,7 +444,7 @@ void AsyncWebServerRequest::_parseMultipartPostByte(uint8_t data, bool last) {
if (_itemIsFile) {
if (_itemBuffer)
free(_itemBuffer);
_itemBuffer = (uint8_t*)malloc(1460);
_itemBuffer = (uint8_t*)malloc(RESPONSE_STREAM_BUFFER_SIZE);
if (_itemBuffer == NULL) {
_multiParseState = PARSE_ERROR;
return;