1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Passing custom HTTPClient to HTTPUpdate (#8773)

This enables passing additional headers to HTTP query.
Based on ESP32 HTTPUpdate functionalities.
This commit is contained in:
BackLogers 2023-01-05 09:38:12 +01:00 committed by GitHub
parent 7cfb551f90
commit 3f394616a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -83,6 +83,16 @@ HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& hos
return handleUpdate(http, currentVersion, false); return handleUpdate(http, currentVersion, false);
} }
HTTPUpdateResult ESP8266HTTPUpdate::update(HTTPClient& httpClient, const String& currentVersion)
{
return handleUpdate(httpClient, currentVersion, false);
}
HTTPUpdateResult ESP8266HTTPUpdate::updateFS(HTTPClient& httpClient, const String& currentVersion)
{
return handleUpdate(httpClient, currentVersion, true);
}
/** /**
* return error code as int * return error code as int
* @return int error code * @return int error code

View File

@ -120,7 +120,9 @@ public:
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/", t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
const String& currentVersion = ""); const String& currentVersion = "");
t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = ""); t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = "");
t_httpUpdate_return update(HTTPClient& httpClient, const String& currentVersion = "");
t_httpUpdate_return updateFS(HTTPClient& httpClient, const String& currentVersion = "");
// Notification callbacks // Notification callbacks
void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; } void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; }
void onEnd(HTTPUpdateEndCB cbOnEnd) { _cbEnd = cbOnEnd; } void onEnd(HTTPUpdateEndCB cbOnEnd) { _cbEnd = cbOnEnd; }