mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Allow manually setting MD5 checksum for HTTP update (#8204)
This commit is contained in:
parent
058ce7c08e
commit
d3f16b3177
@ -211,8 +211,14 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
|
|||||||
DEBUG_HTTP_UPDATE("[httpUpdate] - code: %d\n", code);
|
DEBUG_HTTP_UPDATE("[httpUpdate] - code: %d\n", code);
|
||||||
DEBUG_HTTP_UPDATE("[httpUpdate] - len: %d\n", len);
|
DEBUG_HTTP_UPDATE("[httpUpdate] - len: %d\n", len);
|
||||||
|
|
||||||
if(http.hasHeader("x-MD5")) {
|
String md5;
|
||||||
DEBUG_HTTP_UPDATE("[httpUpdate] - MD5: %s\n", http.header("x-MD5").c_str());
|
if (_md5Sum.length()) {
|
||||||
|
md5 = _md5Sum;
|
||||||
|
} else if(http.hasHeader("x-MD5")) {
|
||||||
|
md5 = http.header("x-MD5");
|
||||||
|
}
|
||||||
|
if(md5.length()) {
|
||||||
|
DEBUG_HTTP_UPDATE("[httpUpdate] - MD5: %s\n", md5.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_HTTP_UPDATE("[httpUpdate] ESP8266 info:\n");
|
DEBUG_HTTP_UPDATE("[httpUpdate] ESP8266 info:\n");
|
||||||
@ -298,7 +304,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(runUpdate(*tcp, len, http.header("x-MD5"), command)) {
|
if(runUpdate(*tcp, len, md5, command)) {
|
||||||
ret = HTTP_UPDATE_OK;
|
ret = HTTP_UPDATE_OK;
|
||||||
DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n");
|
DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n");
|
||||||
http.end();
|
http.end();
|
||||||
|
@ -108,6 +108,11 @@ public:
|
|||||||
_ledOn = ledOn;
|
_ledOn = ledOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMD5sum(const String &md5Sum)
|
||||||
|
{
|
||||||
|
_md5Sum = md5Sum;
|
||||||
|
}
|
||||||
|
|
||||||
void setAuthorization(const String& user, const String& password);
|
void setAuthorization(const String& user, const String& password);
|
||||||
void setAuthorization(const String& auth);
|
void setAuthorization(const String& auth);
|
||||||
|
|
||||||
@ -142,7 +147,7 @@ protected:
|
|||||||
String _user;
|
String _user;
|
||||||
String _password;
|
String _password;
|
||||||
String _auth;
|
String _auth;
|
||||||
|
String _md5Sum;
|
||||||
private:
|
private:
|
||||||
int _httpClientTimeout;
|
int _httpClientTimeout;
|
||||||
followRedirects_t _followRedirects = HTTPC_DISABLE_FOLLOW_REDIRECTS;
|
followRedirects_t _followRedirects = HTTPC_DISABLE_FOLLOW_REDIRECTS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user