mirror of
https://github.com/khoih-prog/AsyncHTTPRequest_Generic.git
synced 2025-07-30 02:17:14 +02:00
v1.4.0 to fix crashing bug
### Releases v1.4.0 1. Fix crashing bug when request a non-existing IP. Check [Http GET polling causes crash when host disconnected #22](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/22) 2. Modify `platform.ini` to avoid compile error with PIO when using ESP8266/ESP32
This commit is contained in:
@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
|
|||||||
Please ensure to specify the following:
|
Please ensure to specify the following:
|
||||||
|
|
||||||
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
|
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
|
||||||
* `ESP8266`,`ESP32` or `STM32` Core Version (e.g. ESP8266 core v3.0.2, ESP32 v2.0.0 or STM32 v2.1.0)
|
* `ESP8266`,`ESP32` or `STM32` Core Version (e.g. ESP8266 core v3.0.2, ESP32 v2.0.1 or STM32 v2.1.0)
|
||||||
* Contextual information (e.g. what you were trying to achieve)
|
* Contextual information (e.g. what you were trying to achieve)
|
||||||
* Simplest possible steps to reproduce
|
* Simplest possible steps to reproduce
|
||||||
* Anything that might be relevant in your opinion, such as:
|
* Anything that might be relevant in your opinion, such as:
|
||||||
@ -27,9 +27,9 @@ Please ensure to specify the following:
|
|||||||
|
|
||||||
```
|
```
|
||||||
Arduino IDE version: 1.8.16
|
Arduino IDE version: 1.8.16
|
||||||
ESP32 Core Version 2.0.0
|
ESP32 Core Version 2.0.1
|
||||||
OS: Ubuntu 20.04 LTS
|
OS: Ubuntu 20.04 LTS
|
||||||
Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
Linux xy-Inspiron-3593 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||||
|
|
||||||
Context:
|
Context:
|
||||||
I encountered an endless loop while trying to connect to Local WiFi.
|
I encountered an endless loop while trying to connect to Local WiFi.
|
||||||
|
23
README.md
23
README.md
@ -649,7 +649,7 @@ IPAddress ip(192, 168, 2, 232);
|
|||||||
|
|
||||||
```
|
```
|
||||||
Start AsyncHTTPRequest_STM32 on NUCLEO_F767ZI
|
Start AsyncHTTPRequest_STM32 on NUCLEO_F767ZI
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
AsyncHTTPRequest @ IP : 192.168.2.72
|
AsyncHTTPRequest @ IP : 192.168.2.72
|
||||||
|
|
||||||
**************************************
|
**************************************
|
||||||
@ -694,7 +694,7 @@ week_number: 37
|
|||||||
|
|
||||||
```
|
```
|
||||||
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP8266_NODEMCU
|
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP8266_NODEMCU
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
Stored: SSID = HueNet1, Pass = 12345678
|
Stored: SSID = HueNet1, Pass = 12345678
|
||||||
Got stored Credentials. Timeout 120s
|
Got stored Credentials. Timeout 120s
|
||||||
ConnectMultiWiFi in setup
|
ConnectMultiWiFi in setup
|
||||||
@ -727,7 +727,7 @@ HHHHHH
|
|||||||
|
|
||||||
```
|
```
|
||||||
Starting AsyncHTTPRequest_ESP_WiFiManager using SPIFFS on ESP32_DEV
|
Starting AsyncHTTPRequest_ESP_WiFiManager using SPIFFS on ESP32_DEV
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
Stored: SSID = HueNet1, Pass = 12345678
|
Stored: SSID = HueNet1, Pass = 12345678
|
||||||
Got stored Credentials. Timeout 120s
|
Got stored Credentials. Timeout 120s
|
||||||
ConnectMultiWiFi in setup
|
ConnectMultiWiFi in setup
|
||||||
@ -778,7 +778,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH
|
|||||||
|
|
||||||
```
|
```
|
||||||
Starting AsyncHTTPRequest_ESP using ESP8266_NODEMCU
|
Starting AsyncHTTPRequest_ESP using ESP8266_NODEMCU
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
Connecting to WiFi SSID: HueNet1
|
Connecting to WiFi SSID: HueNet1
|
||||||
...........
|
...........
|
||||||
HTTP WebServer is @ IP : 192.168.2.81
|
HTTP WebServer is @ IP : 192.168.2.81
|
||||||
@ -810,7 +810,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH H
|
|||||||
|
|
||||||
```
|
```
|
||||||
Start AsyncWebClientRepeating_STM32 on NUCLEO_F767ZI
|
Start AsyncWebClientRepeating_STM32 on NUCLEO_F767ZI
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
AsyncHTTPRequest @ IP : 192.168.2.72
|
AsyncHTTPRequest @ IP : 192.168.2.72
|
||||||
|
|
||||||
**************************************
|
**************************************
|
||||||
@ -865,7 +865,7 @@ AsyncHTTPRequest @ IP : 192.168.2.72
|
|||||||
|
|
||||||
```
|
```
|
||||||
Start AsyncWebClientRepeating_STM32_LAN8720 on BLACK_F407VE
|
Start AsyncWebClientRepeating_STM32_LAN8720 on BLACK_F407VE
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
AsyncHTTPRequest @ IP : 192.168.2.150
|
AsyncHTTPRequest @ IP : 192.168.2.150
|
||||||
|
|
||||||
|
|
||||||
@ -920,8 +920,8 @@ AsyncHTTPRequest @ IP : 192.168.2.150
|
|||||||
|
|
||||||
```
|
```
|
||||||
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
|
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
|
||||||
WebServer_WT32_ETH01 v1.2.1
|
WebServer_WT32_ETH01 v1.3.0
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
|
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
|
||||||
AsyncHTTPRequest @ IP : 192.168.2.232
|
AsyncHTTPRequest @ IP : 192.168.2.232
|
||||||
|
|
||||||
@ -946,8 +946,8 @@ H
|
|||||||
|
|
||||||
```
|
```
|
||||||
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
|
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
|
||||||
WebServer_WT32_ETH01 v1.2.1
|
WebServer_WT32_ETH01 v1.3.0
|
||||||
AsyncHTTPRequest_Generic v1.3.1
|
AsyncHTTPRequest_Generic v1.4.0
|
||||||
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
|
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
|
||||||
AsyncHTTPRequest @ IP : 192.168.2.232
|
AsyncHTTPRequest @ IP : 192.168.2.232
|
||||||
|
|
||||||
@ -1037,6 +1037,8 @@ This library is based on, modified, bug-fixed and improved from:
|
|||||||
|
|
||||||
5. Thanks to [spdi](https://github.com/spdi) to report [**'Connection' header expects 'disconnect' instead 'close' ? #13**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/13) leading to new release v1.1.3 to fix bug.
|
5. Thanks to [spdi](https://github.com/spdi) to report [**'Connection' header expects 'disconnect' instead 'close' ? #13**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/13) leading to new release v1.1.3 to fix bug.
|
||||||
|
|
||||||
|
6. Thanks to [andrewk123](https://github.com/andrewk123) to report [**Http GET polling causes crash when host disconnected #22**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/22) leading to new release v1.4.0 to fix bug.
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -1045,6 +1047,7 @@ This library is based on, modified, bug-fixed and improved from:
|
|||||||
<td align="center"><a href="https://github.com/gleniat"><img src="https://github.com/gleniat.png" width="100px;" alt="gleniat"/><br /><sub><b>gleniat</b></sub></a><br /></td>
|
<td align="center"><a href="https://github.com/gleniat"><img src="https://github.com/gleniat.png" width="100px;" alt="gleniat"/><br /><sub><b>gleniat</b></sub></a><br /></td>
|
||||||
<td align="center"><a href="https://github.com/baddwarf"><img src="https://github.com/baddwarf.png" width="100px;" alt="baddwarf"/><br /><sub><b>BadDwarf</b></sub></a><br /></td>
|
<td align="center"><a href="https://github.com/baddwarf"><img src="https://github.com/baddwarf.png" width="100px;" alt="baddwarf"/><br /><sub><b>BadDwarf</b></sub></a><br /></td>
|
||||||
<td align="center"><a href="https://github.com/spdi"><img src="https://github.com/spdi.png" width="100px;" alt="spdi"/><br /><sub><b>spdi</b></sub></a><br /></td>
|
<td align="center"><a href="https://github.com/spdi"><img src="https://github.com/spdi.png" width="100px;" alt="spdi"/><br /><sub><b>spdi</b></sub></a><br /></td>
|
||||||
|
<td align="center"><a href="https://github.com/andrewk123"><img src="https://github.com/andrewk123.png" width="100px;" alt="andrewk123"/><br /><sub><b>andrewk123</b></sub></a><br /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
* [Changelog](#changelog)
|
* [Changelog](#changelog)
|
||||||
|
* [Releases v1.4.0](#releases-v140)
|
||||||
* [Releases v1.3.1](#releases-v131)
|
* [Releases v1.3.1](#releases-v131)
|
||||||
* [Releases v1.3.0](#releases-v130)
|
* [Releases v1.3.0](#releases-v130)
|
||||||
* [Releases v1.2.0](#releases-v120)
|
* [Releases v1.2.0](#releases-v120)
|
||||||
@ -30,6 +31,11 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### Releases v1.4.0
|
||||||
|
|
||||||
|
1. Fix crashing bug when request a non-existing IP. Check [Http GET polling causes crash when host disconnected #22](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/22)
|
||||||
|
2. Modify `platform.ini` to avoid compile error with PIO when using ESP8266/ESP32
|
||||||
|
|
||||||
### Releases v1.3.1
|
### Releases v1.3.1
|
||||||
|
|
||||||
1. Update `platform.ini` and `library.json` to use original `khoih-prog` instead of `khoih.prog` after PIO fix
|
1. Update `platform.ini` and `library.json` to use original `khoih-prog` instead of `khoih.prog` after PIO fix
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name":"AsyncHTTPRequest_Generic",
|
"name":"AsyncHTTPRequest_Generic",
|
||||||
"version": "1.3.1",
|
"version": "1.4.0",
|
||||||
"description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP libraries, such as AsyncTCP, ESPAsyncTCP, AsyncTCP_STM32, etc.. for ESP32 (including ESP32-S2), WT32_ETH01 (ESP32 + LAN8720), ESP8266 and currently STM32 with LAN8720 or built-in LAN8742A Ethernet.",
|
"description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP libraries, such as AsyncTCP, ESPAsyncTCP, AsyncTCP_STM32, etc.. for ESP32 (including ESP32-S2), WT32_ETH01 (ESP32 + LAN8720), ESP8266 and currently STM32 with LAN8720 or built-in LAN8742A Ethernet.",
|
||||||
"keywords":"communication, async, tcp, http, ESP8266, ESP32, ESP32-S2, wt32-eth01, ESPAsyncTCP, AsyncTCP, stm32, ethernet, wifi, lan8742a, lan8720, f407ve, nucleo, nucleo-144, stm32f7, stm32f4",
|
"keywords":"communication, async, tcp, http, ESP8266, ESP32, ESP32-S2, wt32-eth01, ESPAsyncTCP, AsyncTCP, stm32, ethernet, wifi, lan8742a, lan8720, f407ve, nucleo, nucleo-144, stm32f7, stm32f4",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=AsyncHTTPRequest_Generic
|
name=AsyncHTTPRequest_Generic
|
||||||
version=1.3.1
|
version=1.4.0
|
||||||
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
|
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
|
||||||
maintainer=Khoi Hoang <khoih.prog@gmail.com>
|
maintainer=Khoi Hoang <khoih.prog@gmail.com>
|
||||||
license=MIT
|
license=MIT
|
||||||
|
@ -50,12 +50,12 @@ lib_deps =
|
|||||||
me-no-dev/AsyncTCP@>=1.1.1
|
me-no-dev/AsyncTCP@>=1.1.1
|
||||||
me-no-dev/ESPAsyncTCP@>=1.2.2
|
me-no-dev/ESPAsyncTCP@>=1.2.2
|
||||||
; philbowles/STM32AsyncTCP
|
; philbowles/STM32AsyncTCP
|
||||||
https://github.com/khoih-prog/STM32AsyncTCP.git
|
; https://github.com/khoih-prog/STM32AsyncTCP.git
|
||||||
stm32duino/STM32duino LwIP@>=2.1.2
|
; stm32duino/STM32duino LwIP@>=2.1.2
|
||||||
stm32duino/STM32duino STM32Ethernet@>=1.2.0
|
; stm32duino/STM32duino STM32Ethernet@>=1.2.0
|
||||||
khoih-prog/ESPAsync_WiFiManager@>=1.9.3
|
khoih-prog/ESPAsync_WiFiManager@>=1.9.3
|
||||||
lorol/LittleFS_esp32@>=1.0.6
|
lorol/LittleFS_esp32@>=1.0.6
|
||||||
khoih-prog/WebServer_WT32_ETH01@>=1.2.1
|
; khoih-prog/WebServer_WT32_ETH01@>=1.2.1
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
; set your debug output (default=Serial)
|
; set your debug output (default=Serial)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -40,7 +41,7 @@
|
|||||||
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
|
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.3.1"
|
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.4.0"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -259,9 +260,13 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//////
|
//////
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("01) send String body =", body);
|
||||||
|
|
||||||
MUTEX_LOCK(false)
|
MUTEX_LOCK(false)
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("02) send String body =", body);
|
||||||
|
|
||||||
_addHeader("Content-Length", String(body.length()).c_str());
|
_addHeader("Content-Length", String(body.length()).c_str());
|
||||||
|
|
||||||
if ( ! _buildRequest())
|
if ( ! _buildRequest())
|
||||||
@ -271,9 +276,15 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("1) send String body =", body);
|
||||||
|
|
||||||
_request->write(body);
|
_request->write(body);
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("2) send String body =", body);
|
||||||
_send();
|
_send();
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("3) send String body =", body);
|
||||||
|
|
||||||
_AHTTP_unlock;
|
_AHTTP_unlock;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -790,12 +801,27 @@ size_t AsyncHTTPRequest::_send()
|
|||||||
|
|
||||||
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if ( ! _client->connected())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("!connected");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if ( ! _client->canSend())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( ! _client->connected() || ! _client->canSend())
|
if ( ! _client->connected() || ! _client->canSend())
|
||||||
{
|
{
|
||||||
AHTTP_LOGDEBUG("*can't send");
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t supply = _request->available();
|
size_t supply = _request->available();
|
||||||
size_t demand = _client->space();
|
size_t demand = _client->space();
|
||||||
@ -1009,17 +1035,17 @@ void AsyncHTTPRequest::_onDisconnect(AsyncClient* client)
|
|||||||
|
|
||||||
if (_readyState < readyStateOpened)
|
if (_readyState < readyStateOpened)
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_NOT_CONNECTED");
|
||||||
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
else if (_HTTPcode > 0 &&
|
else if (_HTTPcode > 0 &&
|
||||||
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_CONNECTION_LOST");
|
||||||
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAFE_DELETE(_client)
|
AHTTP_LOGDEBUG1("_HTTPcode = ", _HTTPcode);
|
||||||
|
|
||||||
_client = nullptr;
|
|
||||||
|
|
||||||
SAFE_DELETE_ARRAY(_connectedHost)
|
SAFE_DELETE_ARRAY(_connectedHost)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#include "AsyncHTTPRequest_Debug_Generic.h"
|
#include "AsyncHTTPRequest_Debug_Generic.h"
|
||||||
@ -183,6 +184,8 @@ bool AsyncHTTPRequest::open(const char* method, const char* URL)
|
|||||||
sprintf(hostName, "%s:%d", _URL->host, _URL->port);
|
sprintf(hostName, "%s:%d", _URL->host, _URL->port);
|
||||||
_addHeader("host", hostName);
|
_addHeader("host", hostName);
|
||||||
|
|
||||||
|
AHTTP_LOGDEBUG1("open: conneting to hostname =", hostName);
|
||||||
|
|
||||||
SAFE_DELETE_ARRAY(hostName)
|
SAFE_DELETE_ARRAY(hostName)
|
||||||
|
|
||||||
_lastActivity = millis();
|
_lastActivity = millis();
|
||||||
@ -191,8 +194,6 @@ bool AsyncHTTPRequest::open(const char* method, const char* URL)
|
|||||||
_requestReadyToSend = true;
|
_requestReadyToSend = true;
|
||||||
//////
|
//////
|
||||||
|
|
||||||
AHTTP_LOGDEBUG1("open: conneting to hostname =", hostName);
|
|
||||||
|
|
||||||
return _connect();
|
return _connect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -258,9 +259,13 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//////
|
//////
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("01) send String body =", body);
|
||||||
|
|
||||||
MUTEX_LOCK(false)
|
MUTEX_LOCK(false)
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("02) send String body =", body);
|
||||||
|
|
||||||
_addHeader("Content-Length", String(body.length()).c_str());
|
_addHeader("Content-Length", String(body.length()).c_str());
|
||||||
|
|
||||||
if ( ! _buildRequest())
|
if ( ! _buildRequest())
|
||||||
@ -270,9 +275,15 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("1) send String body =", body);
|
||||||
|
|
||||||
_request->write(body);
|
_request->write(body);
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("2) send String body =", body);
|
||||||
_send();
|
_send();
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("3) send String body =", body);
|
||||||
|
|
||||||
_AHTTP_unlock;
|
_AHTTP_unlock;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -789,12 +800,27 @@ size_t AsyncHTTPRequest::_send()
|
|||||||
|
|
||||||
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if ( ! _client->connected())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("!connected");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if ( ! _client->canSend())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( ! _client->connected() || ! _client->canSend())
|
if ( ! _client->connected() || ! _client->canSend())
|
||||||
{
|
{
|
||||||
AHTTP_LOGDEBUG("*can't send");
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t supply = _request->available();
|
size_t supply = _request->available();
|
||||||
size_t demand = _client->space();
|
size_t demand = _client->space();
|
||||||
@ -1008,17 +1034,17 @@ void AsyncHTTPRequest::_onDisconnect(AsyncClient* client)
|
|||||||
|
|
||||||
if (_readyState < readyStateOpened)
|
if (_readyState < readyStateOpened)
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_NOT_CONNECTED");
|
||||||
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
else if (_HTTPcode > 0 &&
|
else if (_HTTPcode > 0 &&
|
||||||
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_CONNECTION_LOST");
|
||||||
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAFE_DELETE(_client)
|
AHTTP_LOGDEBUG1("_HTTPcode = ", _HTTPcode);
|
||||||
|
|
||||||
_client = nullptr;
|
|
||||||
|
|
||||||
SAFE_DELETE_ARRAY(_connectedHost)
|
SAFE_DELETE_ARRAY(_connectedHost)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -40,7 +41,7 @@
|
|||||||
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
|
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.3.0"
|
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.4.0"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#include "utility/xbuf.h"
|
#include "utility/xbuf.h"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -40,7 +41,7 @@
|
|||||||
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
#ifndef ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
#define ASYNC_HTTP_REQUEST_GENERIC_H
|
||||||
|
|
||||||
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.3.1"
|
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.4.0"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -259,9 +260,13 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//////
|
//////
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("01) send String body =", body);
|
||||||
|
|
||||||
MUTEX_LOCK(false)
|
MUTEX_LOCK(false)
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("02) send String body =", body);
|
||||||
|
|
||||||
_addHeader("Content-Length", String(body.length()).c_str());
|
_addHeader("Content-Length", String(body.length()).c_str());
|
||||||
|
|
||||||
if ( ! _buildRequest())
|
if ( ! _buildRequest())
|
||||||
@ -271,9 +276,15 @@ bool AsyncHTTPRequest::send(String body)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("1) send String body =", body);
|
||||||
|
|
||||||
_request->write(body);
|
_request->write(body);
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("2) send String body =", body);
|
||||||
_send();
|
_send();
|
||||||
|
|
||||||
|
AHTTP_LOGERROR1("3) send String body =", body);
|
||||||
|
|
||||||
_AHTTP_unlock;
|
_AHTTP_unlock;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -790,12 +801,27 @@ size_t AsyncHTTPRequest::_send()
|
|||||||
|
|
||||||
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
AHTTP_LOGDEBUG1("_send(), _request->available =", _request->available());
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if ( ! _client->connected())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("!connected");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if ( ! _client->canSend())
|
||||||
|
{
|
||||||
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( ! _client->connected() || ! _client->canSend())
|
if ( ! _client->connected() || ! _client->canSend())
|
||||||
{
|
{
|
||||||
AHTTP_LOGDEBUG("*can't send");
|
AHTTP_LOGDEBUG("*can't send");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t supply = _request->available();
|
size_t supply = _request->available();
|
||||||
size_t demand = _client->space();
|
size_t demand = _client->space();
|
||||||
@ -1009,17 +1035,17 @@ void AsyncHTTPRequest::_onDisconnect(AsyncClient* client)
|
|||||||
|
|
||||||
if (_readyState < readyStateOpened)
|
if (_readyState < readyStateOpened)
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_NOT_CONNECTED");
|
||||||
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
_HTTPcode = HTTPCODE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
else if (_HTTPcode > 0 &&
|
else if (_HTTPcode > 0 &&
|
||||||
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
(_readyState < readyStateHdrsRecvd || (_contentRead + _response->available()) < _contentLength))
|
||||||
{
|
{
|
||||||
|
AHTTP_LOGDEBUG("HTTPCODE_CONNECTION_LOST");
|
||||||
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
_HTTPcode = HTTPCODE_CONNECTION_LOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAFE_DELETE(_client)
|
AHTTP_LOGDEBUG1("_HTTPcode = ", _HTTPcode);
|
||||||
|
|
||||||
_client = nullptr;
|
|
||||||
|
|
||||||
SAFE_DELETE_ARRAY(_connectedHost)
|
SAFE_DELETE_ARRAY(_connectedHost)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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: 1.3.1
|
Version: 1.4.0
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -33,6 +33,7 @@
|
|||||||
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
1.2.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
|
||||||
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
1.3.0 K Hoang 09/07/2021 Add support to WT32_ETH01 (ESP32 + LAN8720) boards
|
||||||
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
|
||||||
|
1.4.0 K Hoang 23/11/2021 Fix crashing bug when request a non-existing IP
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
Reference in New Issue
Block a user