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

Commit

Permalink
v1.10.0 to fix _parseURL() bug
Browse files Browse the repository at this point in the history
### Releases v1.10.0

1. Fix `_parseURL()` bug. Check [Bug with _parseURL() #21](khoih-prog/AsyncHTTPSRequest_Generic#21)
2. Improve `README.md` so that links can be used in other sites, such as `PIO`
  • Loading branch information
khoih-prog authored Feb 1, 2023
1 parent 663b631 commit 7a4784a
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 34 deletions.
12 changes: 9 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ However, before reporting a bug please check through the following:

If you don't find anything, please [open a new issue](https://github.com/khoih-prog/AsyncHTTPRequest_Teensy41/issues/new).

---

### How to submit a bug report

Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `Teensyduino` Core Version (e.g. `Teensyduino core v1.57`)
* `QNEthernet` library version (e.g. `QNEthernet v0.16.0`)
* `QNEthernet` library version (e.g. `QNEthernet v0.17.0`)
* Board type and relevant info
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
Expand All @@ -25,14 +27,18 @@ Please ensure to specify the following:
* Network configuration


Please be educated, civilized and constructive as you've always been. Disrespective posts against [GitHub Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-event-code-of-conduct) will be ignored and deleted.

---

### Example

```
Arduino IDE version: 1.8.19
Teensyduino core v1.57
Teensy 4.1 using QNEthernet v0.16.0
Teensy 4.1 using QNEthernet v0.17.0
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while using this library
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

* [Table of contents](#table-of-contents)
* [Changelog](#changelog)
* [Releases v1.10.0](#releases-v1100)
* [Releases v1.9.2](#releases-v192)
* [Releases v1.9.1](#releases-v191)
* [Releases v1.9.0](#releases-v190)
Expand All @@ -30,6 +31,11 @@

## Changelog

### Releases v1.10.0

1. Fix `_parseURL()` bug. Check [Bug with _parseURL() #21](https://github.com/khoih-prog/AsyncHTTPSRequest_Generic/issues/21)
2. Improve `README.md` so that links can be used in other sites, such as `PIO`

### Releases v1.9.2

1. Default to reconnect to the same `host:port` after connected for new HTTP sites. Check [Host/Headers not always sent with 1.10.1 #44](https://github.com/khoih-prog/AsyncHTTPRequest_Generic/issues/44)
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncCustomHeader/AsyncCustomHeader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//char GET_ServerAddress[] = "192.168.2.110/";
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncDweetGet/AsyncDweetGet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const char GET_ServerAddress[] = "dweet.io";
// use your own thing name here
String dweetName = "/dweet/for/currentSecond?second=";

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncDweetPost/AsyncDweetPost.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const char POST_ServerAddress[] = "dweet.io";
// use your own thing name here
String dweetName = "/dweet/for/pinA0-Read?";

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncHTTPRequest/AsyncHTTPRequest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

#include "defines.h"

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions examples/AsyncSimpleGET/AsyncSimpleGET.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//char GET_ServerAddress[] = "ipv4bot.whatismyipaddress.com/";
char GET_ServerAddress[] = "http://worldtimeapi.org/api/timezone/America/Toronto.txt";

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions examples/multiFileProject/multiFileProject.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#error Only Teensy 4.1 supported
#endif

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN_TARGET "AsyncHTTPRequest_Teensy41 v1.10.0"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MIN 1010000

// Uncomment for certain HTTP site to optimize
//#define NOT_SEND_HEADER_AFTER_CONNECTED true
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"AsyncHTTPRequest_Teensy41",
"version": "1.9.2",
"version": "1.10.0",
"description":"Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of Teensy41_AsyncTCP for Teensy 4.1 using QNEthernet. This library is one of the current or future Async libraries to support Teensy 4.1 using QNEthernet, such as AsyncHTTPRequest_Generic, AsyncHTTPSRequest_Generic, AsyncMQTT_Generic, Teensy41_AsyncWebServer, Teensy41_AsyncUDP, Teensy41_AsyncDNSServer, AsyncHTTPRequest_Teensy41_SSL, etc",
"keywords":"communication, async, tcp, http, async-tcp, async-http, teensy, teensy41, teensy-41, qnethernet, lwip",
"authors": [
Expand Down Expand Up @@ -31,7 +31,7 @@
{
"owner": "ssilverman",
"name": "QNEthernet",
"version": ">=0.16.0",
"version": ">=0.17.0",
"platforms": ["teensy"]
}
],
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_Teensy41
version=1.9.2
version=1.10.0
author=Bob Lemaire, Khoi Hoang <[email protected]>
maintainer=Khoi Hoang <[email protected]>
sentence=Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of Teensy41_AsyncTCP for Teensy 4.1 using QNEthernet
Expand Down
4 changes: 2 additions & 2 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ lib_ldf_mode = chain+
lib_deps =
; PlatformIO 4.x
; Teensy41_AsyncTCP@>=1.1.0
; QNEthernet@>=0.16.0
; QNEthernet@>=0.17.0
;
; PlatformIO 5.x
khoih-prog/Teensy41_AsyncTCP@>=1.1.0
ssilverman/QNEthernet@>=0.16.0
ssilverman/QNEthernet@>=0.17.0

build_flags =
; set your build_flags
Expand Down
5 changes: 3 additions & 2 deletions src/AsyncHTTPRequest_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
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.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.7.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
Expand All @@ -31,6 +31,7 @@
1.9.0 K Hoang 21/10/2022 Fix bug. Clean up
1.9.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
1.9.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.10.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down
11 changes: 6 additions & 5 deletions src/AsyncHTTPRequest_Teensy41.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -31,6 +31,7 @@
1.9.0 K Hoang 21/10/2022 Fix bug. Clean up
1.9.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
1.9.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.10.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand All @@ -40,13 +41,13 @@

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

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION "AsyncHTTPRequest_Teensy41 v1.9.2"
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION "AsyncHTTPRequest_Teensy41 v1.10.0"

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MAJOR 1
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MINOR 9
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_PATCH 2
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_MINOR 10
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_PATCH 0

#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_INT 1009002
#define ASYNC_HTTP_REQUEST_TEENSY41_VERSION_INT 1010000

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

Expand Down
5 changes: 3 additions & 2 deletions src/AsyncHTTPRequest_Teensy41_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
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.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.7.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
Expand All @@ -31,6 +31,7 @@
1.9.0 K Hoang 21/10/2022 Fix bug. Clean up
1.9.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
1.9.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.10.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down
28 changes: 23 additions & 5 deletions src/AsyncHTTPRequest_Teensy41_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
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.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.7.1 K Hoang 18/03/2022 Initial coding for Teensy 4.1 using built-in QNEthernet.
Expand All @@ -31,6 +31,7 @@
1.9.0 K Hoang 21/10/2022 Fix bug. Clean up
1.9.1 K Hoang 21/10/2022 Fix bug of wrong reqStates
1.9.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.10.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -1169,11 +1170,28 @@ bool AsyncHTTPRequest::_parseURL(const String& url)

int pathBeg = url.indexOf('/', hostBeg);

int hostEnd;
int portBeg;

if (pathBeg < 0)
return false;
{
if ( url.indexOf(':', hostBeg) < 0 )
{
// No port, just https://www.aaa.com
hostEnd = url.length();
}
else
{
// with port, https://www.aaa.com:443
hostEnd = url.indexOf(':', hostBeg);
}
}
else
{
hostEnd = pathBeg;
}

int hostEnd = pathBeg;
int portBeg = url.indexOf(':', hostBeg);
portBeg = url.indexOf(':', hostBeg);

if (portBeg > 0 && portBeg < pathBeg)
{
Expand Down

0 comments on commit 7a4784a

Please sign in to comment.