mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
ESP266httpUpdate: remove dead API and fix doc (#8063)
This commit is contained in:
parent
d283541380
commit
32fad07a70
@ -530,7 +530,8 @@ Simple updater downloads the file every time the function is called.
|
|||||||
|
|
||||||
.. code:: cpp
|
.. code:: cpp
|
||||||
|
|
||||||
ESPhttpUpdate.update("192.168.0.2", 80, "/arduino.bin");
|
WiFiClient client;
|
||||||
|
ESPhttpUpdate.update(client, "192.168.0.2", 80, "/arduino.bin");
|
||||||
|
|
||||||
Advanced updater
|
Advanced updater
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
@ -541,7 +542,8 @@ The server-side script can respond as follows: - response code 200, and send the
|
|||||||
|
|
||||||
.. code:: cpp
|
.. code:: cpp
|
||||||
|
|
||||||
t_httpUpdate_return ret = ESPhttpUpdate.update("192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");
|
WiFiClient client;
|
||||||
|
t_httpUpdate_return ret = ESPhttpUpdate.update(client, "192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
case HTTP_UPDATE_FAILED:
|
case HTTP_UPDATE_FAILED:
|
||||||
Serial.println("[update] Update failed.");
|
Serial.println("[update] Update failed.");
|
||||||
@ -554,6 +556,11 @@ The server-side script can respond as follows: - response code 200, and send the
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TLS updater
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
Please read and try the examples provided with the library.
|
||||||
|
|
||||||
Server request handling
|
Server request handling
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -63,50 +63,6 @@ void ESP8266HTTPUpdate::setAuthorization(const String &auth)
|
|||||||
_auth = auth;
|
_auth = auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
|
|
||||||
const String& httpsFingerprint, bool reboot)
|
|
||||||
{
|
|
||||||
rebootOnUpdate(reboot);
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
return update(url, currentVersion, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
|
|
||||||
const String& httpsFingerprint)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
|
|
||||||
const uint8_t httpsFingerprint[20])
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url, const String& currentVersion)
|
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url, const String& currentVersion)
|
||||||
{
|
{
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
@ -114,38 +70,6 @@ HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url
|
|||||||
return handleUpdate(http, currentVersion, false);
|
return handleUpdate(http, currentVersion, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const uint8_t httpsFingerprint[20])
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(url);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::updateFS(WiFiClient& client, const String& url, const String& currentVersion)
|
HTTPUpdateResult ESP8266HTTPUpdate::updateFS(WiFiClient& client, const String& url, const String& currentVersion)
|
||||||
{
|
{
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
@ -153,56 +77,6 @@ HTTPUpdateResult ESP8266HTTPUpdate::updateFS(WiFiClient& client, const String& u
|
|||||||
return handleUpdate(http, currentVersion, true);
|
return handleUpdate(http, currentVersion, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
|
|
||||||
bool https, const String& httpsFingerprint, bool reboot)
|
|
||||||
{
|
|
||||||
(void)https;
|
|
||||||
rebootOnUpdate(reboot);
|
|
||||||
if (httpsFingerprint.length() == 0) {
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
return update(host, port, uri, currentVersion);
|
|
||||||
} else {
|
|
||||||
return update(host, port, uri, currentVersion, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri,
|
|
||||||
const String& currentVersion)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(host, port, uri);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& url,
|
|
||||||
const String& currentVersion, const String& httpsFingerprint)
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(host, port, url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& url,
|
|
||||||
const String& currentVersion, const uint8_t httpsFingerprint[20])
|
|
||||||
{
|
|
||||||
HTTPClient http;
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
http.begin(host, port, url, httpsFingerprint);
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return handleUpdate(http, currentVersion, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
|
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
|
||||||
const String& currentVersion)
|
const String& currentVersion)
|
||||||
{
|
{
|
||||||
|
@ -32,10 +32,6 @@
|
|||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
|
|
||||||
#ifndef HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
#define HTTPUPDATE_1_2_COMPATIBLE HTTPCLIENT_1_1_COMPATIBLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_ESP_HTTP_UPDATE
|
#ifdef DEBUG_ESP_HTTP_UPDATE
|
||||||
#ifdef DEBUG_ESP_PORT
|
#ifdef DEBUG_ESP_PORT
|
||||||
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
|
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
|
||||||
@ -115,45 +111,10 @@ public:
|
|||||||
void setAuthorization(const String& user, const String& password);
|
void setAuthorization(const String& user, const String& password);
|
||||||
void setAuthorization(const String& auth);
|
void setAuthorization(const String& auth);
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
// This function is deprecated, use rebootOnUpdate and the next one instead
|
|
||||||
t_httpUpdate_return update(const String& url, const String& currentVersion,
|
|
||||||
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return update(const String& url, const String& currentVersion = "") __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return update(const String& url, const String& currentVersion,
|
|
||||||
const String& httpsFingerprint) __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return update(const String& url, const String& currentVersion,
|
|
||||||
const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
|
|
||||||
#endif
|
|
||||||
t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "");
|
t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "");
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
// This function is deprecated, use one of the overloads below along with rebootOnUpdate
|
|
||||||
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
|
|
||||||
bool https, const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
|
|
||||||
|
|
||||||
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri = "/",
|
|
||||||
const String& currentVersion = "") __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,
|
|
||||||
const String& currentVersion, const String& httpsFingerprint) __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,
|
|
||||||
const String& currentVersion, const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
|
|
||||||
#endif
|
|
||||||
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
|
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
|
||||||
const String& currentVersion = "");
|
const String& currentVersion = "");
|
||||||
|
|
||||||
#if HTTPUPDATE_1_2_COMPATIBLE
|
|
||||||
// This function is deprecated, use rebootOnUpdate and the next one instead
|
|
||||||
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion,
|
|
||||||
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion = "") __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint) __attribute__((deprecated));
|
|
||||||
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
|
|
||||||
#endif
|
|
||||||
t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = "");
|
t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = "");
|
||||||
t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "") __attribute__((deprecated)) {
|
|
||||||
return updateFS(client, url, currentVersion);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Notification callbacks
|
// Notification callbacks
|
||||||
void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; }
|
void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user