Skip to content

Commit 3f39461

Browse files
authored
Passing custom HTTPClient to HTTPUpdate (#8773)
This enables passing additional headers to HTTP query. Based on ESP32 HTTPUpdate functionalities.
1 parent 7cfb551 commit 3f39461

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

Lines changed: 10 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy