Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v2.2.0 to fix crash and memory leak
Browse files Browse the repository at this point in the history
### Releases v2.2.0

1. Fix crash when turn-on debug or start
2. Fix memory leak. Check [Having problemen with AsyncHTTPS memory leak #11](#11) and [Update for memleak in AsyncHTTPSRequest_Impl_Generic.h #13](#13)
  • Loading branch information
khoih-prog authored Oct 20, 2022
1 parent add5847 commit 90104d2
Show file tree
Hide file tree
Showing 13 changed files with 304 additions and 319 deletions.
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v2.2.0](#releases-v220)
* [Releases v2.1.3](#releases-v213)
* [Releases v2.1.2](#releases-v212)
* [Releases v2.1.1](#releases-v211)
Expand All @@ -31,11 +32,15 @@

## Changelog

### Releases v2.2.0

1. Fix crash when turn-on debug or start
2. Fix memory leak. Check [Having problemen with AsyncHTTPS memory leak #11](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/issues/11) and [Update for memleak in AsyncHTTPSRequest_Impl_Generic.h #13](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/pull/13)

### Releases v2.1.3

1. Not try to reconnect to the same host:port after connected. Check [setReuse feature #12](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/issues/12)


### Releases v2.1.2

1. Fix bug
Expand Down
8 changes: 4 additions & 4 deletions examples/AsyncHTTPSRequest_ESP/AsyncHTTPSRequest_ESP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.1.3"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2001003
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.2.0"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2002000

// Level from 0-4
#define ASYNC_HTTPS_DEBUG_PORT Serial
Expand Down Expand Up @@ -137,8 +137,8 @@ void requestCB(void *optParm, AsyncHTTPSRequest *request, int readyState)

if (readyState == readyStateDone)
{
AHTTPS_LOGWARN0(F("\n**************************************\n"));
AHTTPS_LOGWARN1(F("Response Code = "), request->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());

if (request->responseHTTPcode() == 200)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.1.3"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2001003
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.2.0"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2002000

// Level from 0-4
#define ASYNC_HTTPS_DEBUG_PORT Serial
Expand Down Expand Up @@ -181,8 +181,8 @@ void requestCB0(void *optParm, AsyncHTTPSRequest *thisRequest, int readyState)

if (readyState == readyStateDone)
{
AHTTPS_LOGWARN0(F("\n**************************************\n"));
AHTTPS_LOGWARN1(F("Response Code = "), thisRequest->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), thisRequest->responseHTTPString());

if (thisRequest->responseHTTPcode() == 200)
{
Expand All @@ -202,8 +202,8 @@ void requestCB1(void *optParm, AsyncHTTPSRequest *thisRequest, int readyState)

if (readyState == readyStateDone)
{
AHTTPS_LOGWARN0(F("\n**************************************\n"));
AHTTPS_LOGWARN1(F("Response Code = "), thisRequest->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), thisRequest->responseHTTPString());

if (thisRequest->responseHTTPcode() == 200)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.1.3"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2001003
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.2.0"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2002000

/////////////////////////////////////////////////////////

Expand Down
22 changes: 11 additions & 11 deletions examples/AsyncHTTP_HTTPSRequest_ESP/AsyncHTTP_HTTPSRequest_ESP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.1.3"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2001003
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.2.0"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2002000

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009001
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002

// Level from 0-4
#define ASYNC_HTTPS_DEBUG_PORT Serial

#define _ASYNC_TCP_SSL_LOGLEVEL_ 1
#define _ASYNC_HTTPS_LOGLEVEL_ 2
#define _ASYNC_HTTPS_LOGLEVEL_ 1

// 300s = 5 minutes to not flooding
#define HTTPS_REQUEST_INTERVAL 120
Expand Down Expand Up @@ -245,8 +245,8 @@ void requestCB0(void *optParm, AsyncHTTPSRequest *thisRequest, int readyState)

if (readyState == readyStateDone)
{
AHTTPS_LOGWARN0(F("\n**************************************\n"));
AHTTPS_LOGWARN1(F("Response Code = "), thisRequest->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), thisRequest->responseHTTPString());

if (thisRequest->responseHTTPcode() == 200)
{
Expand All @@ -267,8 +267,8 @@ void requestCB1(void *optParm, AsyncHTTPRequest *thisRequest, int readyState)

if (readyState == readyStateDone)
{
AHTTP_LOGWARN0(F("\n**************************************\n"));
AHTTP_LOGWARN1(F("Response Code = "), thisRequest->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), thisRequest->responseHTTPString());

if (thisRequest->responseHTTPcode() == 200)
{
Expand All @@ -289,8 +289,8 @@ void requestCB2(void *optParm, AsyncHTTPRequest *thisRequest, int readyState)

if (readyState == readyStateDone)
{
AHTTP_LOGWARN0(F("\n**************************************\n"));
AHTTP_LOGWARN1(F("Response Code = "), thisRequest->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), thisRequest->responseHTTPString());

if (thisRequest->responseHTTPcode() == 200)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
#endif

#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.1.3"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2001003
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPSRequest_Generic v2.2.0"
#define ASYNC_HTTPS_REQUEST_GENERIC_VERSION_MIN 2002000

/////////////////////////////////////////////////////////

// Use larger queue size if necessary for large data transfer. Default is 512 bytes if not defined here
Expand Down Expand Up @@ -146,8 +147,8 @@ void requestCB(void *optParm, AsyncHTTPSRequest *request, int readyState)

if (readyState == readyStateDone)
{
AHTTPS_LOGWARN0(F("\n**************************************\n"));
AHTTPS_LOGWARN1(F("Response Code = "), request->responseHTTPString());
AHTTPS_LOGDEBUG0(F("\n**************************************\n"));
AHTTPS_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());

if (request->responseHTTPcode() == 200)
{
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"AsyncHTTPSRequest_Generic",
"version": "2.1.3",
"version": "2.2.0",
"description":"Simple Async HTTPS Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_SSL library for ESP32 (including ESP32_S2, ESP32_S3 and ESP32_C3), WT32_ETH01 (ESP32 + LAN8720). Supporting in the future for RP2040W, ESP8266, Portenta_H7, STM32 with built-in LAN8742A Ethernet, etc. Now you can send HTTP / HTTPS requests to multiple addresses and receive responses from them.",
"keywords":"communication, async, tcp, https, ssl, tls, ESP8266, ESP32, ESP32-S2, wt32-eth01, ESPAsyncTCP, AsyncTCP, stm32, ethernet, wifi, lan8742a, lan8720, f407ve, nucleo-144, stm32f7",
"authors": [
Expand Down Expand Up @@ -45,7 +45,7 @@
{
"owner": "khoih-prog",
"name": "AsyncHTTPRequest_Generic",
"version": ">=1.9.1",
"version": ">=1.9.2",
"platforms": ["espressif8266", "espressif32"]
},
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=AsyncHTTPSRequest_Generic
version=2.1.3
version=2.2.0
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=GPLv3
Expand Down
4 changes: 2 additions & 2 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ lib_ldf_mode = chain+
lib_deps =
; PlatformIO 4.x
; AsyncTCP_SSL@>=1.3.1
; AsyncHTTPRequest_Generic@>=1.9.1
; AsyncHTTPRequest_Generic@>=1.9.2
; WebServer_WT32_ETH01@>=1.5.1
; ESPAsync_WiFiManager@>=1.15.0
; PlatformIO 5.x
khoih-prog/AsyncTCP_SSL@>=1.3.1
khoih-prog/AsyncHTTPRequest_Generic@>=1.9.1
khoih-prog/AsyncHTTPRequest_Generic@>=1.9.2
khoih-prog/WebServer_WT32_ETH01@>=1.5.1
khoih-prog/ESPAsync_WiFiManager@>=1.15.0

Expand Down
12 changes: 6 additions & 6 deletions src/AsyncHTTPSRequest_Debug_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#define _ASYNC_HTTPS_LOGLEVEL_ 0
#endif

/////////////////////////////////////////////////////////
////////////////////////////////////////

const char AHTTPS_MARK[] = "[AHTTPS] ";

Expand All @@ -68,39 +68,39 @@ const char AHTTPS_MARK[] = "[AHTTPS] ";
#define AHTTPS_PRINT AHTTPS_DBG_PORT.print
#define AHTTPS_PRINTLN AHTTPS_DBG_PORT.println

/////////////////////////////////////////////////////////
////////////////////////////////////////

#define AHTTPS_LOGERROR(x) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); }
#define AHTTPS_LOGERROR0(x) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT(x); }
#define AHTTPS_LOGERROR1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); }
#define AHTTPS_LOGERROR2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); }
#define AHTTPS_LOGERROR3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>0) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); }

/////////////////////////////////////////////////////////
////////////////////////////////////////

#define AHTTPS_LOGWARN(x) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); }
#define AHTTPS_LOGWARN0(x) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT(x); }
#define AHTTPS_LOGWARN1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); }
#define AHTTPS_LOGWARN2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); }
#define AHTTPS_LOGWARN3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>1) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); }

/////////////////////////////////////////////////////////
////////////////////////////////////////

#define AHTTPS_LOGINFO(x) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); }
#define AHTTPS_LOGINFO0(x) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT(x); }
#define AHTTPS_LOGINFO1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); }
#define AHTTPS_LOGINFO2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); }
#define AHTTPS_LOGINFO3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>2) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); }

/////////////////////////////////////////////////////////
////////////////////////////////////////

#define AHTTPS_LOGDEBUG(x) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINTLN(x); }
#define AHTTPS_LOGDEBUG0(x) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT(x); }
#define AHTTPS_LOGDEBUG1(x,y) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(y); }
#define AHTTPS_LOGDEBUG2(x,y,z) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(z); }
#define AHTTPS_LOGDEBUG3(x,y,z,w) if(_ASYNC_HTTPS_LOGLEVEL_>3) { AHTTPS_PRINT_MARK; AHTTPS_PRINT(x); AHTTPS_PRINT_SP; AHTTPS_PRINT(y); AHTTPS_PRINT_SP; AHTTPS_PRINT(z); AHTTPS_PRINT_SP; AHTTPS_PRINTLN(w); }

/////////////////////////////////////////////////////////
////////////////////////////////////////

#endif // ASYNC_HTTPS_REQUEST_DEBUG_GENERIC_H

3 changes: 2 additions & 1 deletion src/AsyncHTTPSRequest_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License along with this program.
If not, see <https://www.gnu.org/licenses/>.
Version: 2.1.3
Version: 2.2.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -34,6 +34,7 @@
2.1.1 K Hoang 09/09/2022 Fix ESP32 chipID for example `AsyncHTTPSRequest_ESP_WiFiManager`
2.1.2 K Hoang 18/09/2022 Fix bug and compiler error in some cases
2.1.3 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
2.2.0 K Hoang 20/10/2022 Fix crash and memory leak
*****************************************************************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit 90104d2

Please sign in to comment.