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

Commit

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

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
  • Loading branch information
khoih-prog committed Oct 21, 2022
1 parent d581e81 commit 6ad4321
Show file tree
Hide file tree
Showing 20 changed files with 105 additions and 98 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.4.1](#releases-v141)
* [Releases v1.4.0](#releases-v140)
* [Releases v1.3.1](#releases-v131)
* [Releases v1.3.0](#releases-v130)
Expand All @@ -23,6 +24,11 @@

## Changelog

### Releases v1.4.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.4.0

1. Fix bug.
Expand Down
4 changes: 2 additions & 2 deletions examples/Ethernet/AsyncCustomHeader/AsyncCustomHeader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
//char GET_ServerAddress[] = "192.168.2.110/";
Expand Down
4 changes: 2 additions & 2 deletions examples/Ethernet/AsyncDweetGet/AsyncDweetGet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char GET_ServerAddress[] = "dweet.io";
Expand Down
4 changes: 2 additions & 2 deletions examples/Ethernet/AsyncDweetPost/AsyncDweetPost.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char POST_ServerAddress[] = "dweet.io";
Expand Down
4 changes: 2 additions & 2 deletions examples/Ethernet/AsyncHTTPRequest/AsyncHTTPRequest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
#include <Portenta_H7_AsyncHTTPRequest.h> // https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest
Expand Down
4 changes: 2 additions & 2 deletions examples/Ethernet/AsyncSimpleGET/AsyncSimpleGET.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
//char GET_ServerAddress[] = "ipv4bot.whatismyipaddress.com/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char GET_ServerAddress[] = "arduino.tips";
Expand Down
4 changes: 2 additions & 2 deletions examples/WiFi/AsyncCustomHeader/AsyncCustomHeader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
//char GET_ServerAddress[] = "192.168.2.110/";
Expand Down
4 changes: 2 additions & 2 deletions examples/WiFi/AsyncDweetGet/AsyncDweetGet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char GET_ServerAddress[] = "dweet.io";
Expand Down
4 changes: 2 additions & 2 deletions examples/WiFi/AsyncDweetPost/AsyncDweetPost.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char POST_ServerAddress[] = "dweet.io";
Expand Down
7 changes: 5 additions & 2 deletions examples/WiFi/AsyncHTTPRequest/AsyncHTTPRequest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// 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 <Portenta_H7_AsyncHTTPRequest.h> // https://github.com/khoih-prog/Portenta_H7_AsyncHTTPRequest
Expand Down
4 changes: 2 additions & 2 deletions examples/WiFi/AsyncSimpleGET/AsyncSimpleGET.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
//char GET_ServerAddress[] = "ipv4bot.whatismyipaddress.com/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "defines.h"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

// Select a test server address
const char GET_ServerAddress[] = "arduino.tips";
Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#error This code is intended to run on the Portenta_H7 platform! Please check your Tools->Board setting.
#endif

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.4.1"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1004001

#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": "Portenta_H7_AsyncHTTPRequest",
"version": "1.4.0",
"version": "1.4.1",
"keywords": "communication, http, async, websocket, webserver, async-webserver, async-tcp, async-udp, async-websocket, async-http, ssl, tls, mbed, mbed-portenta, portenta-h7, portentah7, portenta-h7-m7, portenta-h7-m4, portentah7-m7, portentah7-m4, stm32h7",
"description": "Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of Portenta_H7_AsyncTCP library for Portenta_7, using Vision-shield Ethernet or Murata WiFi.",
"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=Portenta_H7_AsyncHTTPRequest
version=1.4.0
version=1.4.1
author=Hristo Gochkov,Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
sentence=Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of Portenta_H7_AsyncTCP library for Portenta_7, using Vision-shield thernet or Murata WiFi.
Expand Down
3 changes: 2 additions & 1 deletion src/Portenta_H7_AsyncHTTPRequest.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.4.0
Version: 1.4.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.3.0 K Hoang 02/09/2022 Fix bug. Improve debug messages. Optimize code
1.3.1 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.4.0 K Hoang 20/10/2022 Fix bug. Clean up
1.4.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/

#pragma once
Expand Down
36 changes: 17 additions & 19 deletions src/Portenta_H7_AsyncHTTPRequest.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.4.0
Version: 1.4.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.3.0 K Hoang 02/09/2022 Fix bug. Improve debug messages. Optimize code
1.3.1 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.4.0 K Hoang 20/10/2022 Fix bug. Clean up
1.4.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -68,13 +69,13 @@

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

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION "Portenta_H7_AsyncHTTPRequest v1.4.0"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION "Portenta_H7_AsyncHTTPRequest v1.4.1"

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MAJOR 1
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MINOR 4
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_PATCH 0
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_PATCH 1

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT 1004000
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT 1004001

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

Expand Down Expand Up @@ -227,7 +228,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 @@ -272,23 +275,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 All @@ -310,7 +310,6 @@ class AsyncHTTPRequest
AsyncHTTPRequest();
~AsyncHTTPRequest();


//External functions in typical order of use:
////////////////////////////////////////

Expand All @@ -319,7 +318,6 @@ class AsyncHTTPRequest

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 setTimeout(int); // overide default timeout (seconds)

void setReqHeader(const char* name, const char* value); // add a request header
Expand Down Expand Up @@ -353,7 +351,7 @@ class AsyncHTTPRequest
char* responseLongText(); // response long (whole* or partial* as string)

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)
uint32_t elapsedTime(); // Elapsed time of transaction or last completed (ms)
String version(); // Version of AsyncHTTPRequest

////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion src/Portenta_H7_AsyncHTTPRequest_Debug.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.4.0
Version: 1.4.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.3.0 K Hoang 02/09/2022 Fix bug. Improve debug messages. Optimize code
1.3.1 K Hoang 18/10/2022 Not try to reconnect to the same host:port after connected
1.4.0 K Hoang 20/10/2022 Fix bug. Clean up
1.4.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
*****************************************************************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit 6ad4321

Please sign in to comment.