Commit Graph

51 Commits

Author SHA1 Message Date
Bob a84f16989a Make regex a define exclusive (#617)
* Change compiler error to runtime error.
Add compiler warining when a ASYNCWEBSERVER_REGEX function is used, but not enabled

* Update docs for usage in Arduino IDE

* Update docs for platform.local.txt
2019-10-14 23:06:38 +03:00
Bob 6a4e2f5329 Support route parameters with regex patterns (#560)
* Fix compile warnings

* first test

* Add regex path

* Add simple example

* add support for esp8266

* Update AsyncJson.h
2019-10-02 14:37:55 +03:00
WallyCZ 9a5be71920 Allow override rewrite match (#391) 2019-06-22 20:27:57 +02:00
Marco Tombesi bde2fce07b arduino json 6 async web server migration (#491)
* arduino json 6 async web server migration

* Update .travis.yml

fix travis error

* Revert "Update .travis.yml"

This reverts commit 37d1bf0e71ad21dc502aa632c1df503820686046.

* gitignore

* test fix travis

* fix travis

* fix proposed in #487

* fix travis

* fix travis

* fix travis

* fix travis

* ARDUINOJSON_5_COMPATIBILITY

* replaced to #if ARDUINOJSON_VERSION_MAJOR == 5

* fix

* added AsyncWebServer::end()

* added AsyncWebServer::end()

* Update WebServer.cpp

fix

* fix typo

* fix typo
2019-06-22 12:20:31 +02:00
me-no-dev 1078e9166b Add option to skip a callback if source data is not yet available 2018-07-15 10:21:21 +02:00
me-no-dev 28cdcf666d Play nice with regular web server on esp32
Include the regular web server first and then the Async in your sketch
2018-07-05 16:05:04 +02:00
Luc 63b5303880 Allow callback when request disconnects (#284)
* Allow callback when request disconnects

* Use typedef std::function<void(void)> ArDisconnectHandler
2017-11-16 19:45:33 +02:00
Alexandr Zarubkin bf2ffdc51c Disabled request body parsing if the handler does nothing. (#266)
* Disabled request body parsing if the handler does nothing. This will save memory and prevent crashes on large POST requests.

Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>

* Marked SPIFFSEditor request handler as non-trivial, as it needs to process POST requests.

Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
2017-11-06 15:48:47 +02:00
Greg Lincoln 46eebddd76 Allow "default" headers to be defined for all responses. (#230)
* Add DefaultHeaders singleton.

* Add documentation for DefaultHeaders.
2017-09-18 13:15:49 +08:00
me-no-dev 75fb9573e8 Make SPIFFSEditor work with other file systems (ESP32) 2017-09-08 13:36:24 +03:00
me-no-dev d37bd16c22 Initial ESP32 compatibility 2017-09-07 22:01:58 +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
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
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 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
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
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 18478e6520 do not compile SSL if disabled 2016-08-26 02:44:20 +03:00
Me No Dev a14e93dd84 Initial SSL Implementation 2016-08-24 22:32:27 +03:00
Me No Dev 7f9bdec0f9 use uint8_t to store WebRequestMethod (#68)
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.
2016-08-19 22:21:08 +03:00
Me No Dev cc38b8d57c fix some methods and add setCode to all responses 2016-07-22 00:03:12 +03:00
Me No Dev d61cc2d130 Implement sending content from progmem
make the example editor run from progmem
2016-07-21 12:25:25 +03:00
Me No Dev 49b6046125 Add Digest Web Authentication and make it default
accept htdigest formatted hashes as well
2016-06-29 16:20:03 +03:00
Me No Dev cdd1ced67a Add EventSource plugin 2016-06-28 21:51:48 +03:00
Me No Dev e5a6999582 add request->redirect(url) 2016-06-26 16:20:21 +03:00
Hagai Shatz afb7dd688a New - rewrite, filters and last-modified (#47)
* 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.
2016-06-25 22:04:06 +03:00
Hagai Shatz b63a86eba8 Performance (#44)
* 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.
2016-06-17 17:42:47 +03:00
Me No Dev dc5b7f708a provide original name so proper content type is set for gzipped content 2016-06-17 02:23:18 +03:00
Me No Dev 3709dd5e14 add ability to send File objects directly
utilize request's tempFile to store a handle to the file to send
use open instead of exists in static handler
2016-06-17 01:43:59 +03:00
Me No Dev 798fcc3c05 rename to _tempObject and give type void * so it can be used for any object/array 2016-06-16 23:24:09 +03:00
Me No Dev 41228cb246 add uint8_t * request->_tempBuffer to be used for storing body data or other request specific stuff 2016-06-16 23:09:58 +03:00
Me No Dev 8d67809acf Add AsyncWebSocket plugin 2016-04-23 15:11:32 +03:00
Me No Dev b1e1450bfb stability improvements for low memory 2016-04-08 17:43:16 +03:00
Me No Dev c05f719f32 fix whatever went wrong the previous time 2016-02-09 02:56:01 +02:00
Me No Dev 3bc54a8071 Revert "Merge pull request #13 from me-no-dev/improved-parsing"
This reverts commit c95ac73753, reversing
changes made to 97c938803c.
2016-02-09 02:32:14 +02:00
Me No Dev 40d5d4415e Rearrange and rename files and add index to chunked responses 2016-02-09 01:47:03 +02:00
Me No Dev f8deeee5bc Make response stream to not require content length
Update the example in ReadMe as well
2016-02-01 03:03:59 +02:00
Andrew Melvin c6b2fa0ad4 fix serving url with no trailing / 2016-01-27 23:42:16 +02:00
Andrew Melvin 9c5d0edf76 Add DEBUGF 2016-01-27 22:16:21 +02:00
Me No Dev 3cdefde295 add chunked to simple sends 2016-01-27 19:55:35 +02:00
Me No Dev 9296156ab5 Add HTTP/1.1 chunked response and allow stream and callback responses to not have content length
ContentLength and ContentType have setters (before you send the
response)
2016-01-27 18:46:49 +02:00
Me No Dev 16012daae6 make response stream e sendable later and the buffer size to be specifiable 2016-01-22 13:36:38 +02:00
Me No Dev c4529f0f99 expose urlDecode to the masses 2016-01-22 12:58:44 +02:00
Me No Dev 41846249ec some more work on outputting as stream from the loop 2016-01-21 10:29:38 +02:00
Me No Dev 6f80e9cbc4 small fixes and rearrangements 2015-12-22 12:42:07 +02:00
Me No Dev 457db5e7f5 better up responses 2015-12-19 20:48:53 +02:00
Me No Dev 3b7054a3dd fix cmpiler complains 2015-12-19 19:50:42 +02:00