esp8266 / esp8266/Arduino

Why http POST form allows only 32 postArgs elements?

Open
#3,284 7 comments 0 reactions 0 assignees View on GitHub
component: libraries type: enhancement
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

My Webserver Configuration Page needs to POST a form with >32 elements. Why ESP8266WebServer::_parseForm allows only 32 postArgs elements?

#### Hardware
Hardware: ESP-8285
Core Version: 2.4.0 ...

### Description
I'm building a WebServer around my home light control based on Sonoff Touch device. The flexible configuration page of the webserver uses a html page with form and tables filled with some postArgs elements (some input - type text, some select, some input - type checkbox). All together I have 37 postArgs elements to POST back to my WebServer. After long debugging the esp CRASH I found that the ESP8266WebServer::_parseForm allows only 32 postArgs elements. ... see below code from "Parsing.cpp"
Why only 32? Can someone change to higher value? Any other idea what I can do? Is splitting the config page into several pages the right way?

Thanks in advance

```
bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
(void) len;
#ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Parse Form: Boundary: ");
DEBUG_OUTPUT.print(boundary);
DEBUG_OUTPUT.print(" Length: ");
DEBUG_OUTPUT.println(len);
#endif
String line;
int retry = 0;
do {
line = client.readStringUntil('\r');
++retry;
} while (line.length() == 0 && retry < 3);

client.readStringUntil('\n');
//start reading the form
if (line == ("--"+boundary)){
RequestArgument* postArgs = new RequestArgument[32];
int postArgsLen = 0;
while(1){
String argName;
String argValue;
String argType;
String argFilename;
bool argIsFile = false;

.......
```
### Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 1MB
CPU Frequency: 80Mhz
Flash Mode: DOUT
Flash Frequency: 40Mhz
Upload Using: OTA / SERIAL
Reset Method: ck

################################################

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.