Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
v1.7.0 to fix file upload
Browse files Browse the repository at this point in the history
### Releases v1.7.0

1. Fix file upload to Teensy 4.1 board based on suggestions made on the PJRC forum. Align signatures of file upload handlers.
For more details, please see this post: [AsyncWebServer_Teensy41 bug onUpload](https://forum.pjrc.com/index.php?threads/asyncwebserver_teensy41-bug-onupload.72220).
  • Loading branch information
khoih-prog authored Jan 29, 2024
1 parent f508f2f commit 9a07705
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 44 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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.17.0`)
* `QNEthernet` library version (e.g. `QNEthernet v0.26.0`)
* Board type and relevant info
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
Expand All @@ -35,9 +35,9 @@ Please be educated, civilized and constructive as you've always been. Disrespect
```
Arduino IDE version: 1.8.19
Teensyduino core v1.57
Teensy 4.1 using QNEthernet v0.17.0
Teensy 4.1 using QNEthernet v0.26.0
OS: Ubuntu 20.04 LTS
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
Linux xy-Inspiron-3593 5.15.0-92-generic #102~20.04.1-Ubuntu SMP Mon Jan 15 13:09:14 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while using this library
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ to apply the better and faster **asynchronous** feature of the **powerful** [ESP

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. [`Teensy core v1.57+`](https://github.com/PaulStoffregen/cores) for Teensy 4.1. [![GitHub release](https://img.shields.io/github/release/PaulStoffregen/cores.svg)](https://github.com/PaulStoffregen/cores/releases/latest)
3. [`QNEthernet Library version v0.17.0+`](https://github.com/ssilverman/QNEthernet) for Teensy 4.1 built-in Ethernet
3. [`QNEthernet Library version v0.26.0+`](https://github.com/ssilverman/QNEthernet) for Teensy 4.1 built-in Ethernet
4. [`Teensy41_AsyncTCP library v1.1.0+`](https://github.com/khoih-prog/Teensy41_AsyncTCP) to use **Teensy 4.1 using QNEthernet Library**. [![GitHub release](https://img.shields.io/github/release/khoih-prog/Teensy41_AsyncTCP.svg)](https://github.com/khoih-prog/Teensy41_AsyncTCP/releases/latest)

---
Expand Down Expand Up @@ -1404,7 +1404,7 @@ Following are debug terminal output and screen shots when running example [Async

```cpp
Start Async_AdvancedWebServer on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
HTTP EthernetWebServer is @ IP : 192.168.2.107
```
Expand All @@ -1422,7 +1422,7 @@ Following is debug terminal output when running example [WebClient](examples/Web

```cpp
Start WebClient on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107

Starting connection to server...
Expand Down Expand Up @@ -1493,7 +1493,7 @@ Following is debug terminal output when running example [MQTTClient_Auth](exampl

```cpp
Start MQTTClient_Auth on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on TEENSY 4.1 with Teensy4.1 QNEthernet
Expand All @@ -1513,7 +1513,7 @@ Following is debug terminal output when running example [MQTTClient_Basic](examp

```cpp
Start MQTTClient_Basic on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Basic on TEENSY 4.1 with Teensy4.1 QNEthernet
Expand All @@ -1540,7 +1540,7 @@ Following is debug terminal output when running example [MQTT_ThingStream](examp

```cpp
Start MQTT_ThingStream on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
***************************************
Teensy41_Pub
Expand Down Expand Up @@ -1573,7 +1573,7 @@ Following is the debug terminal and screen shot when running example [Async_Adva

```cpp
Start Async_AdvancedWebServer_MemoryIssues_Send_CString on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0

HEAP DATA - Start => Free heap: 483328 Used heap: 0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.83
Expand All @@ -1597,7 +1597,7 @@ While using `Arduino String`, the HEAP usage is very large

```cpp
Start Async_AdvancedWebServer_MemoryIssues_SendArduinoString on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0

HEAP DATA - Start => Free heap: 483328 Used heap: 0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.83
Expand Down Expand Up @@ -1637,7 +1637,7 @@ Following is debug terminal output when running example [Async_AdvancedWebServer

```cpp
Start Async_AdvancedWebServer_SendChunked on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.92
AsyncWebServer is @ IP : 192.168.2.92
.[AWS] Total length to send in chunks = 31235
Expand Down Expand Up @@ -1706,7 +1706,7 @@ Following is debug terminal output when running example [AsyncWebServer_SendChun

```cpp
Start AsyncWebServer_SendChunked on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.92
AsyncWebServer is @ IP : 192.168.2.92
.[AWS] Total length to send in chunks = 46302
Expand Down Expand Up @@ -1762,7 +1762,7 @@ Following is debug terminal output when running example [Async_WebSocketsServer]

```cpp
Starting Async_WebSocketsServer on TEENSY 4.1 with Teensy4.1 QNEthernet
AsyncWebServer_Teensy41 v1.6.2
AsyncWebServer_Teensy41 v1.7.0
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.119
ws[Server: /ws][ClientID: 1] WSClient connected
ws[Server: /ws][ClientID: 1] text-message[len: 13]: Hello, Server
Expand Down Expand Up @@ -1828,7 +1828,7 @@ Submit issues to: [AsyncWebServer_Teensy41 issues](https://github.com/khoih-prog
9. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_RP2040W/tree/main/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_RP2040W/tree/main/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks
10. Use `allman astyle` and add `utils`
11. Add examples [Async_WebSocketsServer](https://github.com/khoih-prog/AsyncWebServer_Teensy41/tree/main/examples/Async_WebSocketsServer) to demo how to use `Async_WebSockets`

12. Fix `onUpload bug`. Check [AsyncWebServer_Teensy41 bug onUpload](https://forum.pjrc.com/index.php?threads/asyncwebserver_teensy41-bug-onupload.72220/)

---
---
Expand All @@ -1840,11 +1840,13 @@ Submit issues to: [AsyncWebServer_Teensy41 issues](https://github.com/khoih-prog
2. Thanks to [salasidis](https://github.com/salasidis) aka [rs77can](https://forum.arduino.cc/u/rs77can) to discuss and make the following `marvellous` PRs in [Portenta_H7_AsyncWebServer library](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer)
- [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8), leading to `v1.6.0` to support using `CString` to save heap to send `very large data`
- [All memmove() removed - string no longer destroyed #11](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/11), leading to `v1.6.0` to remove `memmove()` and not to destroy String anymore
3. Thanks to [E. van Putten](https://github.com/edwinvp) / [Shuptuu](https://forum.pjrc.com/index.php?members/shuptuu.48798/) to make the following PR in [Fix file upload handler by adjusting function signatures #9](https://github.com/khoih-prog/AsyncWebServer_Teensy41/pull/9) leading to `v1.7.0`

<table>
<tr>
<td align="center"><a href="https://github.com/me-no-dev"><img src="https://github.com/me-no-dev.png" width="100px;" alt="me-no-dev"/><br /><sub><b>⭐️⭐️ Hristo Gochkov</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/salasidis"><img src="https://github.com/salasidis.png" width="100px;" alt="salasidis"/><br /><sub><b>⭐️ salasidis</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/edwinvp"><img src="https://github.com/edwinvp.png" width="100px;" alt="edwinvp"/><br /><sub><b>E. van Putten</b></sub></a><br /></td>
</tr>
</table>

Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

* [Table of contents](#table-of-contents)
* [Changelog](#changelog)
* [Releases v1.7.0](#releases-v170)
* [Releases v1.6.2](#releases-v162)
* [Releases v1.6.1](#releases-v161)
* [Releases v1.6.0](#releases-v160)
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":"AsyncWebServer_Teensy41",
"version": "1.6.2",
"version": "1.7.0",
"description":"Asynchronous HTTP and WebSocket Server Library 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, AsyncWebServer_Teensy41_SSL, etc. Now supporting using CString to save heap to send very large data and examples to demo how to use beginChunkedResponse() to send large html in chunks",
"keywords":"async, tcp, http, websocket, webserver, async-tcp, async-http, async-webserver, async-websocket, teensy, teensy41, teensy-41, qnethernet, lwip",
"authors":
Expand Down Expand Up @@ -32,7 +32,7 @@
{
"owner": "ssilverman",
"name": "QNEthernet",
"version": ">=0.17.0",
"version": ">=0.26.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=AsyncWebServer_Teensy41
version=1.6.2
version=1.7.0
author=Hristo Gochkov, Khoi Hoang
maintainer=Khoi Hoang <khoih-dot-prog@gmail.com>
sentence=Asynchronous HTTP and WebSocket Server Library for Teensy 4.1 using QNEthernet
Expand Down
2 changes: 1 addition & 1 deletion platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lib_deps =
;
; PlatformIO 5.x
khoih-prog/Teensy41_AsyncTCP@>=1.1.0
ssilverman/QNEthernet@>=0.17.0
ssilverman/QNEthernet@>=0.26.0

; ============================================================
build_flags =
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncEventSource_Teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#if !defined(_AWS_TEENSY41_LOGLEVEL_)
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncEventSource_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncJson_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/
/*
Async Response to use with ArduinoJson and AsyncWebServer
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncWebAuthentication_Teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#if !defined(_AWS_TEENSY41_LOGLEVEL_)
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncWebAuthentication_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#pragma once
Expand Down
6 changes: 4 additions & 2 deletions src/AsyncWebHandlerImpl_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -193,7 +194,8 @@ class AsyncCallbackWebHandler: public AsyncWebHandler

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

virtual void handleUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) override final
virtual void handleUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len,
bool final) override final
{
if (_onUpload)
_onUpload(request, filename, index, data, len, final);
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncWebHandlers_Teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#if !defined(_AWS_TEENSY41_LOGLEVEL_)
Expand Down
6 changes: 4 additions & 2 deletions src/AsyncWebRequest_Teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#if !defined(_AWS_TEENSY41_LOGLEVEL_)
Expand Down Expand Up @@ -587,10 +588,11 @@ void AsyncWebServerRequest::_handleUploadByte(uint8_t data, bool last)
if (last || _itemBufferIndex == 1460)
{
//check if authenticated before calling the upload
if (_handler)
if (_handler)
{
_handler->handleUpload(this, _itemFilename, _itemSize - _itemBufferIndex, _itemBuffer, _itemBufferIndex, false);
}

_itemBufferIndex = 0;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncWebResponseImpl_Teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/AsyncWebResponses_Teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.6.2
Version: 1.7.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 06/10/2022 Option to use non-destroyed cString instead of String to save Heap
1.6.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.6.2 K Hoang 16/01/2023 Add examples Async_WebSocketsServer
1.7.0 K Hoang 29/01/2024 Fix file upload handler by adjusting function signatures
*****************************************************************************************************************************/

#if !defined(_AWS_TEENSY41_LOGLEVEL_)
Expand Down
Loading

0 comments on commit 9a07705

Please sign in to comment.