1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

fix plain post slowdown

This commit is contained in:
Me No Dev 2015-07-16 21:39:09 +03:00
parent 1cd50e481f
commit a6d8253b15

View File

@ -108,20 +108,22 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
if (!isForm){
if (searchStr != "") searchStr += '&';
String bodyLine = client.readStringUntil('\r');
size_t plainLen = client.available();
char *plainBuf = (char*)malloc(plainLen+1);
client.readBytes(plainBuf, plainLen);
plainBuf[plainLen] = '\0';
#ifdef DEBUG
DEBUG_OUTPUT.print("Plain: ");
DEBUG_OUTPUT.println(bodyLine);
DEBUG_OUTPUT.println(plainBuf);
#endif
if(bodyLine.startsWith("{") || bodyLine.startsWith("[") || bodyLine.indexOf('=') == -1){
if(plainBuf[0] == '{' || plainBuf[0] == '[' || strstr(plainBuf, "=") == NULL){
//plain post json or other data
searchStr += "plain=";
searchStr += bodyLine;
searchStr += client.readString();
searchStr += plainBuf;
} else {
searchStr += bodyLine;
client.readStringUntil('\n');
searchStr += plainBuf;
}
free(plainBuf);
}
_parseArguments(searchStr);
if (isForm){