diff --git a/src/ArduinoHttpClient.h b/src/ArduinoHttpClient.h index abb8494..a0884d6 100644 --- a/src/ArduinoHttpClient.h +++ b/src/ArduinoHttpClient.h @@ -5,6 +5,12 @@ #ifndef ArduinoHttpClient_h #define ArduinoHttpClient_h +#if defined(ESP_IDF_VERSION) +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) +#define HAS_ESP_IDF_5 +#endif +#endif + #include "HttpClient.h" #include "WebSocketClient.h" #include "URLEncoder.h" diff --git a/src/HttpClient.h b/src/HttpClient.h index 3d404af..eae9747 100644 --- a/src/HttpClient.h +++ b/src/HttpClient.h @@ -313,6 +313,10 @@ class HttpClient : public Client // Inherited from Client virtual int connect(IPAddress ip, uint16_t port) { return iClient->connect(ip, port); }; virtual int connect(const char *host, uint16_t port) { return iClient->connect(host, port); }; + #ifdef HAS_ESP_IDF_5 + virtual int connect(const char *host, uint16_t port, int32_t timeout){ return iClient->connect(host, port, timeout); }; + virtual int connect(IPAddress ip, uint16_t port, int32_t timeout){ return iClient->connect(ip, port, timeout); }; + #endif virtual void stop(); virtual uint8_t connected() { return iClient->connected(); }; virtual operator bool() { return bool(iClient); };