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

Commit

Permalink
v1.3.0 to fix _parseURL() bug
Browse files Browse the repository at this point in the history
### Release v1.3.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 30f0d80 commit a491c63
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 48 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/AsyncHTTPRequest_RP2040W/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
* `RP2040` Core Version (e.g. RP2040 core v2.6.3)
* `RP2040` Core Version (e.g. RP2040 core v2.7.1)
* `RP2040` Board type (e.g. RASPBERRY_PI_PICO_W)
* 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
RP2040 core v2.6.3
RP2040 core v2.7.1
RASPBERRY_PI_PICO_W Module
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
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<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>


---
---

Expand All @@ -27,13 +28,13 @@
* [VS Code & PlatformIO](#vs-code--platformio)
* [HOWTO Fix `Multiple Definitions` Linker Error](#howto-fix-multiple-definitions-linker-error)
* [Examples](#examples)
* [1. AsyncHTTPRequest](examples/AsyncHTTPRequest)
* [2. AsyncCustomHeader](examples/AsyncCustomHeader)
* [3. AsyncDweetGet](examples/AsyncDweetGet)
* [4. AsyncDweetPost](examples/AsyncDweetPost)
* [5. AsyncSimpleGET](examples/AsyncSimpleGET)
* [6. AsyncWebClientRepeating](examples/AsyncWebClientRepeating)
* [7. **multiFileProject**](examples/multiFileProject)
* [1. AsyncHTTPRequest](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest)
* [2. AsyncCustomHeader](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncCustomHeader)
* [3. AsyncDweetGet](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncDweetGet)
* [4. AsyncDweetPost](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncDweetPost)
* [5. AsyncSimpleGET](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncSimpleGET)
* [6. AsyncWebClientRepeating](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncWebClientRepeating)
* [7. **multiFileProject**](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/multiFileProject)
* [Example AsyncHTTPRequest](#example-asynchttprequest)
* [1. File AsyncHTTPRequest.ino](#1-file-asynchttprequestino)
* [2. File defines.h](#2-file-definesh)
Expand Down Expand Up @@ -108,7 +109,7 @@ This library is based on, modified from:
## Prerequisites

1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
2. [`Earle Philhower's arduino-pico core v2.6.3+`](https://github.com/earlephilhower/arduino-pico) for **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
2. [`Earle Philhower's arduino-pico core v2.7.1+`](https://github.com/earlephilhower/arduino-pico) for **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
3. [`AsyncTCP_RP2040W library v1.1.0+`](https://github.com/khoih-prog/AsyncTCP_RP2040W) for RASPBERRY_PI_PICO_W with CYW43439 WiFi. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncTCP_RP2040W.svg?)](https://www.ardu-badge.com/AsyncTCP_RP2040W)

---
Expand Down Expand Up @@ -155,7 +156,7 @@ in many files. But be sure to use the following `.h` file **in just 1 `.h`, `.cp
#include "AsyncHTTPRequest_RP2040W.h" //https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W
```

Check the new [**multiFileProject** example](examples/multiFileProject) for a `HOWTO` demo.
Check the new [**multiFileProject** example](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/multiFileProject) for a `HOWTO` demo.

Have a look at the discussion in [Different behaviour using the src_cpp or src_h lib #80](https://github.com/khoih-prog/ESPAsync_WiFiManager/discussions/80)

Expand All @@ -165,28 +166,28 @@ Have a look at the discussion in [Different behaviour using the src_cpp or src_h

### Examples

1. [AsyncHTTPRequest](examples/AsyncHTTPRequest)
2. [AsyncCustomHeader](examples/AsyncCustomHeader)
3. [AsyncDweetGet](examples/AsyncDweetGet)
4. [AsyncDweetPost](examples/AsyncDweetPost)
5. [AsyncSimpleGET](examples/AsyncSimpleGET)
6. [AsyncWebClientRepeating](examples/AsyncWebClientRepeating)
7. [multiFileProject](examples/multiFileProject)
1. [AsyncHTTPRequest](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest)
2. [AsyncCustomHeader](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncCustomHeader)
3. [AsyncDweetGet](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncDweetGet)
4. [AsyncDweetPost](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncDweetPost)
5. [AsyncSimpleGET](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncSimpleGET)
6. [AsyncWebClientRepeating](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncWebClientRepeating)
7. [multiFileProject](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/multiFileProject)


---

### Example [AsyncHTTPRequest](examples/AsyncHTTPRequest)
### Example [AsyncHTTPRequest](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest)

Please take a look at other examples, as well.

#### 1. File [AsyncHTTPRequest.ino](examples/AsyncHTTPRequest/AsyncHTTPRequest.ino)
#### 1. File [AsyncHTTPRequest.ino](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest/AsyncHTTPRequest.ino)

https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/73cdc771d7613d2f09a43bf727abf14bf98b1b01/examples/AsyncHTTPRequest/AsyncHTTPRequest.ino#L41-L193

---

#### 2. File [defines.h](examples/AsyncHTTPRequest/defines.h)
#### 2. File [defines.h](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest/defines.h)

https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/73cdc771d7613d2f09a43bf727abf14bf98b1b01/examples/AsyncHTTPRequest/defines.h#L20-L30

Expand All @@ -195,12 +196,12 @@ https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/73cdc771d7613d2f09a4

### Debug Terminal Output Samples

#### 1. [AsyncHTTPRequest](examples/AsyncHTTPRequest) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
#### 1. [AsyncHTTPRequest](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncHTTPRequest) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi

```cpp
Start AsyncHTTPRequest on RASPBERRY_PI_PICO_W
AsyncTCP_RP2040W v1.1.0
AsyncHTTPRequest_RP2040W v1.2.2
AsyncHTTPRequest_RP2040W v1.3.0
Connecting to SSID: HueNet1
SSID: HueNet1
Local IP Address: 192.168.2.77
Expand All @@ -209,30 +210,30 @@ Request sent
**************************************
abbreviation: EST
client_ip: aaa.bbb.ccc.ddd
datetime: 2022-11-10T12:51:21.828792-05:00
day_of_week: 4
day_of_year: 314
datetime: 2023-01-31T23:54:16.675525-05:00
day_of_week: 2
day_of_year: 31
dst: false
dst_from:
dst_offset: 0
dst_until:
raw_offset: -18000
timezone: America/Toronto
unixtime: 1668102681
utc_datetime: 2022-11-10T17:51:21.828792+00:00
unixtime: 1675227256
utc_datetime: 2023-02-01T04:54:16.675525+00:00
utc_offset: -05:00
week_number: 45
week_number: 5
**************************************
```

---

#### 2. [AsyncDweetPOST](examples/AsyncDweetPOST) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
#### 2. [AsyncDweetPOST](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncDweetPOST) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi

```cpp
Start AsyncDweetPOST on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
AsyncTCP_RP2040W v1.1.0
AsyncHTTPRequest_RP2040W v1.2.2
AsyncHTTPRequest_RP2040W v1.3.0
Connecting to SSID: HueNet1
SSID: HueNet1
Local IP Address: 192.168.2.180
Expand All @@ -249,12 +250,12 @@ Actual value: 88
---
#### 3. [AsyncWebClientRepeating](examples/AsyncWebClientRepeating) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
#### 3. [AsyncWebClientRepeating](https://github.com/khoih-prog/https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/tree/main/examples/AsyncWebClientRepeating) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
```cpp
Start AsyncWebClientRepeating on RASPBERRY_PI_PICO_W
AsyncTCP_RP2040W v1.1.0
AsyncHTTPRequest_RP2040W v1.2.2
AsyncHTTPRequest_RP2040W v1.3.0
Connecting to SSID: HueNet1
SSID: HueNet1
Local IP Address: 192.168.2.180
Expand Down Expand Up @@ -357,7 +358,8 @@ Submit issues to: [AsyncHTTPRequest_RP2040W issues](https://github.com/khoih-pro
8. Fix bug of wrong `reqStates`
9. Default to reconnect to the same `host:port` after connected for new HTTP sites.
10. Use `allman astyle` and add `utils`

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

---
---
Expand Down
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)
* [Release v1.3.0](#Release-v130)
* [Release v1.2.2](#Release-v122)
* [Release v1.2.1](#Release-v121)
* [Release v1.2.0](#Release-v120)
Expand All @@ -28,6 +30,11 @@

## Changelog

### Release v1.3.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`

### Release v1.2.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": "AsyncHTTPRequest_RP2040W",
"version": "1.2.2",
"version": "1.3.0",
"keywords": "communication, http, async, websocket, webserver, async-webserver, async-tcp, async-udp, async-websocket, async-http, ssl, tls, rp2040, rp2040w, raspberry-pi-pico-w, cyw43439, wifi",
"description": "Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_RP2040W library for RASPBERRY_PI_PICO_W with CYW43439 WiFi. This library, which relies on AsyncTCP_RP2040W, is part of a series of advanced Async libraries, such as AsyncTCP_RP2040W, AsyncUDP_RP2040W, AsyncWebSockets_RP2040W, AsyncWebServer_RP2040W, AsyncHTTPRequest_RP2040W, AsyncHTTPSRequest_RP2040W, etc.",
"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_RP2040W
version=1.2.2
version=1.3.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 AsyncTCP_RP2040W library for RASPBERRY_PI_PICO_W with CYW43439 WiFi.
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncHTTPRequest_RP2040W.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.2.2
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.2.0 K Hoang 21/10/2022 Fix bug. Clean up
1.2.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
1.2.1 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites. Fix bug
1.3.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

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

#pragma once
Expand Down Expand Up @@ -74,13 +75,13 @@

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

#define ASYNC_HTTP_REQUEST_RP2040W_VERSION "AsyncHTTPRequest_RP2040W v1.2.2"
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION "AsyncHTTPRequest_RP2040W v1.3.0"

#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MAJOR 1
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MINOR 2
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_PATCH 2
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MINOR 3
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_PATCH 0

#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT 1002002
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT 1003000

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

Expand Down
3 changes: 2 additions & 1 deletion src/AsyncHTTPRequest_RP2040W_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.2.2
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.2.0 K Hoang 21/10/2022 Fix bug. Clean up
1.2.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
1.2.1 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites. Fix bug
1.3.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down
26 changes: 22 additions & 4 deletions src/AsyncHTTPRequest_RP2040W_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.2.2
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.2.0 K Hoang 21/10/2022 Fix bug. Clean up
1.2.1 K Hoang 22/10/2022 Fix bug of wrong reqStates
1.2.1 K Hoang 10/11/2022 Default to reconnect to the same host:port after connected for new HTTP sites. Fix bug
1.3.0 K Hoang 01/02/2023 Fix _parseURL() bug
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -1165,11 +1166,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 a491c63

Please sign in to comment.