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

Commit

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

1. Fix bug of `_parseURL()`. 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 committed Feb 1, 2023
1 parent a77ac48 commit 3880396
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 94 deletions.
12 changes: 9 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ 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/Portenta_H7_AsyncHTTPRequest/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
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v3.4.1)
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v3.5.4)
* `Portenta_H7` Board type (e.g. Portenta_H7 Rev2 ABX00042, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
Expand All @@ -24,14 +26,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
`ArduinoCore-mbed` mbed_portenta core v3.4.1
`ArduinoCore-mbed` mbed_portenta core v3.5.4
Portenta_H7 Rev2 ABX00042
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
154 changes: 77 additions & 77 deletions README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>


---
---

## Table of Contents

* [Changelog](#changelog)
* [Releases v1.5.0](#releases-v150)
* [Releases v1.4.2](#releases-v142)
* [Releases v1.4.1](#releases-v141)
* [Releases v1.4.0](#releases-v140)
Expand All @@ -29,6 +31,11 @@

## Changelog

### Releases v1.5.0

1. Fix bug of `_parseURL()`. 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.4.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
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.2",
"version": "1.5.0",
"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.2
version=1.5.0
author=Bob Lemaire,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.2
Version: 1.5.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -30,6 +30,7 @@
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
1.4.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.5.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down
13 changes: 7 additions & 6 deletions src/Portenta_H7_AsyncHTTPRequest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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.4.2
Version: 1.5.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 13/10/2020 Initial coding for Portenta_H7
Expand All @@ -30,6 +30,7 @@
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
1.4.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.5.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -70,13 +71,13 @@

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

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION "Portenta_H7_AsyncHTTPRequest v1.4.2"
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION "Portenta_H7_AsyncHTTPRequest v1.5.0"

#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 2
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MINOR 5
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_PATCH 0

#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT 1004002
#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_INT 1005000

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

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.2
Version: 1.5.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -30,6 +30,7 @@
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
1.4.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.5.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down
26 changes: 22 additions & 4 deletions src/Portenta_H7_AsyncHTTPRequest_Impl.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.2
Version: 1.5.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -30,6 +30,7 @@
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
1.4.2 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites
1.5.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -1172,11 +1173,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:80
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 3880396

Please sign in to comment.