Skip to content

Commit 32fad07

Browse files
authored
ESP266httpUpdate: remove dead API and fix doc (#8063)
1 parent d283541 commit 32fad07

File tree

3 files changed

+9
-167
lines changed

3 files changed

+9
-167
lines changed

doc/ota_updates/readme.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ Simple updater downloads the file every time the function is called.
530530

531531
.. code:: cpp
532532
533-
ESPhttpUpdate.update("192.168.0.2", 80, "/arduino.bin");
533+
WiFiClient client;
534+
ESPhttpUpdate.update(client, "192.168.0.2", 80, "/arduino.bin");
534535
535536
Advanced updater
536537
^^^^^^^^^^^^^^^^
@@ -541,7 +542,8 @@ The server-side script can respond as follows: - response code 200, and send the
541542

542543
.. code:: cpp
543544
544-
t_httpUpdate_return ret = ESPhttpUpdate.update("192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");
545+
WiFiClient client;
546+
t_httpUpdate_return ret = ESPhttpUpdate.update(client, "192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");
545547
switch(ret) {
546548
case HTTP_UPDATE_FAILED:
547549
Serial.println("[update] Update failed.");
@@ -554,6 +556,11 @@ The server-side script can respond as follows: - response code 200, and send the
554556
break;
555557
}
556558
559+
TLS updater
560+
^^^^^^^^^^^
561+
562+
Please read and try the examples provided with the library.
563+
557564
Server request handling
558565
~~~~~~~~~~~~~~~~~~~~~~~
559566

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

-126
Original file line numberDiff line numberDiff line change
@@ -63,146 +63,20 @@ void ESP8266HTTPUpdate::setAuthorization(const String &auth)
6363
_auth = auth;
6464
}
6565

66-
#if HTTPUPDATE_1_2_COMPATIBLE
67-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
68-
const String& httpsFingerprint, bool reboot)
69-
{
70-
rebootOnUpdate(reboot);
71-
#pragma GCC diagnostic push
72-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
73-
return update(url, currentVersion, httpsFingerprint);
74-
#pragma GCC diagnostic pop
75-
}
76-
77-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion)
78-
{
79-
HTTPClient http;
80-
#pragma GCC diagnostic push
81-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
82-
http.begin(url);
83-
#pragma GCC diagnostic pop
84-
return handleUpdate(http, currentVersion, false);
85-
}
86-
87-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
88-
const String& httpsFingerprint)
89-
{
90-
HTTPClient http;
91-
#pragma GCC diagnostic push
92-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
93-
http.begin(url, httpsFingerprint);
94-
#pragma GCC diagnostic pop
95-
return handleUpdate(http, currentVersion, false);
96-
}
97-
98-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
99-
const uint8_t httpsFingerprint[20])
100-
{
101-
HTTPClient http;
102-
#pragma GCC diagnostic push
103-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
104-
http.begin(url, httpsFingerprint);
105-
#pragma GCC diagnostic pop
106-
return handleUpdate(http, currentVersion, false);
107-
}
108-
#endif
109-
11066
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url, const String& currentVersion)
11167
{
11268
HTTPClient http;
11369
http.begin(client, url);
11470
return handleUpdate(http, currentVersion, false);
11571
}
11672

117-
#if HTTPUPDATE_1_2_COMPATIBLE
118-
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint)
119-
{
120-
HTTPClient http;
121-
#pragma GCC diagnostic push
122-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
123-
http.begin(url, httpsFingerprint);
124-
#pragma GCC diagnostic pop
125-
return handleUpdate(http, currentVersion, true);
126-
}
127-
128-
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const uint8_t httpsFingerprint[20])
129-
{
130-
HTTPClient http;
131-
#pragma GCC diagnostic push
132-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
133-
http.begin(url, httpsFingerprint);
134-
#pragma GCC diagnostic pop
135-
return handleUpdate(http, currentVersion, true);
136-
}
137-
138-
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion)
139-
{
140-
HTTPClient http;
141-
#pragma GCC diagnostic push
142-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
143-
http.begin(url);
144-
#pragma GCC diagnostic pop
145-
return handleUpdate(http, currentVersion, true);
146-
}
147-
#endif
148-
14973
HTTPUpdateResult ESP8266HTTPUpdate::updateFS(WiFiClient& client, const String& url, const String& currentVersion)
15074
{
15175
HTTPClient http;
15276
http.begin(client, url);
15377
return handleUpdate(http, currentVersion, true);
15478
}
15579

