Skip to content

Commit f1c5613

Browse files
BackLogershasenradball
authored andcommittedNov 18, 2024
Passing custom HTTPClient to HTTPUpdate (esp8266#8773)
This enables passing additional headers to HTTP query. Based on ESP32 HTTPUpdate functionalities.
1 parent 8dd33f0 commit f1c5613

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& hos
8383
return handleUpdate(http, currentVersion, false);
8484
}
8585

86+
HTTPUpdateResult ESP8266HTTPUpdate::update(HTTPClient& httpClient, const String& currentVersion)
87+
{
88+
return handleUpdate(httpClient, currentVersion, false);
89+
}
90+
91+
HTTPUpdateResult ESP8266HTTPUpdate::updateFS(HTTPClient& httpClient, const String& currentVersion)
92+
{
93+
return handleUpdate(httpClient, currentVersion, true);
94+
}
95+
8696
/**
8797
* return error code as int
8898
* @return int error code

‎libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class ESP8266HTTPUpdate
120120
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
121121
const String& currentVersion = "");
122122
t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = "");
123-
123+
t_httpUpdate_return update(HTTPClient& httpClient, const String& currentVersion = "");
124+
t_httpUpdate_return updateFS(HTTPClient& httpClient, const String& currentVersion = "");
125+
124126
// Notification callbacks
125127
void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; }
126128
void onEnd(HTTPUpdateEndCB cbOnEnd) { _cbEnd = cbOnEnd; }

0 commit comments

Comments
 (0)