Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc8ca56

Browse files
committedJul 30, 2024·
Feat(HTTPUpdate): Add optional httpclient to main update function
1 parent f5be003 commit fc8ca56

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎libraries/HTTPUpdate/src/HTTPUpdate.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ HTTPUpdateResult HTTPUpdate::update(NetworkClient &client, const String &url, co
5454
}
5555
return handleUpdate(http, currentVersion, false, requestCB);
5656
}
57+
HTTPUpdateResult HTTPUpdate::update(NetworkClient &client,HTTPClient &httpclient, const String &url, const String &currentVersion, HTTPUpdateRequestCB requestCB){
58+
if (!httpclient.begin(client, url)) {
59+
return HTTP_UPDATE_FAILED;
60+
}
61+
return handleUpdate(httpclient, currentVersion, false, requestCB);
62+
}
5763

5864
HTTPUpdateResult HTTPUpdate::updateSpiffs(HTTPClient &httpClient, const String &currentVersion, HTTPUpdateRequestCB requestCB) {
5965
return handleUpdate(httpClient, currentVersion, true, requestCB);

‎libraries/HTTPUpdate/src/HTTPUpdate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ class HTTPUpdate {
9393
}
9494

9595
t_httpUpdate_return update(NetworkClient &client, const String &url, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
96+
97+
t_httpUpdate_return update(
98+
NetworkClient &client,HTTPClient &httpclient, const String &url, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL
99+
);
96100

97101
t_httpUpdate_return update(
98102
NetworkClient &client, const String &host, uint16_t port, const String &uri = "/", const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL

0 commit comments

Comments
 (0)
Please sign in to comment.