156-
#if HTTPUPDATE_1_2_COMPATIBLE
157-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
158-
bool https, const String& httpsFingerprint, bool reboot)
159-
{
160-
(void)https;
161-
rebootOnUpdate(reboot);
162-
if (httpsFingerprint.length() == 0) {
163-
#pragma GCC diagnostic push
164-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
165-
return update(host, port, uri, currentVersion);
166-
} else {
167-
return update(host, port, uri, currentVersion, httpsFingerprint);
168-
#pragma GCC diagnostic pop
169-
}
170-
}
171-
172-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri,
173-
const String& currentVersion)
174-
{
175-
HTTPClient http;
176-
#pragma GCC diagnostic push
177-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
178-
http.begin(host, port, uri);
179-
#pragma GCC diagnostic pop
180-
return handleUpdate(http, currentVersion, false);
181-
}
182-
183-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& url,
184-
const String& currentVersion, const String& httpsFingerprint)
185-
{
186-
HTTPClient http;
187-
#pragma GCC diagnostic push
188-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
189-
http.begin(host, port, url, httpsFingerprint);
190-
#pragma GCC diagnostic pop
191-
return handleUpdate(http, currentVersion, false);
192-
}
193-
194-
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& url,
195-
const String& currentVersion, const uint8_t httpsFingerprint[20])
196-
{
197-
HTTPClient http;
198-
#pragma GCC diagnostic push
199-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
200-
http.begin(host, port, url, httpsFingerprint);
201-
#pragma GCC diagnostic pop
202-
return handleUpdate(http, currentVersion, false);
203-
}
204-
#endif
205-
20680
HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
20781
const String& currentVersion)
20882
{

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

-39
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
#include <WiFiUdp.h>
3333
#include <ESP8266HTTPClient.h>
3434

35-
#ifndef HTTPUPDATE_1_2_COMPATIBLE
36-
#define HTTPUPDATE_1_2_COMPATIBLE HTTPCLIENT_1_1_COMPATIBLE
37-
#endif
38-
3935
#ifdef DEBUG_ESP_HTTP_UPDATE
4036
#ifdef DEBUG_ESP_PORT
4137
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
@@ -115,45 +111,10 @@ class ESP8266HTTPUpdate
115111
void setAuthorization(const String& user, const String& password);
116112
void setAuthorization(const String& auth);
117113

118-
#if HTTPUPDATE_1_2_COMPATIBLE
119-
// This function is deprecated, use rebootOnUpdate and the next one instead
120-
t_httpUpdate_return update(const String& url, const String& currentVersion,
121-
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
122-
t_httpUpdate_return update(const String& url, const String& currentVersion = "") __attribute__((deprecated));
123-
t_httpUpdate_return update(const String& url, const String& currentVersion,
124-
const String& httpsFingerprint) __attribute__((deprecated));
125-
t_httpUpdate_return update(const String& url, const String& currentVersion,
126-
const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
127-
#endif
128114
t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "");
129-
130-
#if HTTPUPDATE_1_2_COMPATIBLE
131-
// This function is deprecated, use one of the overloads below along with rebootOnUpdate
132-
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
133-
bool https, const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
134-
135-
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri = "/",
136-
const String& currentVersion = "") __attribute__((deprecated));
137-
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,
138-
const String& currentVersion, const String& httpsFingerprint) __attribute__((deprecated));
139-
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,
140-
const String& currentVersion, const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
141-
#endif
142115
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
143116
const String& currentVersion = "");
144-
145-
#if HTTPUPDATE_1_2_COMPATIBLE
146-
// This function is deprecated, use rebootOnUpdate and the next one instead
147-
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion,
148-
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
149-
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion = "") __attribute__((deprecated));
150-
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint) __attribute__((deprecated));
151-
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const uint8_t httpsFingerprint[20]) __attribute__((deprecated)); // BearSSL
152-
#endif
153117
t_httpUpdate_return updateFS(WiFiClient& client, const String& url, const String& currentVersion = "");
154-
t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "") __attribute__((deprecated)) {
155-
return updateFS(client, url, currentVersion);
156-
};
157118

158119
// Notification callbacks
159120
void onStart(HTTPUpdateStartCB cbOnStart) { _cbStart = cbOnStart; }

0 commit comments

Comments
 (0)