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

Commit 8dc7caf

Browse files
authored
v1.6.1 to add demo sending in chunks
#### Releases v1.6.1 1. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks 2. Use `allman astyle` and add `utils`
1 parent f2729d6 commit 8dc7caf

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -892,58 +892,58 @@ Rewrite for example "/radio/{frequence}" -> "/radio?f={frequence}"
892892
class OneParamRewrite : public AsyncWebRewrite
893893
{
894894
protected:
895-
895+
896896
String _urlPrefix;
897897
int _paramIndex;
898898
String _paramsBackup;
899899

900900
public:
901-
902-
OneParamRewrite(const char* from, const char* to)
903-
: AsyncWebRewrite(from, to)
901+
902+
OneParamRewrite(const char* from, const char* to)
903+
: AsyncWebRewrite(from, to)
904904
{
905905

906-
_paramIndex = _from.indexOf('{');
907-
908-
if ( _paramIndex >=0 && _from.endsWith("}"))
909-
{
910-
_urlPrefix = _from.substring(0, _paramIndex);
911-
int index = _params.indexOf('{');
912-
913-
if (index >= 0)
914-
{
915-
_params = _params.substring(0, index);
916-
}
917-
}
918-
else
919-
{
920-
_urlPrefix = _from;
921-
}
922-
923-
_paramsBackup = _params;
924-
}
906+
_paramIndex = _from.indexOf('{');
925907

926-
bool match(AsyncWebServerRequest *request) override
927-
{
928-
if (request->url().startsWith(_urlPrefix))
929-
{
930-
if (_paramIndex >= 0)
908+
if ( _paramIndex >= 0 && _from.endsWith("}"))
931909
{
932-
_params = _paramsBackup + request->url().substring(_paramIndex);
933-
}
934-
else
910+
_urlPrefix = _from.substring(0, _paramIndex);
911+
int index = _params.indexOf('{');
912+
913+
if (index >= 0)
914+
{
915+
_params = _params.substring(0, index);
916+
}
917+
}
918+
else
935919
{
936-
_params = _paramsBackup;
920+
_urlPrefix = _from;
937921
}
938-
939-
return true;
940922

941-
}
942-
else
923+
_paramsBackup = _params;
924+
}
925+
926+
bool match(AsyncWebServerRequest *request) override
943927
{
944-
return false;
928+
if (request->url().startsWith(_urlPrefix))
929+
{
930+
if (_paramIndex >= 0)
931+
{
932+
_params = _paramsBackup + request->url().substring(_paramIndex);
933+
}
934+
else
935+
{
936+
_params = _paramsBackup;
937+
}
938+
939+
return true;
940+
941+
}
942+
else
943+
{
944+
return false;
945+
}
945946
}
946-
}
947947
};
948948
```
949949
@@ -2054,7 +2054,7 @@ AsyncWebServer is @ IP : 192.168.2.124
20542054
You can access the Async_AdvancedWebServer_SendChunked at the displayed server IP, e.g. `192.168.2.123`
20552055

20562056
<p align="center">
2057-
<img src="https://github.com/khoih-prog/AsyncWebServer_STM32/raw/main/pics/AsyncWebServer_SendChunked.png">
2057+
<img src="https://github.com/khoih-prog/AsyncWebServer_STM32/raw/master/pics/AsyncWebServer_SendChunked.png">
20582058
</p>
20592059

20602060

@@ -2145,7 +2145,7 @@ Submit issues to: [AsyncWebServer_STM32 issues](https://github.com/khoih-prog/As
21452145
8. Fix issue with slow browsers or network
21462146
9. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
21472147
10. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8)
2148-
11. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/main/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/main/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks
2148+
11. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks
21492149
12. Use `allman astyle` and add `utils`
21502150

21512151

changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
## Changelog
3737

38-
#### Release v1.6.1
38+
#### Releases v1.6.1
3939

40-
1. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/main/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/main/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks
40+
1. Add examples [Async_AdvancedWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/Async_AdvancedWebServer_SendChunked) and [AsyncWebServer_SendChunked](https://github.com/khoih-prog/AsyncWebServer_STM32/tree/master/examples/AsyncWebServer_SendChunked) to demo how to use `beginChunkedResponse()` to send large `html` in chunks
4141
2. Use `allman astyle` and add `utils`
4242

4343
### Releases v1.6.0

0 commit comments

Comments
 (0)