mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-22 08:22:04 +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:
@ -124,9 +124,13 @@ bool UpdaterClass::begin(size_t size, int command) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void UpdaterClass::setMD5(const char * expected_md5){
|
||||
if(strlen(expected_md5) != 32) return;
|
||||
bool UpdaterClass::setMD5(const char * expected_md5){
|
||||
if(strlen(expected_md5) != 32)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_target_md5 = expected_md5;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UpdaterClass::end(bool evenIfRemaining){
|
||||
@ -160,6 +164,7 @@ bool UpdaterClass::end(bool evenIfRemaining){
|
||||
#ifdef DEBUG_UPDATER
|
||||
DEBUG_UPDATER.printf("MD5 Failed: expected:%s, calculated:%s\n", _target_md5.c_str(), _md5.toString().c_str());
|
||||
#endif
|
||||
_reset();
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG_UPDATER
|
||||
|
@ -65,7 +65,7 @@ class UpdaterClass {
|
||||
/*
|
||||
sets the expected MD5 for the firmware (hexString)
|
||||
*/
|
||||
void setMD5(const char * expected_md5);
|
||||
bool setMD5(const char * expected_md5);
|
||||
|
||||
/*
|
||||
returns the MD5 String of the sucessfully ended firmware
|
||||
|
Reference in New Issue
Block a user