Skip to content

Commit a2789df

Browse files
committed
ESP8266httpUpdate: add method overload to allow updates using WiFiClientSecure
1 parent e9f0ea2 commit a2789df

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void) {
3434
}
3535

3636
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version) {
37-
38-
t_httpUpdate_return ret = HTTP_UPDATE_FAILED;
3937
WiFiClient tcp;
4038
DEBUG_HTTP_UPDATE("[httpUpdate] connected to %s:%u %s .... ", host, port, url);
4139

4240
if(!tcp.connect(host, port)) {
4341
DEBUG_HTTP_UPDATE("failed.\n");
44-
return ret;
42+
return HTTP_UPDATE_FAILED;
4543
}
4644
DEBUG_HTTP_UPDATE("ok.\n");
45+
return update(tcp, host, url, current_version);
46+
}
4747

48+
t_httpUpdate_return ESP8266HTTPUpdate::update(WiFiClient& tcp, const char* host, const char* url, const char * current_version) {
49+
t_httpUpdate_return ret = HTTP_UPDATE_FAILED;
4850
// set Timeout for readBytesUntil and readStringUntil
4951
tcp.setTimeout(2000);
5052
tcp.setNoDelay(true);

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class ESP8266HTTPUpdate {
5050

5151
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "");
5252
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "");
53+
t_httpUpdate_return update(WiFiClient& client, const char* host, const char* url = "/", const char * current_version = "");
5354
};
5455

5556
extern ESP8266HTTPUpdate ESPhttpUpdate;

0 commit comments

Comments
 (0)