mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
ESP8266httpUpdate: add method overload to allow updates using WiFiClientSecure
This commit is contained in:
parent
e9f0ea2afe
commit
a2789df2a5
@ -34,17 +34,19 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version) {
|
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version) {
|
||||||
|
|
||||||
t_httpUpdate_return ret = HTTP_UPDATE_FAILED;
|
|
||||||
WiFiClient tcp;
|
WiFiClient tcp;
|
||||||
DEBUG_HTTP_UPDATE("[httpUpdate] connected to %s:%u %s .... ", host, port, url);
|
DEBUG_HTTP_UPDATE("[httpUpdate] connected to %s:%u %s .... ", host, port, url);
|
||||||
|
|
||||||
if(!tcp.connect(host, port)) {
|
if(!tcp.connect(host, port)) {
|
||||||
DEBUG_HTTP_UPDATE("failed.\n");
|
DEBUG_HTTP_UPDATE("failed.\n");
|
||||||
return ret;
|
return HTTP_UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
DEBUG_HTTP_UPDATE("ok.\n");
|
DEBUG_HTTP_UPDATE("ok.\n");
|
||||||
|
return update(tcp, host, url, current_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_httpUpdate_return ESP8266HTTPUpdate::update(WiFiClient& tcp, const char* host, const char* url, const char * current_version) {
|
||||||
|
t_httpUpdate_return ret = HTTP_UPDATE_FAILED;
|
||||||
// set Timeout for readBytesUntil and readStringUntil
|
// set Timeout for readBytesUntil and readStringUntil
|
||||||
tcp.setTimeout(2000);
|
tcp.setTimeout(2000);
|
||||||
tcp.setNoDelay(true);
|
tcp.setNoDelay(true);
|
||||||
|
@ -50,6 +50,7 @@ class ESP8266HTTPUpdate {
|
|||||||
|
|
||||||
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "");
|
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "");
|
||||||
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "");
|
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "");
|
||||||
|
t_httpUpdate_return update(WiFiClient& client, const char* host, const char* url = "/", const char * current_version = "");
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ESP8266HTTPUpdate ESPhttpUpdate;
|
extern ESP8266HTTPUpdate ESPhttpUpdate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user