update embedded page for login icon

finalize file upload error management sanity check
This commit is contained in:
Luc
2019-09-03 15:48:57 +02:00
parent f4749cce9f
commit 11e2722768
12 changed files with 2140 additions and 1412 deletions

View File

@@ -113,15 +113,21 @@ bool HTTP_Server::StreamFSFile(const char* filename, const char * contentType)
return true;
}
void HTTP_Server::pushError(int code, const char * st)
void HTTP_Server::pushError(int code, const char * st, bool web_error, uint16_t timeout)
{
if (websocket_terminal_server.started() && st) {
String s = "ERROR:" + String(code) + ":";
s+=st;
websocket_terminal_server.pushMSG(websocket_terminal_server.get_currentID(), s.c_str());
if (web_error != 0) {
if (_webserver) {
if (_webserver->client().available() > 0) {
_webserver->send (web_error, "text/xml", st);
}
}
}
uint32_t t = millis();
while (millis() - t < 1000) {
while (millis() - t < timeout) {
websocket_terminal_server.handle();
Hal::wait(10);
}
@@ -135,7 +141,7 @@ void HTTP_Server::cancelUpload()
#if defined ( ARDUINO_ARCH_ESP8266)
_webserver->client().stopAll();
#else
//errno = 128;
errno = ECONNABORTED;
_webserver->client().stop();
#endif
Hal::wait(100);