Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit c38dbdf

Browse files
authored
v1.4.0 to fix base64 encoding of websocket
### Releases v1.4.0 1. Fix base64 encoding of websocket client key and add WebServer progmem support. Check PR [Fix base64 encoding of websocket client key and progmem support for webserver #7](#7)
1 parent 6891743 commit c38dbdf

27 files changed

+190
-88
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Arduino IDE version: 1.8.16
3131
STM32 Core Version 2.1.0
3232
Nucleo-144 STM32F7 NUCLEO_F767ZI
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
34+
Linux xy-Inspiron-3593 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
3737
I encountered an endless loop while trying to connect to Local WiFi.

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ Following are debug terminal output and screen shots when running example [Async
17771777
17781778
```
17791779
Starting AsyncMultiWebServer_STM32 on NUCLEO_F767ZI with LAN8742A built-in Ethernet
1780-
AsyncWebServer_STM32 v1.3.1
1780+
AsyncWebServer_STM32 v1.4.0
17811781

17821782
Connected to network. IP = 192.168.2.141
17831783
Initialize multiServer OK, serverIndex = 0, port = 8080
@@ -1810,7 +1810,7 @@ Following is debug terminal output when running example [WebClient](examples/Web
18101810
18111811
```
18121812
Starting WebClient on NUCLEO_F767ZI with LAN8742A built-in Ethernet
1813-
AsyncWebServer_STM32 v1.3.1
1813+
AsyncWebServer_STM32 v1.4.0
18141814
You're connected to the network, IP = 192.168.2.71
18151815

18161816
Starting connection to server...
@@ -1879,7 +1879,7 @@ Following is debug terminal output when running example [MQTTClient_Auth](exampl
18791879
18801880
```
18811881
Starting MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A built-in Ethernet
1882-
AsyncWebServer_STM32 v1.3.1
1882+
AsyncWebServer_STM32 v1.4.0
18831883

18841884
Connected to network. IP = 192.168.2.71
18851885
Attempting MQTT connection to broker.emqx.io...connected
@@ -1897,7 +1897,7 @@ Following is debug terminal output when running example [MQTTClient_Basic](examp
18971897
18981898
```
18991899
Starting MQTTClient_Basic on NUCLEO_F767ZI with LAN8742A built-in Ethernet
1900-
AsyncWebServer_STM32 v1.3.1
1900+
AsyncWebServer_STM32 v1.4.0
19011901

19021902
Connected to network. IP = 192.168.2.71
19031903
Attempting MQTT connection to broker.shiftr.io...connected
@@ -1923,7 +1923,7 @@ Following is debug terminal output when running example [MQTT_ThingStream](examp
19231923
19241924
```
19251925
Starting MQTT_ThingStream on NUCLEO_F767ZI with LAN8742A built-in Ethernet
1926-
AsyncWebServer_STM32 v1.3.1
1926+
AsyncWebServer_STM32 v1.4.0
19271927

19281928
Connected to network. IP = 192.168.2.71
19291929
***************************************
@@ -1953,7 +1953,7 @@ Following is debug terminal output when running example [MQTTClient_Auth_LAN8720
19531953
19541954
```
19551955
Start MQTTClient_Auth_LAN8720 on BLACK_F407VE with LAN8720 Ethernet
1956-
AsyncWebServer_STM32 v1.3.1
1956+
AsyncWebServer_STM32 v1.4.0
19571957

19581958
Connected to network. IP = 192.168.2.150
19591959
Attempting MQTT connection to broker.emqx.io...connected
@@ -1992,7 +1992,7 @@ Following are debug terminal output and screen shots when running example [Async
19921992
19931993
```
19941994
Start AsyncMultiWebServer_STM32_LAN8720 on BLACK_F407VE with LAN8720 Ethernet
1995-
AsyncWebServer_STM32 v1.3.1
1995+
AsyncWebServer_STM32 v1.4.0
19961996

19971997
Connected to network. IP = 192.168.2.150
19981998
Initialize multiServer OK, serverIndex = 0, port = 8080
@@ -2083,7 +2083,7 @@ Submit issues to: [AsyncWebServer_STM32 issues](https://github.com/khoih-prog/As
20832083
3. Relied on [PhilBowles' STM32 AsyncTCP Library](https://github.com/philbowles/STM32AsyncTCP).
20842084
4. Thanks to good work of [Miguel Wisintainer](https://github.com/tcpipchip) for working with, developing, debugging and testing.
20852085
5. Thanks to [Jean-Claude](https://github.com/jcw) and [chris007de](https://github.com/chris007de) to help locate the dependency issue, discuss solution leading to release v1.2.6. Check [Compilation broken due to error in STM32AsyncTCP dependency](https://github.com/khoih-prog/AsyncWebServer_STM32/issues/4) and [how to run one of the examples?](https://github.com/khoih-prog/AsyncWebServer_STM32/issues/2).
2086-
2086+
6. Thanks to [tothtechnika](https://github.com/tothtechnika) to create the PR [Fix base64 encoding of websocket client key and progmem support for webserver #7](https://github.com/khoih-prog/AsyncWebServer_STM32/pull/7) leading to new release v1.4.0
20872087

20882088
<table>
20892089
<tr>
@@ -2093,6 +2093,7 @@ Submit issues to: [AsyncWebServer_STM32 issues](https://github.com/khoih-prog/As
20932093
<td align="center"><a href="https://github.com/tcpipchip"><img src="https://github.com/tcpipchip.png" width="100px;" alt="tcpipchip"/><br /><sub><b>tcpipchip</b></sub></a><br /></td>
20942094
<td align="center"><a href="https://github.com/jcw"><img src="https://github.com/jcw.png" width="100px;" alt="jcw"/><br /><sub><b>Jean-Claude</b></sub></a><br /></td>
20952095
<td align="center"><a href="https://github.com/chris007de"><img src="https://github.com/chris007de.png" width="100px;" alt="chris007de"/><br /><sub><b>chris007de</b></sub></a><br /></td>
2096+
<td align="center"><a href="https://github.com/tothtechnika"><img src="https://github.com/tothtechnika.png" width="100px;" alt="tothtechnika"/><br /><sub><b>tothtechnika</b></sub></a><br /></td>
20962097
</tr>
20972098
</table>
20982099

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
* [Table of contents](#table-of-contents)
1515
* [Changelog](#changelog)
16+
* [Releases v1.4.0](#releases-v140)
1617
* [Releases v1.3.1](#releases-v131)
1718
* [Releases v1.3.0](#releases-v130)
1819
* [Releases v1.2.6](#releases-v126)
@@ -25,6 +26,11 @@
2526

2627
## Changelog
2728

29+
### Releases v1.4.0
30+
31+
1. Fix base64 encoding of websocket client key and add WebServer progmem support. Check PR [Fix base64 encoding of websocket client key and progmem support for webserver #7](https://github.com/khoih-prog/AsyncWebServer_STM32/pull/7)
32+
33+
2834
### Releases v1.3.1
2935

3036
1. Update `platform.ini` and `library.json` to use original `khoih-prog` instead of `khoih.prog` after PIO fix

keywords.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ AsyncAbstractResponse KEYWORD1
4141
AsyncStreamResponse KEYWORD1
4242
AsyncCallbackResponse KEYWORD1
4343
AsyncChunkedResponse KEYWORD1
44+
AsyncProgmemResponse KEYWORD1
4445
AsyncResponseStream KEYWORD1
4546

4647
AsyncWebLock KEYWORD1
@@ -348,6 +349,12 @@ _fillBuffer KEYWORD2
348349
_sourceValid KEYWORD2
349350
_fillBuffer KEYWORD2
350351

352+
##############################
353+
# AsyncProgmemResponse
354+
##############################
355+
356+
_fillBuffer KEYWORD2
357+
351358
##############################
352359
# AsyncResponseStream
353360
##############################
@@ -497,6 +504,13 @@ webSocketSendFrameWindow KEYWORD2
497504
webSocketSendFrame KEYWORD2
498505
generateEventMessage KEYWORD2
499506

507+
ltrim KEYWORD2
508+
rtrim KEYWORD2
509+
trim KEYWORD2
510+
b64_encoded_size KEYWORD2
511+
b64_encode KEYWORD2
512+
513+
500514
#######################################
501515
# Constants (LITERAL1)
502516
#######################################

library.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"AsyncWebServer_STM32",
3-
"version": "1.3.1",
3+
"version": "1.4.0",
44
"description":"Asynchronous HTTP and WebSocket Server Library for STM32F/L/H/G/WB/MP1 using LAN8720 or built-in LAN8742A Ethernet",
55
"keywords":"http, async, websocket, webserver, stm32, stm32f, stm32l, stm32h, stm32g, stm32wb, stm32mp1, ethernet, lan8742a, lan8720, bluepill, blackpill, f407ve, f767zi, nucleo, nucleo-144",
66
"authors":
@@ -43,5 +43,6 @@
4343
}
4444
],
4545
"platforms": ["ststm32"],
46-
"examples": "examples/*/*/*.ino"
46+
"examples": "examples/*/*/*.ino",
47+
"headers": ["AsyncWebServer_STM32.h"]
4748
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=AsyncWebServer_STM32
2-
version=1.3.1
2+
version=1.4.0
33
author=Hristo Gochkov,Khoi Hoang
44
maintainer=Khoi Hoang <khoih.prog@gmail.com>
55
license=MIT

src/AsyncEventSource_STM32.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
1717
Bump up version to v1.2.3 to sync with ESPAsyncWebServer v1.2.3
1818
1.2.4 K Hoang 05/09/2020 Add back MD5/SHA1 authentication feature.
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
21-
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 *****************************************************************************************************************************/
21+
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support *****************************************************************************************************************************/
2224

2325
#define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 1
2426

@@ -270,7 +272,7 @@ void AsyncEventSourceClient::_queueMessage(AsyncEventSourceMessage *dataMessage)
270272

271273
if (_messageQueue.length() >= SSE_MAX_QUEUED_MESSAGES)
272274
{
273-
Serial.println("ERROR: Too many messages queued");
275+
LOGERROR("ERROR: Too many messages queued");
274276
delete dataMessage;
275277
}
276278
else

src/AsyncEventSource_STM32.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#pragma once

src/AsyncJson_STM32.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325
/*
2426
Async Response to use with ArduinoJson and AsyncWebServer

src/AsyncWebAuthentication_STM32.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 1

src/AsyncWebAuthentication_STM32.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#pragma once

src/AsyncWebHandlerImpl_STM32.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#pragma once

src/AsyncWebHandlers_STM32.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
13-
12+
Version: 1.4.0
13+
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
1616
1.2.3 K Hoang 02/09/2020 Initial coding for STM32 for built-in Ethernet (Nucleo-144, DISCOVERY, etc).
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 1

src/AsyncWebRequest_STM32.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
12+
Version: 1.4.0
1313
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#define _ASYNCWEBSERVER_STM32_LOGLEVEL_ 1
@@ -1007,11 +1009,13 @@ void AsyncWebServerRequest::send(AsyncWebServerResponse *response)
10071009
}
10081010
}
10091011

1010-
AsyncWebServerResponse * AsyncWebServerRequest::beginResponse_P(int code, const String& contentType, const uint8_t * content, size_t len, AwsTemplateProcessor callback){
1012+
AsyncWebServerResponse * AsyncWebServerRequest::beginResponse_P(int code, const String& contentType, const uint8_t * content, size_t len, AwsTemplateProcessor callback)
1013+
{
10111014
return new AsyncProgmemResponse(code, contentType, content, len, callback);
10121015
}
10131016

1014-
AsyncWebServerResponse * AsyncWebServerRequest::beginResponse_P(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback){
1017+
AsyncWebServerResponse * AsyncWebServerRequest::beginResponse_P(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback)
1018+
{
10151019
return beginResponse_P(code, contentType, (const uint8_t *)content, strlen_P(content), callback);
10161020
}
10171021

src/AsyncWebResponseImpl_STM32.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_STM32
1010
Licensed under MIT license
1111
12-
Version: 1.3.0
12+
Version: 1.4.0
1313
1414
Version Modified By Date Comments
1515
------- ----------- ---------- -----------
@@ -19,6 +19,8 @@
1919
1.2.5 K Hoang 28/12/2020 Suppress all possible compiler warnings. Add examples.
2020
1.2.6 K Hoang 22/03/2021 Fix dependency on STM32AsyncTCP Library
2121
1.3.0 K Hoang 14/04/2021 Add support to LAN8720 using STM32F4 or STM32F7
22+
1.3.1 K Hoang 09/10/2021 Update `platform.ini` and `library.json`
23+
1.4.0 K Hoang 14/12/2021 Fix base64 encoding of websocket client key and add WebServer progmem support
2224
*****************************************************************************************************************************/
2325

2426
#pragma once
@@ -141,10 +143,13 @@ class AsyncChunkedResponse: public AsyncAbstractResponse
141143
};
142144

143145
class cbuf;
144-
class AsyncProgmemResponse: public AsyncAbstractResponse {
146+
147+
class AsyncProgmemResponse: public AsyncAbstractResponse
148+
{
145149
private:
146150
const uint8_t * _content;
147151
size_t _readLength;
152+
148153
public:
149154
AsyncProgmemResponse(int code, const String& contentType, const uint8_t * content, size_t len, AwsTemplateProcessor callback=nullptr);
150155
bool _sourceValid() const { return true; }

0 commit comments

Comments
 (0)