Skip to content

Why http POST form allows only 32 postArgs elements? #3284

Open
@drschlaumeier

Description

@drschlaumeier

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions