Compare commits

...
6 Commits
Author SHA1 Message Date
Khoi Hoang a91b9a48be v1.10.1 to fix bug of wrong reqStates
### Releases v1.10.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/39) and [Callback behaviour is buggy (ESP8266) #43](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
2022-10-21 15:12:46 -04:00
Khoi Hoang e97224acf8 v1.10.1 to fix bug of wrong reqStates
### Releases v1.10.1

1. Fix bug of wrong `reqStates`
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
2022-10-21 15:11:17 -04:00
Khoi Hoang 40e15e30f9 v1.10.1 to fix bug of wrong reqStates
### Releases v1.10.1

1. Fix bug of wrong `reqStates`
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
2022-10-21 15:09:41 -04:00
Khoi Hoang fb494cae0f v1.10.0 to fix bug and clean-up
### Releases v1.10.0

1. Fix bug.
2. Clean up
2022-10-20 16:58:27 -04:00
Khoi Hoang dc076f7fc1 v1.10.0 to fix bug and clean-up
### Releases v1.10.0

1. Fix bug.
2. Clean up
2022-10-20 16:56:12 -04:00
Khoi Hoang 89d10346df v1.10.0 to fix bug and clean-up
### Releases v1.10.0

1. Fix bug.
2. Clean up
2022-10-20 16:54:51 -04:00
22 changed files with 526 additions and 506 deletions
+105 -102
View File
@@ -478,14 +478,14 @@ Please take a look at other examples, as well.
#### 1. File [AsyncHTTPRequest_STM32.ino](examples/AsyncHTTPRequest_STM32/AsyncHTTPRequest_STM32.ino)
https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/79f62c3f4a8d0b686fb7ac6b3e5b8c7ca269f49c/examples/AsyncHTTPRequest_STM32/AsyncHTTPRequest_STM32.ino#L43-L148
https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/40e15e30f934e4b269b16a8ab8727558f0ab7b03/examples/AsyncHTTPRequest_STM32/AsyncHTTPRequest_STM32.ino#L43-L148
---
#### 2. File [defines.h](examples/AsyncHTTPRequest_STM32/defines.h)
https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/79f62c3f4a8d0b686fb7ac6b3e5b8c7ca269f49c/examples/AsyncHTTPRequest_STM32/defines.h#L22-L134
https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/40e15e30f934e4b269b16a8ab8727558f0ab7b03/examples/AsyncHTTPRequest_STM32/defines.h#L22-L134
---
@@ -497,23 +497,23 @@ https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/79f62c3f4a8d0b686fb7
```
Start AsyncHTTPRequest_STM32 on NUCLEO_F767ZI
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
AsyncHTTPRequest @ IP : 192.168.2.178
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:07:55.344362-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:16:16.759058-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120075
utc_datetime: 2022-10-18T19:07:55.344362+00:00
unixtime: 1666296976
utc_datetime: 2022-10-20T20:16:16.759058+00:00
utc_offset: -04:00
week_number: 42
*********************
@@ -521,17 +521,17 @@ week_number: 42
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:08:54.489027-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:17:16.713722-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120134
utc_datetime: 2022-10-18T19:08:54.489027+00:00
unixtime: 1666297036
utc_datetime: 2022-10-20T20:17:16.713722+00:00
utc_offset: -04:00
week_number: 42
```
@@ -542,7 +542,7 @@ week_number: 42
```
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP8266_NODEMCU
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Stored: SSID = HueNet1, Pass = 12345678
Got stored Credentials. Timeout 120s
ConnectMultiWiFi in setup
@@ -551,17 +551,17 @@ H
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:09:54.390100-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:19:16.751279-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120194
utc_datetime: 2022-10-18T19:09:54.390100+00:00
unixtime: 1666297156
utc_datetime: 2022-10-20T20:19:16.751279+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -574,7 +574,7 @@ HHHHHH
```
Starting AsyncHTTPRequest_ESP_WiFiManager using SPIFFS on ESP32_DEV
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Stored: SSID = HueNet1, Pass = 12345678
Got stored Credentials. Timeout 120s
ConnectMultiWiFi in setup
@@ -583,17 +583,17 @@ H
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:09:54.390100-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:20:16.719881-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120194
utc_datetime: 2022-10-18T19:09:54.390100+00:00
unixtime: 1666297216
utc_datetime: 2022-10-20T20:20:16.719881+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -601,17 +601,17 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH H
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:10:54.440157-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:21:16.728312-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120254
utc_datetime: 2022-10-18T19:10:54.440157+00:00
unixtime: 1666297276
utc_datetime: 2022-10-20T20:21:16.728312+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -624,7 +624,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH
```
Starting AsyncHTTPRequest_ESP using ESP8266_NODEMCU
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Connecting to WiFi SSID: HueNet1
...........
HTTP WebServer is @ IP : 192.168.2.81
@@ -632,17 +632,17 @@ HTTP WebServer is @ IP : 192.168.2.81
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:11:54.424167-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:22:16.769386-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120314
utc_datetime: 2022-10-18T19:11:54.424167+00:00
unixtime: 1666297336
utc_datetime: 2022-10-20T20:22:16.769386+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -656,7 +656,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH H
```
Start AsyncWebClientRepeating_STM32 on NUCLEO_F767ZI
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
AsyncHTTPRequest @ IP : 192.168.2.72
**************************************
@@ -709,25 +709,25 @@ AsyncHTTPRequest @ IP : 192.168.2.72
```
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
WebServer_WT32_ETH01 v1.5.0
AsyncHTTPRequest_Generic v1.9.2
WebServer_WT32_ETH01 v1.5.1
AsyncHTTPRequest_Generic v1.10.1
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
AsyncHTTPRequest @ IP : 192.168.2.232
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:12:55.228159-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:23:16.733395-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120375
utc_datetime: 2022-10-18T19:12:55.228159+00:00
unixtime: 1666297396
utc_datetime: 2022-10-20T20:23:16.733395+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -739,8 +739,8 @@ week_number: 42
```
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP32C3_DEV
ESPAsync_WiFiManager v1.14.0
AsyncHTTPRequest_Generic v1.9.2
ESPAsync_WiFiManager v1.15.0
AsyncHTTPRequest_Generic v1.10.1
Stored: SSID = HueNet1, Pass = password
Got stored Credentials. Timeout 120s
ConnectMultiWiFi in setup
@@ -749,17 +749,17 @@ H
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:07:55.344362-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:25:16.750043-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120075
utc_datetime: 2022-10-18T19:07:55.344362+00:00
unixtime: 1666297516
utc_datetime: 2022-10-20T20:25:16.750043+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -767,17 +767,17 @@ HHHHHH
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:08:54.489027-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:26:16.747520-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120134
utc_datetime: 2022-10-18T19:08:54.489027+00:00
unixtime: 1666297576
utc_datetime: 2022-10-20T20:26:16.747520+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -790,8 +790,8 @@ week_number: 42
```
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP32S3_DEV
ESPAsync_WiFiManager v1.14.0
AsyncHTTPRequest_Generic v1.9.2
ESPAsync_WiFiManager v1.15.0
AsyncHTTPRequest_Generic v1.10.1
Stored: SSID = HueNet1, Pass = password
Got stored Credentials. Timeout 120s
ConnectMultiWiFi in setup
@@ -800,17 +800,17 @@ H
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:09:54.390100-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:22:16.769386-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120194
utc_datetime: 2022-10-18T19:09:54.390100+00:00
unixtime: 1666297336
utc_datetime: 2022-10-20T20:22:16.769386+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -819,17 +819,17 @@ HHHHHH
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:10:54.440157-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:23:16.733395-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120254
utc_datetime: 2022-10-18T19:10:54.440157+00:00
unixtime: 1666297396
utc_datetime: 2022-10-20T20:23:16.733395+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -843,7 +843,7 @@ The terminal output of [AsyncHTTPRequest_ESP_Multi example](examples/AsyncHTTPRe
```
Starting AsyncHTTPRequest_ESP_Multi using ESP32_DEV
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Connecting to WiFi SSID: HueNet1
.......
AsyncHTTPSRequest @ IP : 192.168.2.88
@@ -904,24 +904,24 @@ The terminal output of [AsyncHTTPRequest_ESP8266_Ethernet example](examples/Asyn
```
Starting AsyncHTTPRequest_ESP8266_Ethernet on ESP8266_NODEMCU_ESP12E using ESP8266_W5500 Ethernet
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Connecting ethernet..
Ethernet IP address: 192.168.2.187
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:07:55.344362-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:24:16.747577-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120075
utc_datetime: 2022-10-18T19:07:55.344362+00:00
unixtime: 1666297456
utc_datetime: 2022-10-20T20:24:16.747577+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -929,17 +929,17 @@ HHHHHH
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:08:54.489027-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:25:16.750043-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120134
utc_datetime: 2022-10-18T19:08:54.489027+00:00
unixtime: 1666297516
utc_datetime: 2022-10-20T20:25:16.750043+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -954,24 +954,24 @@ The terminal output of [AsyncHTTPRequest_ESP8266_Ethernet example](examples/Asyn
```
Starting AsyncHTTPRequest_ESP8266_Ethernet on ESP8266_NODEMCU_ESP12E using ESP8266_ENC28J60 Ethernet
AsyncHTTPRequest_Generic v1.9.2
AsyncHTTPRequest_Generic v1.10.1
Connecting to network : ..........................................................
Ethernet IP address: 192.168.2.187
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:09:54.390100-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:16:16.759058-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120194
utc_datetime: 2022-10-18T19:09:54.390100+00:00
unixtime: 1666296976
utc_datetime: 2022-10-20T20:16:16.759058+00:00
utc_offset: -04:00
week_number: 42
**************************************
@@ -979,23 +979,22 @@ HHHHHH
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-10-18T15:10:54.440157-04:00
day_of_week: 2
day_of_year: 291
datetime: 2022-10-20T16:17:16.713722-04:00
day_of_week: 4
day_of_year: 293
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1666120254
utc_datetime: 2022-10-18T19:10:54.440157+00:00
unixtime: 1666297036
utc_datetime: 2022-10-20T20:17:16.713722+00:00
utc_offset: -04:00
week_number: 42
```
---
---
@@ -1060,7 +1059,7 @@ Submit issues to: [AsyncHTTPRequest_Generic issues](https://github.com/khoih-pro
20. Fix ESP32 chipID for example`AsyncHTTPRequest_ESP_WiFiManager`
21. Remove dependency on `LittleFS_esp32` library to prevent PIO error when using new ESP32 core v1.0.6+
22. Not try to reconnect to the same `host:port` after connected
23. Fix bug of wrong `reqStates` introduced from `v1.9.0`
---
---
@@ -1069,15 +1068,17 @@ Submit issues to: [AsyncHTTPRequest_Generic issues](https://github.com/khoih-pro
This library is based on, modified, bug-fixed and improved from:
1. [Bob Lemaire's **asyncHTTPrequest Library**](https://github.com/boblemaire/asyncHTTPrequest) to use the better **asynchronous** features of these following Async TCP Libraries : ( [`ESPAsyncTCP`](https://github.com/me-no-dev/ESPAsyncTCP), [`AsyncTCP`](https://github.com/me-no-dev/AsyncTCP), and [`STM32AsyncTCP`](https://github.com/philbowles/STM32AsyncTCP) ).
2. Thanks to [Daniel Brunner](https://github.com/0xFEEDC0DE64) to report and make PR in [Fixed linker errors when included in multiple .cpp files](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/pull/1) leading to v1.0.1. See [**HOWTO Fix `Multiple Definitions` Linker Error**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic#HOWTO-Fix-Multiple-Definitions-Linker-Error)
3. Thanks to [gleniat](https://github.com/gleniat) to make enhancement request in [Add support for sending PUT, PATCH, DELETE request](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/5) leading to v1.1.0.
4. Thanks to [BadDwarf](https://github.com/baddwarf) to report [**compatibility with ESPAsyncWebServer #11**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/11) leading to the enhancement in v1.1.2.
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.
7. Thanks to [DavidAntonin](https://github.com/DavidAntonin) to report [Cannot send requests to different addresses #4](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/issues/4) leading to new release v1.7.1 to demonstrate how to send requests to multiple addresses and receive responses from them.
8. Thanks to [per1234](https://github.com/per1234) to make PR [Remove unavailable items from depends field of library.properties](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/pull/35) leading to v1.8.2
9. Thanks to [miwied](https://github.com/miwied) to report [setTimeout() hasn't any effect #38](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/38) leading to new release v1.9.0
1. [Bob Lemaire's **asyncHTTPrequest Library**](https://github.com/boblemaire/asyncHTTPrequest) to use the better **asynchronous** features of these following Async TCP Libraries : ( [`ESPAsyncTCP`](https://github.com/me-no-dev/ESPAsyncTCP), [`AsyncTCP`](https://github.com/me-no-dev/AsyncTCP), and [`STM32AsyncTCP`](https://github.com/philbowles/STM32AsyncTCP) ).
2. Thanks to [Daniel Brunner](https://github.com/0xFEEDC0DE64) to report and make PR in [Fixed linker errors when included in multiple .cpp files](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/pull/1) leading to v1.0.1. See [**HOWTO Fix `Multiple Definitions` Linker Error**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic#HOWTO-Fix-Multiple-Definitions-Linker-Error)
3. Thanks to [gleniat](https://github.com/gleniat) to make enhancement request in [Add support for sending PUT, PATCH, DELETE request](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/5) leading to v1.1.0.
4. Thanks to [BadDwarf](https://github.com/baddwarf) to report [**compatibility with ESPAsyncWebServer #11**](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/11) leading to the enhancement in v1.1.2.
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.
7. Thanks to [DavidAntonin](https://github.com/DavidAntonin) to report [Cannot send requests to different addresses #4](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/issues/4) leading to new release v1.7.1 to demonstrate how to send requests to multiple addresses and receive responses from them.
8. Thanks to [per1234](https://github.com/per1234) to make PR [Remove unavailable items from depends field of library.properties](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/pull/35) leading to v1.8.2
9. Thanks to [miwied](https://github.com/miwied) to report [setTimeout() hasn't any effect #38](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/38) leading to new release v1.9.0
10. Thanks to [ValentinsStorre](https://github.com/ValentinsStorre) to report [Release 1.9 breakes previously running code #39](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/39) leading to new release v1.10.1
11. Thanks to [Dirk Vranckaert](https://github.com/dirkvranckaert) to report [Callback behaviour is buggy (ESP8266) #43](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/43) leading to new release v1.10.1
<table>
<tr>
@@ -1092,6 +1093,8 @@ This library is based on, modified, bug-fixed and improved from:
<td align="center"><a href="https://github.com/DavidAntonin"><img src="https://github.com/DavidAntonin.png" width="100px;" alt="DavidAntonin"/><br /><sub><b>DavidAntonin</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/per1234"><img src="https://github.com/per1234.png" width="100px;" alt="per1234"/><br /><sub><b>per1234</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/miwied"><img src="https://github.com/miwied.png" width="100px;" alt="miwied"/><br /><sub><b>miwied</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/ValentinsStorre"><img src="https://github.com/ValentinsStorre.png" width="100px;" alt="ValentinsStorre"/><br /><sub><b>ValentinsStorre</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/dirkvranckaert"><img src="https://github.com/dirkvranckaert.png" width="100px;" alt="dirkvranckaert"/><br /><sub><b>Dirk Vranckaert</b></sub></a><br /></td>
</tr>
</table>
+12
View File
@@ -12,6 +12,8 @@
## Table of Contents
* [Changelog](#changelog)
* [Releases v1.10.1](#releases-v1101)
* [Releases v1.10.0](#releases-v1100)
* [Releases v1.9.2](#releases-v192)
* [Releases v1.9.1](#releases-v191)
* [Releases v1.9.0](#releases-v190)
@@ -42,6 +44,16 @@
## Changelog
### Releases v1.10.1
1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/39) and [Callback behaviour is buggy (ESP8266) #43](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
### Releases v1.10.0
1. Fix bug.
2. Clean up
### Releases v1.9.2
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)
@@ -24,8 +24,8 @@
//char GET_ServerAddress[] = "192.168.2.110/";
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -35,8 +35,8 @@ const char GET_ServerAddress[] = "dweet.io";
// use your own thing name here
String dweetName = "/dweet/for/currentSecond?second=";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -29,8 +29,8 @@ const char POST_ServerAddress[] = "dweet.io";
// use your own thing name here
String dweetName = "/dweet/for/pinA0-Read?";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -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_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// Level from 0-4
#define ASYNC_HTTP_DEBUG_PORT Serial
@@ -68,6 +68,9 @@ const char* password = "your_pass";
#include <WiFi.h>
#endif
// Seconds for timeout, default is 3s
#define DEFAULT_RX_TIMEOUT 10
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -46,7 +46,7 @@
// Level from 0-4
#define ASYNC_HTTP_DEBUG_PORT Serial
#define _ASYNC_HTTP_LOGLEVEL_ 3
#define _ASYNC_HTTP_LOGLEVEL_ 4
// 300s = 5 minutes to not flooding
#define HTTP_REQUEST_INTERVAL 60 //300
@@ -65,8 +65,11 @@ const char* password = "your_pass";
#include <WiFi.h>
#endif
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// Seconds for timeout, default is 3s
#define DEFAULT_RX_TIMEOUT 10
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -95,8 +95,11 @@ using TCPClient = WiFiClient;
//////////////////////////////////////////////////////////
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// Seconds for timeout, default is 3s
#define DEFAULT_RX_TIMEOUT 10
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -44,6 +44,9 @@ const char* password = "your_pass";
#include <WiFi.h>
#endif
// Seconds for timeout, default is 3s
#define DEFAULT_RX_TIMEOUT 10
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // http://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -49,8 +49,8 @@
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// Level from 0-4
#define ASYNC_HTTP_DEBUG_PORT Serial
@@ -42,8 +42,8 @@
#include "defines.h"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -24,8 +24,8 @@
//char GET_ServerAddress[] = "ipv4bot.whatismyipaddress.com/";
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -26,8 +26,8 @@ const char GET_ServerAddress[] = "arduino.tips";
// GET location
String GET_Location = "/asciilogo.txt";
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// 600s = 10 minutes to not flooding, 60s in testing
#define HTTP_REQUEST_INTERVAL_MS 60000 //600000
@@ -57,8 +57,8 @@
#include <WebServer_WT32_ETH01.h> // https://github.com/khoih-prog/WebServer_WT32_ETH01
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -57,8 +57,8 @@
#include <WebServer_WT32_ETH01.h> // https://github.com/khoih-prog/WebServer_WT32_ETH01
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
@@ -19,8 +19,8 @@
#error This code is intended to run on the ESP8266, ESP32 or STM32 platform! Please check your Tools->Board setting.
#endif
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.9.2"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001
#include "multiFileProject.h"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name":"AsyncHTTPRequest_Generic",
"version": "1.9.2",
"version": "1.10.1",
"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, ESP32_S3 and ESP32_C3), WT32_ETH01 (ESP32 + LAN8720), ESP8266 (WiFi, W5x00 or ENC28J60) and currently STM32 with built-in LAN8742A Ethernet.",
"keywords":"communication, async, tcp, http, ESP8266, ESP32, ESP32-S2, ESP32-S3, ESP32-C3, wt32-eth01, stm32, ethernet, wifi, lan8742a, nucleo-144, stm32f7, W5x00, ENC28J60",
"authors": [
+1 -1
View File
@@ -1,5 +1,5 @@
name=AsyncHTTPRequest_Generic
version=1.9.2
version=1.10.1
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=GPLv3
+3 -1
View File
@@ -18,7 +18,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: 1.9.2
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -32,6 +32,8 @@
1.9.0 K Hoang 30/08/2022 Fix bug. Improve debug messages. Optimize code
1.9.1 K Hoang 09/09/2022 Fix ESP32 chipID for example `AsyncHTTPRequest_ESP_WiFiManager`
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/
#pragma once
+3 -1
View File
@@ -18,7 +18,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: 1.9.2
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -32,6 +32,8 @@
1.9.0 K Hoang 30/08/2022 Fix bug. Improve debug messages. Optimize code
1.9.1 K Hoang 09/09/2022 Fix ESP32 chipID for example `AsyncHTTPRequest_ESP_WiFiManager`
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/
#pragma once
+101 -64
View File
@@ -18,7 +18,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: 1.9.2
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -32,6 +32,8 @@
1.9.0 K Hoang 30/08/2022 Fix bug. Improve debug messages. Optimize code
1.9.1 K Hoang 09/09/2022 Fix ESP32 chipID for example `AsyncHTTPRequest_ESP_WiFiManager`
1.9.2 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.10.0 K Hoang 20/10/2022 Fix bug. Clean up
1.10.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/
#pragma once
@@ -39,18 +41,24 @@
#ifndef ASYNC_HTTP_REQUEST_GENERIC_HPP
#define ASYNC_HTTP_REQUEST_GENERIC_HPP
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.9.2"
////////////////////////////////////////
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MAJOR 1
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MINOR 9
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 2
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MINOR 10
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 1
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1009002
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1010001
////////////////////////////////////////
#include <Arduino.h>
#include "AsyncHTTPRequest_Debug_Generic.h"
////////////////////////////////////////
#ifndef DEBUG_IOTA_PORT
#define DEBUG_IOTA_PORT Serial
#endif
@@ -61,11 +69,20 @@
#define DEBUG_IOTA_HTTP_SET false
#endif
////////////////////////////////////////
// KH add
#define SAFE_DELETE(object) if (object) { delete object;}
#define SAFE_DELETE_ARRAY(object) if (object) { delete[] object;}
#define ASYNC_HTTP_PREFIX "HTTP://"
#define ASYNC_HTTP_PORT 80
#define ASYNC_HTTPS_PREFIX "HTTPS://"
#define ASYNC_HTTPS_PORT 443
////////////////////////////////////////
#if ESP32
#include <AsyncTCP.h>
@@ -87,9 +104,9 @@
#define _AHTTP_lock
#define _AHTTP_unlock
#elif ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) )
#elif ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || \
defined(STM32F7) || defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) || \
defined(STM32G0) || defined(STM32G4) || defined(STM32WB) || defined(STM32MP1) )
#include "STM32AsyncTCP.h"
@@ -100,10 +117,12 @@
#endif
////////////////////////////////////////
#include <pgmspace.h>
// Merge xbuf
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
struct xseg
{
@@ -111,6 +130,8 @@ struct xseg
uint8_t data[];
};
////////////////////////////////////////
class xbuf: public Print
{
public:
@@ -159,8 +180,7 @@ class xbuf: public Print
String peekString(int);
/* In addition to the above functions,
the following inherited functions from the Print class are available.
/* In addition to the above functions, the following inherited functions from the Print class are available.
size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3)));
size_t printf_P(PGM_P format, ...) __attribute__((format(printf, 2, 3)));
@@ -204,13 +224,17 @@ class xbuf: public Print
};
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
#define DEBUG_HTTP(format,...) if(_debug){\
DEBUG_IOTA_PORT.printf("Debug(%3ld): ", millis()-_requestStartTime);\
DEBUG_IOTA_PORT.printf_P(PSTR(format),##__VA_ARGS__);}
#define DEFAULT_RX_TIMEOUT 3 // Seconds for timeout
#if !defined(DEFAULT_RX_TIMEOUT)
#define DEFAULT_RX_TIMEOUT 3 // Seconds for timeout
#endif
////////////////////////////////////////
#define HTTPCODE_CONNECTION_REFUSED (-1)
#define HTTPCODE_SEND_HEADER_FAILED (-2)
@@ -224,6 +248,8 @@ class xbuf: public Print
#define HTTPCODE_STREAM_WRITE (-10)
#define HTTPCODE_TIMEOUT (-11)
////////////////////////////////////////
typedef enum
{
readyStateUnsent = 0, // Client created, open not yet called
@@ -232,68 +258,70 @@ typedef enum
readyStateLoading = 3, // receiving, partial data available
readyStateDone = 4 // Request complete, all data available.
} reqStates;
////////////////////////////////////////
class AsyncHTTPRequest
{
struct header
struct header
{
header* next;
char* name;
char* value;
header(): next(nullptr), name(nullptr), value(nullptr)
{};
~header()
{
header* next;
char* name;
char* value;
header(): next(nullptr), name(nullptr), value(nullptr)
{};
~header()
{
SAFE_DELETE_ARRAY(name)
SAFE_DELETE_ARRAY(value)
SAFE_DELETE(next)
//delete[] name;
//delete[] value;
//delete next;
}
};
SAFE_DELETE_ARRAY(name)
SAFE_DELETE_ARRAY(value)
SAFE_DELETE(next)
}
};
struct URL
{
char *buffer;
char *scheme;
char *host;
int port;
char *path;
char *query;
char *buffer;
char *scheme;
char *host;
int port;
char *path;
char *query;
URL(): buffer(nullptr), scheme(nullptr), host(nullptr),
port(80), path(nullptr), query(nullptr)
{};
URL(): buffer(nullptr), scheme(nullptr), host(nullptr),
port(80), path(nullptr), query(nullptr)
{};
~URL()
{
SAFE_DELETE_ARRAY(buffer)
SAFE_DELETE_ARRAY(scheme)
SAFE_DELETE_ARRAY(host)
SAFE_DELETE_ARRAY(path)
SAFE_DELETE_ARRAY(query)
}
};
typedef std::function<void(void*, AsyncHTTPRequest*, int readyState)> readyStateChangeCB;
typedef std::function<void(void*, AsyncHTTPRequest*, size_t available)> onDataCB;
~URL()
{
SAFE_DELETE_ARRAY(buffer)
SAFE_DELETE_ARRAY(scheme)
SAFE_DELETE_ARRAY(host)
SAFE_DELETE_ARRAY(path)
SAFE_DELETE_ARRAY(query)
}
};
typedef std::function<void(void*, AsyncHTTPRequest*, int readyState)> readyStateChangeCB;
typedef std::function<void(void*, AsyncHTTPRequest*, size_t available)> onDataCB;
////////////////////////////////////////
public:
AsyncHTTPRequest();
~AsyncHTTPRequest();
//External functions in typical order of use:
//__________________________________________________________________________________________________________*/
////////////////////////////////////////
void setDebug(bool); // Turn debug message on/off
bool debug(); // is debug on or off?
bool open(const char* /*GET/POST*/, const char* URL); // Initiate a request
void onReadyStateChange(readyStateChangeCB, void* arg = 0); // Optional event handler for ready state change
// or you can simply poll readyState()
void onReadyStateChange(readyStateChangeCB, void* arg = 0); // Optional event handler for ready state change or you can simply poll readyState()
void setTimeout(int); // overide default timeout (seconds)
void setReqHeader(const char* name, const char* value); // add a request header
@@ -307,7 +335,7 @@ class AsyncHTTPRequest
#endif
bool send(); // Send the request (GET)
bool send(const String& body); // Send the request (POST)
bool send(const String& body); // Send the request (POST)
bool send(const char* body); // Send the request (POST)
bool send(const uint8_t* buffer, size_t len); // Send the request (POST) (binary data?)
bool send(xbuf* body, size_t len); // Send the request (POST) data in an xbuf
@@ -341,16 +369,23 @@ class AsyncHTTPRequest
size_t responseRead(uint8_t* buffer, size_t len); // Read response into buffer
uint32_t elapsedTime(); // Elapsed time of in progress transaction or last completed (ms)
String version(); // Version of AsyncHTTPRequest
//___________________________________________________________________________________________________________________________________
////////////////////////////////////////
private:
// New in v1.1.1
bool _requestReadyToSend;
//////
// New in v1.1.0
typedef enum { HTTPmethodGET, HTTPmethodPOST, HTTPmethodPUT, HTTPmethodPATCH, HTTPmethodDELETE, HTTPmethodHEAD, HTTPmethodMAX } HTTPmethod;
typedef enum
{
HTTPmethodGET,
HTTPmethodPOST,
HTTPmethodPUT,
HTTPmethodPATCH,
HTTPmethodDELETE,
HTTPmethodHEAD,
HTTPmethodMAX
} HTTPmethod;
HTTPmethod _HTTPmethod;
@@ -415,4 +450,6 @@ class AsyncHTTPRequest
bool _collectHeaders();
};
////////////////////////////////////////
#endif // ASYNC_HTTP_REQUEST_GENERIC_HPP
File diff suppressed because it is too large Load Diff