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

Commit

Permalink
v1.10.1 to fix bug of wrong reqStates
Browse files Browse the repository at this point in the history
### Releases v1.10.1

1. Fix bug of wrong `reqStates`
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
  • Loading branch information
khoih-prog authored Oct 21, 2022
1 parent fb494ca commit 40e15e3
Show file tree
Hide file tree
Showing 21 changed files with 110 additions and 94 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## 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)
Expand Down Expand Up @@ -43,6 +44,11 @@

## Changelog

### Releases v1.10.1

1. Fix bug of wrong `reqStates`
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks

### Releases v1.10.0

1. Fix bug.
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncCustomHeader_STM32/AsyncCustomHeader_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncDweetGet_STM32/AsyncDweetGet_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncDweetPost_STM32/AsyncDweetPost_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
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_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand All @@ -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

Expand Down
7 changes: 5 additions & 2 deletions examples/AsyncHTTPRequest_ESP/AsyncHTTPRequest_ESP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ const char* password = "your_pass";
#include <WiFi.h>
#endif

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ using TCPClient = WiFiClient;

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

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncHTTPRequest_STM32/AsyncHTTPRequest_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

#include "defines.h"

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncSimpleGET_STM32/AsyncSimpleGET_STM32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@

#include <WebServer_WT32_ETH01.h> // https://github.com/khoih-prog/WebServer_WT32_ETH01

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#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

Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010000
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET "AsyncHTTPRequest_Generic v1.10.1"
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN 1010001

#include "multiFileProject.h"

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"AsyncHTTPRequest_Generic",
"version": "1.10.0",
"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": [
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=AsyncHTTPRequest_Generic
version=1.10.0
version=1.10.1
author=Bob Lemaire,Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=GPLv3
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncHTTPRequest_Debug_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -33,6 +33,7 @@
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
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncHTTPRequest_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -33,6 +33,7 @@
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
Expand Down
40 changes: 19 additions & 21 deletions src/AsyncHTTPRequest_Generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.0
Version: 1.10.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -33,6 +33,7 @@
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
Expand All @@ -42,13 +43,13 @@

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

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION "AsyncHTTPRequest_Generic v1.10.0"
#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 10
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 0
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_PATCH 1

#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1010000
#define ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT 1010001

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

Expand Down Expand Up @@ -179,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)));
Expand Down Expand Up @@ -230,7 +230,9 @@ class xbuf: public Print
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

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

Expand Down Expand Up @@ -275,23 +277,20 @@ class AsyncHTTPRequest
SAFE_DELETE_ARRAY(name)
SAFE_DELETE_ARRAY(value)
SAFE_DELETE(next)
//delete[] name;
//delete[] value;
//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()
Expand Down Expand Up @@ -322,8 +321,7 @@ class AsyncHTTPRequest
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
Expand All @@ -337,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
Expand Down
Loading

0 comments on commit 40e15e3

Please sign in to comment.