1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Fix build with -DHTTPCLIENT_1_1_COMPATIBLE=0 (#6597)

We need to disable HTTPUPDATE_1_2 support when HTTPCLIENT_1_1
compatibility is not desired to avoid using methods that are
disabled.
This commit is contained in:
Dirk Mueller 2019-10-08 01:57:18 +02:00 committed by Earle F. Philhower, III
parent fabd169abc
commit 8b16d9c1d1
2 changed files with 10 additions and 8 deletions

View File

@ -43,7 +43,7 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void)
{ {
} }
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion, HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
const String& httpsFingerprint, bool reboot) const String& httpsFingerprint, bool reboot)
{ {
@ -94,7 +94,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url
return handleUpdate(http, currentVersion, false); return handleUpdate(http, currentVersion, false);
} }
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint) HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint)
{ {
HTTPClient http; HTTPClient http;
@ -133,7 +133,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(WiFiClient& client, const Strin
return handleUpdate(http, currentVersion, true); return handleUpdate(http, currentVersion, true);
} }
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri, const String& currentVersion, HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
bool https, const String& httpsFingerprint, bool reboot) bool https, const String& httpsFingerprint, bool reboot)
{ {

View File

@ -26,14 +26,16 @@
#ifndef ESP8266HTTPUPDATE_H_ #ifndef ESP8266HTTPUPDATE_H_
#define ESP8266HTTPUPDATE_H_ #define ESP8266HTTPUPDATE_H_
#define HTTPUPDATE_1_2_COMPATIBLE
#include <Arduino.h> #include <Arduino.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <WiFiClient.h> #include <WiFiClient.h>
#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__ )
@ -85,7 +87,7 @@ public:
_ledOn = ledOn; _ledOn = ledOn;
} }
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
// This function is deprecated, use rebootOnUpdate and the next one instead // This function is deprecated, use rebootOnUpdate and the next one instead
t_httpUpdate_return update(const String& url, const String& currentVersion, t_httpUpdate_return update(const String& url, const String& currentVersion,
const String& httpsFingerprint, bool reboot) __attribute__((deprecated)); const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
@ -97,7 +99,7 @@ public:
#endif #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 = "");
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
// This function is deprecated, use one of the overloads below along with rebootOnUpdate // 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, 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)); bool https, const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
@ -112,7 +114,7 @@ public:
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 = "");
#ifdef HTTPUPDATE_1_2_COMPATIBLE #if HTTPUPDATE_1_2_COMPATIBLE
// This function is deprecated, use rebootOnUpdate and the next one instead // This function is deprecated, use rebootOnUpdate and the next one instead
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion,
const String& httpsFingerprint, bool reboot) __attribute__((deprecated)); const String& httpsFingerprint, bool reboot) __attribute__((deprecated));