Commit Graph

307 Commits

Author SHA1 Message Date
Alexandr Zarubkin e6c432e563 Something got lost during pull request #189. Fixes #211, updates documentation. (#213)
* 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>
2017-08-31 19:44:23 +03:00
Me No Dev 2540507664 The following changes and enhancements are included: (#208)
- 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
2017-08-18 20:14:12 +03:00
Alexandr Zarubkin 0179c17cf9 Added simple template processor to AsyncFileResponse. (#189)
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
2017-08-18 17:59:06 +03:00
Me No Dev 77a520ba24 This commit solves issues 172 and 198 (#207)
* This commit solves issues 172 and 198

* This commit solves issues 172 and 198
2017-08-18 17:52:21 +03:00
Me No Dev 05ed854d7b Update SPIFFSEditor.cpp
Fix URL Encode logic
2017-08-18 17:41:31 +03:00
Alexandr Zarubkin 4dcd458d13 Removed unnecessary memmove from chunked response generation. (#188) 2017-08-18 11:54:52 +03:00
Mariusz Kryński 3d0cf89d58 Fix url decoding in POST / GET requests (#185) 2017-08-18 11:53:57 +03:00
probonopd 2e6dff35bd Allow for double quotes in boundary, closes #191 (#192)
https://tools.ietf.org/html/rfc2046#section-5.1.1
2017-08-17 20:17:21 +03:00
omersiar a94265d72f Add another project that uses AsyncWebServer (#184)
Project features

- JSON object exchenged between server and browser
- Websocket
- Async Wi-Fi Scan
- SPIFFS
- Javascript
2017-06-22 12:03:16 +02:00
omersiar e56e1a6370 Bug Fix for #175 and #167 (#182)
Prevent double MD5 hashing
2017-06-21 12:37:19 +02:00
Jej 9bfd52529a Cache-Control header value needs = separator (not : ) (#180)
As specified here https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 the separator for Cache-Control header values is =
2017-06-21 12:36:15 +02:00
Trygve Laugstøl be12e0c171 Fixing compiler warnings exposed with -Wall and -Wextra: (#159)
AsyncWebHandler::setAuthentication: return is required.
AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage: error: enumeral and non-enumeral type in conditional expression.
2017-04-20 11:14:00 +03:00
Trygve Laugstøl 2c4128c7cd Minor cleanup of AsyncWebServer, removing unneeded casts. (#156) 2017-04-10 17:10:02 +03:00
Alexandr Zarubkin ab61227a8a The previous event need not be ACKed to send the next one (it will be queued). (#149)
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
2017-04-06 10:11:48 +02:00
Charles 120984e6d2 Added getSize() to know JSON buffer size (#151)
* Added doc for ws.enable and ws.enabled

* added getSize()
2017-04-06 10:10:59 +02:00
probonopd 09dde693ba Solve error "previous definition of 'class fs::File'" (#147)
As per https://github.com/me-no-dev/ESPAsyncWebServer/issues/111#issuecomment-288265916 by @boblemaire
2017-03-22 10:23:37 +01:00
sticilface 1b35f15ec2 Web Sockets memory improvements : shared message buffer, direct buffer access (#144)
* 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.
2017-03-14 14:55:39 +01:00
sticilface b9641902bf Events Source Message Queue (#129)
* Events Source Message Queue
 - Fixes problem where events sent close together are silently dropped.

* Update AsyncEventSource.cpp

error
2017-03-11 09:57:37 +01:00
Zhenyu Wu fce6aad2c3 Remove Rx timeout constraint in the request response stage, fix premature connection termination (#121) 2017-03-05 20:15:25 +02:00
sticilface edf6c75f8c Fix memory leak in __flashString Web sockets implementation. (#136) 2017-03-05 20:07:17 +02:00
sticilface 3afc669f10 Flash String support (#137)
* Flash String support

* use strlen_P and strcpy_p
2017-03-05 20:06:57 +02:00
Tuan PM 9b66da2c92 Add basic auth for server static (#143)
* Add basic auth for server static

* Also effect to Websocket

* Add http basic auth for event source & document to README.md
2017-03-05 20:02:33 +02:00
Me No Dev bab5457584 Fix case where space is not enough for a chunk 2017-01-25 21:25:21 +02:00
Zhenyu Wu 213387b88f Convert resursive call to iterations, reduce stack usage (#120) 2017-01-22 12:47:21 +02:00
hreintke 1d66bbfc77 Adding example of global & class functions for request handler (#107)
* Adding example of global & class functions for request handler

* Make title the same as the one in the table of contents
2016-12-14 03:34:21 +02:00
Luc 5159d8b845 Fix #76 Problem uploading multiple files (#104) 2016-11-29 23:12:52 +02:00
Sakari Kapanen ea7b76b0ee Fix const correctness of _sourceValid (#100) 2016-11-28 22:00:33 +02:00
Me No Dev 9bdf7c42b4 Add Tinkerman (Xose Pérez) projects to README 2016-11-27 17:58:30 +02:00
Max Lunin a7c4dfb04f Template container instead of direct pointer manipulation. (#95)
* 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
2016-11-27 17:42:09 +02:00
me-no-dev 3e6e890808 fix indentation 2016-11-21 17:44:46 +02:00
me-no-dev 3cfb65f04d regenerate proper links 2016-11-21 17:41:34 +02:00
me-no-dev 5f062c7bc3 remove toc for now 2016-11-21 17:16:31 +02:00
Me No Dev 934937bcb4 Update README.md 2016-11-17 02:01:52 +02:00
me-no-dev 41c57bcdd1 add size to returned file data 2016-11-17 01:33:50 +02:00
Max Lunin 3eb639b027 Reset all handlers. This allowing to use same server few times (#93)
* 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
2016-11-17 01:16:58 +02:00
Me No Dev 03c61fab43 Update README.md
Add example how to scan WiFi Asynchronously
2016-11-05 12:35:58 +02:00
Me No Dev 49d5a24815 fix Digest authentication for IE 2016-10-18 16:30:14 +03:00
me-no-dev 0adc36b1f6 fix mistake 2016-09-23 21:56:28 +03:00
me-no-dev 1fd73a9262 disable timeout for web sockets and event source 2016-09-23 21:44:52 +03:00
me-no-dev a39051a2d5 Add SPIFFSEditor to the library 2016-09-23 15:11:50 +03:00
me-no-dev d935b1d740 close the file if left open and add timeout to clients 2016-09-23 13:48:35 +03:00
me-no-dev c2de999f03 fix broken uploads 2016-09-03 23:30:14 +03:00
Me No Dev b6c9ebd9e6 make headers work with ignoreCase
Connected to: https://github.com/me-no-dev/ESPAsyncWebServer/issues/64
Eliminates: https://github.com/me-no-dev/ESPAsyncWebServer/pull/70
2016-09-02 13:52:32 +03:00
Me No Dev 85cec3e543 Update example with new editor 2016-08-27 17:32:51 +03:00
Me No Dev 18478e6520 do not compile SSL if disabled 2016-08-26 02:44:20 +03:00
Me No Dev 9ae9976b05 return 304 if file uses cache and size has not changed 2016-08-25 22:29:27 +03:00
Me No Dev 1163808495 add some mime types and a commented implementation of etag for cache 2016-08-25 22:15:17 +03:00
Me No Dev a14e93dd84 Initial SSL Implementation 2016-08-24 22:32:27 +03:00
Me No Dev dab3077f2b pointless 2016-08-23 08:02:04 +03:00
Me No Dev 7110758b5a optimizations 2016-08-23 03:10:45 +03:00