Specifically: "warning: comparison between signed and unsigned integer
expressions". Make `i` the same type as `len`, which it is frequently
compared to.
* Removed unnecessary memmove from chunked response generation.
* Added simple template processor to AsyncFileResponse.
Unzipped files in SPIFFS, Streams, PROGMEM strings, callback/chunked responses may have template placeholders like %TEMPLATE_VAR% inside. If callback is specified in Async...Response constructor call, it will be used to replace these with actual strings.
The prototype of callback is String(const String&), i.e. it gets variable name and returns its value.
Template variables' delimiter is currently percent sign ('%').
Maximal placeholder length is 32 chars (chosen somewhat arbitrarily, it may be stored on stack during processing). It is not guaranteed that placeholders longer than that will be processed.
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
- Added "SAVE-Button
- Upgraded to ACE 1.2.6
- Added additional field, which shows name of the current edited File
- Reset upload path after uploading or creating a File (avoid confusion about which file is shown in editor)
- added the possibility, to run the editor completly from flash. When ace.js.gz or ace.js and the corresponding files are found on SPIFFS, the editor can be used in AP mode also. Otherwise the files are searched on cloudflare like before.
- added all gzipped js-files in data directory
- added an exclude list, containing wildcards, telling which files should not be listed in the editor (to prevent deletion of needed files)
- minified the embedded HTML/Javascript with https://kangax.github.io/html-minifier/ before gzipping. With all additions the resulting hex-code is now 700 bytes smaller
- embedded the plain html as documentation
Unzipped files in SPIFFS, Streams, PROGMEM strings, callback/chunked responses may have template placeholders like %TEMPLATE_VAR% inside. If callback is specified in Async...Response constructor call, it will be used to replace these with actual strings.
The prototype of callback is String(const String&), i.e. it gets variable name and returns its value.
Template variables' delimiter is currently percent sign ('%').
Maximal placeholder length is 32 chars (chosen somewhat arbitrarily, it may be stored on stack during processing). It is not guaranteed that placeholders longer than that will be processed.
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
# Conflicts:
# src/WebResponses.cpp
AsyncWebHandler::setAuthentication: return is required.
AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage: error: enumeral and non-enumeral type in conditional expression.
* Add support for a MultiMessage where the buffer is shared between WS messages to multiple clients.
Add ability to create a WS buffer directly and write to it, saving duplication of message in RAM, then send it. example below is an arduinoJson message.
```cpp
void sendDataWs(AsyncWebSocketClient * client)
{
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["a"] = "abc";
root["b"] = "abcd";
root["c"] = "abcde";
root["d"] = "abcdef";
root["e"] = "abcdefg";
size_t len = root.measureLength();
AsyncWebSocketMessageBuffer * buffer = ws.makeBuffer(len); // creates a buffer (len + 1) for you.
if (buffer) {
root.printTo((char *)buffer->get(), len + 1);
if (client) {
client->text(buffer);
} else {
ws.textAll(buffer);
}
}
}
```
* Add example to readme.
* using Container instead ofdirect pointers list manipulation
* fixed different type of virtual methods.
* Fixed typo in conditional
* Renamed ListArray to LinkedList
* Const reference to String as method parameters to prevent additional copy and memory allocation when String passed by value
* fix 'min' redefinition
* removed #include <iterator>
begin/end methods it's enough for 'for( : )' loop
count() renamed to length()
spacing fixing
* Const reference to String as method parameters to prevent additional copy and memory allocation when String passed by value
* Fixed unused params warnings
* Reset all handlers. This allowing to use same server few times during app life.
E.g. for WiFi manager when hardware sepups WiFi connection and as HTTP server during hardware life cycle
so we can have server.on("/foo", HTTP_GET | HTTP_POST,
[](AsyncWebServerRequest *request) {}) to handle multiple methods.
this also saves a bit memory, enums are stored in int, which is 32bit on
xtensa. since we only have 7 methods (plus HTTP_ANY for everything) we
only want 7 bit, so uint8_t is pretty sufficient.
* New - server.rewirte() to rewrite the request url with optional get parameters injection.
New - rewrite.setFilter() and handler.setFilter() to specify a filter callback for more control on when to include them.
New - static file handler can be set with Last-Modified header value to support Not-Modified (304) response instead of serving the actual file.
* Remove clearRewrites & clearHandlers from server.mplement server distractor to delete internal members. Fixed and improved gzip stats calculation.
* HTTP 302 and 304 Support
Add support for http redirection (302) and http not modified (304) to
reduce the load the server.
server.redirect(“url”, “location”, exclude-ip) will respond with 302 to
redirect the browser to a different url, this is useful for backward
compatibility and to redirect call to CDN when not no AP mode.
server.serveStatic has a new optional parameter to get the
Last-Modified date for all files serve for this location, when the
browser request have the same If-Modified-Since header value, the
server respond with 304 code instead of serving the file.
* Fix path problems in static handler and improve performance.
* Revert "Merge remote-tracking branch 'me-no-dev/master'"
This reverts commit 1621206357843b5de0272fe4579387af3011e656, reversing
changes made to a01972c9e569967dd3d761c364066518b4901e46.
* Revert "HTTP 302 and 304 Support"
This reverts commit a01972c9e569967dd3d761c364066518b4901e46.
* Sync with me-no-dev/master
* Fix AsyncStaticWebHandler
Fix ambiguity of serving file or directory.
The following options will all have the same outcome, the last two will
server the default file ‘index.htm’ faster:
server.serveStatic("/fs", SPIFFS, "/web");
server.serveStatic("/fs/", SPIFFS, "/web");
server.serveStatic("/fs", SPIFFS, "/web/");
server.serveStatic("/fs/", SPIFFS, "/web/");
* HTTP 302 and 304 Support
Add support for http redirection (302) and http not modified (304) to
reduce the load the server.
server.redirect(“url”, “location”, exclude-ip) will respond with 302 to
redirect the browser to a different url, this is useful for backward
compatibility and to redirect call to CDN when not no AP mode.
server.serveStatic has a new optional parameter to get the
Last-Modified date for all files serve for this location, when the
browser request have the same If-Modified-Since header value, the
server respond with 304 code instead of serving the file.
* First round of performance improvements.
* Merge remote-tracking branch 'me-no-dev/master' into performance
# Conflicts:
# src/WebHandlerImpl.h
# src/WebHandlers.cpp
* use of sprintf
* Remove sections not related.
* Fix a bug to serve a file in directory (e.g. serverStatic("/", SPIFFS, "/index.html");
* HTTP 302 and 304 Support
Add support for http redirection (302) and http not modified (304) to
reduce the load the server.
server.redirect(“url”, “location”, exclude-ip) will respond with 302 to
redirect the browser to a different url, this is useful for backward
compatibility and to redirect call to CDN when not no AP mode.
server.serveStatic has a new optional parameter to get the
Last-Modified date for all files serve for this location, when the
browser request have the same If-Modified-Since header value, the
server respond with 304 code instead of serving the file.
* First round of performance improvements.
* Merge remote-tracking branch 'me-no-dev/master' into performance
# Conflicts:
# src/WebHandlerImpl.h
# src/WebHandlers.cpp
* use of sprintf
* Remove sections not related.
tested with chromium and firefox and all content types i had handy.
chrome and firefox render all files inline, if they can. chrome downloads files when asked to download, firefox opens a download dialog.
* This handler will serve a 302 response to a client request for a SPIFFS file if the request comes from the STA side of the ESP network.
If the request comes from the AP side then it serves the file from SPIFFS.
* corrections. plus readme
* Update README.md
extra space
* move wifi to cpp
* Prevent buffer overflow on received data
* pass to 7 char to avoid save to flash by SDK
* return _contentLength, avoid array reparse to know len
* Added FlashStringHelper for text and binary
* Added FlashStringHelper also to AsyncWebSocketClient
* Added PROGMEM doc
* Corrected binary was sending PSTR as text, addded len
* Server calls client method and code as asked @me-no-dev
* server calls client method and code as asked by @me-no-dev
* Changed Code presentation
* Added printf_P methods
* Prevent buffer overflow on received data
* pass to 7 char to avoid save to flash by SDK
* return _contentLength, avoid array reparse to know len
* Added FlashStringHelper for text and binary
* Added FlashStringHelper also to AsyncWebSocketClient
* Added PROGMEM doc
* Corrected binary was sending PSTR as text, addded len
* Server calls client method and code as asked @me-no-dev
* server calls client method and code as asked by @me-no-dev
* Changed Code presentation