int ICACHE_FLASH_ATTR cgiUploadFirmware(HttpdConnData *connData) {
int offset = connData->post->received - connData->post->buffLen;
if (offset == 0) {
connData->cgiPrivData = NULL;
} else if (connData->cgiPrivData != NULL) {
// we have an error condition, do nothing
return HTTPD_CGI_DONE;
}
...
// return an error if there is one
if (err != NULL) {
os_printf("Error %d: %s\n", code, err);
...
connData->cgiPrivData = (void *)1;
return HTTPD_CGI_DONE;
}
It seems to me that as soon as the handler returns HTTPD_CGI_DONE it should not be called again, but that's not what happens.