1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

setMD5 has now returns bool

handle setMD5 failed in HTTP update
reset UpdaterClass when MD5 check failed
see: #1244
This commit is contained in:
Markus Sattler
2015-12-18 08:30:35 +01:00
parent 727b6b1f6f
commit 02e6b2fc16
4 changed files with 14 additions and 4 deletions

View File

@ -296,7 +296,11 @@ bool ESP8266HTTPUpdate::runUpdate(Stream& in, uint32_t size, String md5, int com
}
if(md5.length()) {
Update.setMD5(md5.c_str());
if(!Update.setMD5(md5.c_str())) {
lastError = HTTP_UE_SERVER_FAULTY_MD5;
DEBUG_HTTP_UPDATE("[httpUpdate] Update.setMD5 failed! (%s)\n", md5.c_str());
return false;
}
}
if(Update.writeStream(in) != size) {

View File

@ -44,6 +44,7 @@
#define HTTP_UE_SERVER_FILE_NOT_FOUND (-102)
#define HTTP_UE_SERVER_FORBIDDEN (-103)
#define HTTP_UE_SERVER_WRONG_HTTP_CODE (-104)
#define HTTP_UE_SERVER_FAULTY_MD5 (-105)
typedef enum {
HTTP_UPDATE_FAILED,