WifiESP CANNOT hanndle asynchronous HTML data from POSTed forms

Am I correct with the assumption that it this library SIMPLY cannot handle asynchronous HTML data submitted by the form POST method?

And that the GET method is the only usable option with this library?

There are absolutely NO form POST examples out there to follow that I can find.
And very few mentions of anyone attempting it with arduino.

I think I have absolutely confirmed that you CANNOT use this library to receive form data via the POST method - it just doesn't work.

After a great deal of very frustrating mucking around I have figured out that the headers come through as whole entities just fine

But anything after the headers come through as individual characters with a new connection each time.

And the WifiClient just stops transmitting the characters of the form data in the middle some where for no apparent reason.

So it is impossible to get a full complement of form data via the POST method.

The loop in the function below is essentially the same as the loop in the WifiEsp library's webserver example.

Each time I read a character I add it to strHTTPReq, which is a String object, so that I can output it to serial monitor and see what it looks like.

That works fine for the HTTP headers.

But the only way I can see the form data coming in from the POSTed form (after the header) is to make that local variable static so it holds its value between calls to my function.

With it I need the static flag local bProgramPostData, which I set to true only if I see the word "POST' in strHTTPReq

This "if (!bProgramPostData) strHTTPReq = ""; at the top of my function makes sure that the headers don't just keep building up on top of each other in strHTTPReq.

void CWifi::processHTTPRequest(WiFiEspClient& WifiClient)
{  
  static String strHTTPReq;
  static boolean bProgramPostData = false;
  boolean bNewLine = false;
  char cCh = 0;

  if (!bProgramPostData)
    strHTTPReq = "";
    
  debug(F("New HTTP request"));
  m_nBytesRead = 0;

  while (WifiClient.connected()) 
  {
    if (WifiClient.available()) 
    {
      cCh = WifiClient.read();
      //Serial.print(cCh);

      strHTTPReq += String(cCh);

      // If you've gotten to the end of the line (received a newline
      // character) and the line is blank, the http request has ended,
      // so you can send a reply
      // A http request ends with a blank line
      if (((cCh == '\n') && bNewLine) || bProgramPostData)
      {
        debug(F("***********************************************************************"));
        debug(F("HTTP request:"));
        debug(strHTTPReq);
        debug(F("***********************************************************************"));
        
        // Default HTTP request
        // ---------------------
        // GET / HTTP/1.1
        // Host: 10.0.0.79
        // User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
        // Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*//*;q=0.8
        // Accept-Language: en-US,en;q=0.5
        // Accept-Encoding: gzip, deflate
        // Connection: keep-alive
        // Upgrade-Insecure-Requests: 1
        // Cache-Control: max-age=0
        
        if ((strHTTPReq.indexOf("GET / HTTP/1.1") >= 0) && !sendContent(WifiClient, false))
        {
          debug("Could not open default1.htm and/or default2.htm!");
        }
        else if ((strHTTPReq.indexOf("GET /favicon.ico HTTP/1.1") >= 0) && !sendFile(WifiClient, m_strFaviconFileName.c_str()))
        {
          debug("Could not open " + m_strFaviconFileName + "!");
        }
        else if ((strHTTPReq.indexOf("POST /program.htm HTTP/1.1") >= 0))
        {
          uint16_t nDataLen = getPostDataLength(strHTTPReq);
          debug('*', nDataLen);
          bProgramPostData = true;
/*
          if (!readPostData(WifiClient, nDataLen))
            debug("Could not save irrigation program to SD card!");

          if (!sendContent(WifiClient, false))
            debug("Could not send submit form response!");
*/
        }
        else if ((strHTTPReq.indexOf("POST /alarms.htm HTTP/1.1") >= 0))
        {
        }
        break;
      }
      // You're starting a new line
      if (cCh == '\n')
      {
        bNewLine = true;
      }
      // You've gotten a character on the current line
      else if (cCh != '\r')
      {
        bNewLine = false;
      }
    }
  }
  // give the web browser time to receive the data
  delay(100);

  // Close the connection:
  if (!bProgramPostData)
    WifiClient.stop();
  debug("Client disconnected");

So with this code in place this is what I see in serial monitor as the POST data is coming in.
Notice this bit:

RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nu
RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo
RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%
RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%r
RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%r2

But after this stage the client abruptly disconnects and I receive no more form data.


HTTP request:
POST /program.htm HTTP/1.1
Host: 10.0.0.79
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://10.0.0.79/
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 555

RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%


Content-Length = 555
555
Client disconnected
[WiFiEsp] New client 0
New HTTP request


HTTP request:
POST /program.htm HTTP/1.1
Host: 10.0.0.79
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://10.0.0.79/
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 555

RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%r


Content-Length = 555
555
Client disconnected
[WiFiEsp] New client 0
New HTTP request


HTTP request:
POST /program.htm HTTP/1.1
Host: 10.0.0.79
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://10.0.0.79/
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 555

RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%r2


Content-Length = 555
555
Client disconnected
[WiFiEsp] New client 0
New HTTP request
[WiFiEsp] TIMEOUT: 488


HTTP request:
POST /program.htm HTTP/1.1
Host: 10.0.0.79
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://10.0.0.79/
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 555

RadioStation=1&Frequency=1&SelectMonthFrequency=1&TimeStart=&Nuo%r2


Content-Length = 555
555
Client disconnected