Commit Graph

202 Commits

Author SHA1 Message Date
Pablo Clemente Maseda 2f784268f0
Redefine DYNAMIC_JSON_DOCUMENT_SIZE if not defined (#922) 2021-02-25 00:03:28 +02:00
Viktr f6fff3f91e
URL template match by extension (#751)
Changes to be committed:
modified:   src/WebHandlerImpl.h
2020-11-15 19:21:19 +02:00
Me No Dev 241aca38a0
Fix authentication for callback web handlers 2020-11-05 20:54:31 +02:00
Arjan Filius f13685ee97 AsyncEvents/ServerSideEvents: prevent internal DOS by prevent overflowing messageQueue (#621)
* Prevent tcp/wifi DOS lockup by preventing number of messages in queue, drop otherwise

* Define (renamed) MAX_SSE_Clients
2019-10-17 10:05:13 +03:00
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
Develo f3ebe2dea9 Remove warnings for unused params (#620) 2019-10-14 11:30:06 +03:00
Bob 75acf88d5f Add support for Content-Type with charset (#561) 2019-10-06 11:11:51 +03:00
Phil Bowles 01019542c2 Add methods to determine Average Queue length (#509)
* Add methods to determine Average Queue length
2019-10-02 15:33:18 +03:00
SharkSharp 4a34b46cc0 make the query parameters available by passing the request to WS_EVT_CONNECT (#559)
Signed-off-by: Arthur Frederico Neves <arthurfred.neves@gmail.com>
2019-10-02 15:16:35 +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
sascha lammers 403752a942 Added method to access clients of AsyncWebSocket (#583)
* Added method to access clients of AsyncWebSocket

* https://github.com/me-no-dev/ESPAsyncWebServer/issues/571

* Conflict with crypto library
2019-10-02 14:16:43 +03:00
Mike Dunston c7ece88eac Update AsyncJson.h (#604)
remove extra #endif that should have been dropped as part of 59066bd1e4
2019-10-02 13:27:29 +03:00
CODeRUS e88fc12de8 Make PrettyAsyncJsonResponse to use maxJsonBufferSize for ArduinoJson 6 (#607) 2019-10-02 12:26:01 +03:00
matt123p 2f37037029 Add function so that the total number of web-socket clients can be limited (#591)
* Add function so that the total number of web-socket clients can be limited easily.  This is to cope with a problem when a browser does not close the web-socket connection correctly.  I have observed this on Chromium based browsers.  The memory leak will eventually lead to the server crashing.  Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.

* Prevent an assertion failure when using WebSockets

Frequently when using Web Sockets you will get the assert failure:
    	assertion "new_rcv_ann_wnd <= 0xffff" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/tcp.c", line 779, function: tcp_update_rcv_ann_wnd

This will happen particulary when you close the browser window.  This change
prevents the issue from occuring.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.

* Add function so that the total number of web-socket clients can be limited easily.  This is to cope with a problem when a browser does not close the web-socket connection correctly.  I have observed this on Chromium based browsers.  The memory leak will eventually lead to the server crashing.  Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.

* Set the default number of ws clients dependent on processor.
2019-09-24 22:42:40 +03:00
Mike Dunston 59066bd1e4 PrettyAsyncJsonResponse for ArduinoJson 6.x (#539)
* PrettyAsyncJsonResponse for ArduinoJson 6.x

add support for PrettyAsyncJsonResponse in ArduinoJson 6.x

* Update AsyncJson.h

Maintain order of args to AsyncJsonResponse between ArduinoJson 5.x and 6.x compatibility for ease of migration
2019-09-24 21:24:18 +03:00
ray 7c6118f2a0 arg should be closed by va_end() (#601) 2019-09-22 08:58:15 +03:00
matt123p 5ea49e313d Prevent an assertion failure when using WebSockets (#584)
Frequently when using Web Sockets you will get the assert failure:
    	assertion "new_rcv_ann_wnd <= 0xffff" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/tcp.c", line 779, function: tcp_update_rcv_ann_wnd

This will happen particulary when you close the browser window.  This change
prevents the issue from occuring.
2019-09-21 13:27:34 +03:00
matt123p aea43f98d1 Add thread locking to improve stability. (#585)
* Add thread locking to improve stability.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.
2019-09-12 19:56:13 +03:00
Marco Tombesi b0c6144886 Update AsyncJson.h (#533)
for the newest ArduinoJson v6 compatibility
2019-06-24 17:27:35 +02:00
Germán Martín b3b9ec901a Fix sha1 not defined compilation error (#531) 2019-06-23 06:58:25 +02:00
WallyCZ 9a5be71920 Allow override rewrite match (#391) 2019-06-22 20:27:57 +02:00
Luc 736a54af1a Allows to check queue status (#411) 2019-06-22 18:51:01 +02:00
dyarkovoy 5ef7ffcd41 Detect if AsyncWebSocketClient can send data to server and add AsyncWebServer::end() (#501)
* added AsyncWebServer::end()

* added AsyncWebServer::end()

* added bool AsyncWebSocketClient::canSend()

* Fix comparison with WS_MAX_QUEUED_MESSAGES

* Fix comparison with WS_MAX_QUEUED_MESSAGES
2019-06-22 18:47:43 +02:00
rjlexx 6dcea3f5e7 Add handlers by URL templates (#380)
* Add handlers by URL templates

This change allows add handlers by URL templates. 
For example:
server.on("/gpio*", handleGpio);
server.on("/irsend*", handleIrsend);
The "handleGpio" handler will handle all requests starting with "/gpio" and manage all GPIOs.
The "handleGpio" handler will handle all requests starting with "/irsend" and forward commands to IR manager.

* String::replace method changed to String::substring() method
2019-06-22 18:28:24 +02:00
Gérald Guiony 781bddf20c json response is more human readable with PrettyAsyncJsonResponse class (#398)
* Update AsyncJson.h

Adding PrettyAsyncJsonResponse class

* Update AsyncJson.h

* Adding a PrettyAsyncJsonResponse class

json response is more human readable than with AsyncJsonResponse
2019-06-22 18:24:01 +02:00
buddydvd d55dd73e44 Fix compiler warnings for AsyncJson’s _contentLength/_maxContentLength vars (#439)
The type of _contentLength and _maxContentLength should both be unsigned
integer type size_t.
2019-06-22 18:12:53 +02:00
buddydvd fbe191d4f0 Add header ESPAsyncWebServer.h to AsyncJson.h (#440)
This allows us to include `AsyncJson.h` in other
code without the need to first include
`ESPAsyncWebServer.h`.
2019-06-22 18:11:32 +02:00
kaegi 78fe403dda adjust canHandle() for AsyncEventSource (#474) 2019-06-22 17:59:46 +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
Merlin Schumacher 95dedf7a2d Corrected datatype für JSON_MIMETYPE (#396)
* Change JSON MIME type to application/json

* Corrected datatype für JSON_MIMETYPE (Fixes #390)
2018-12-02 18:12:46 +01:00
me-no-dev bed4146ec6 add limit to how many messages can be queued for each web socket client 2018-08-18 21:10:39 +02:00
me-no-dev 4c621f340c improve web socket rapid sends a bit
to fully fix any possible issues, ws should use FreeRTOS Queues on ESP32
2018-08-15 23:55:03 +02:00
Arsène von Wyss d7399a7664 Added handler for correct JSON deserialization, addresses #195 (#287)
* Added handler for correct JSON deserialization (even with multiple body data writes), addresses #195

* Fixed typo

* Added JSON handler example to readme

* Moved Json Handler uri parameter to constructor

* Use request->_tempObject for JSON char data buffer

* Moved onRequest to constructor in JSON async handler
2018-07-24 20:56:05 +02:00
Alexandr Zarubkin fc66fae6a9 Allow to override default template placeholder value with #define during compilation. (#366)
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
2018-07-24 20:26:46 +02:00
Chris Byrne b6b43d35fa Handle multiple WebSocket frames within a TCP packet (#338) 2018-07-24 20:22:54 +02:00
Carlos Ruiz 69865879b4 Fix bug in const String& AsyncWebServerRequest::arg(const __FlashStringHelper * data) const (#334)
Fixes crash in AsyncWebServerRequest::arg with flash string param (eg: `request->arg(F("<arg name>"))` crashes). Solution is to call `strcpy_P` instead of `strcpy`, since the variable `p` is of type `PGM_P` and not `char *`.
2018-07-24 20:21:33 +02:00
Merlin Schumacher fc71230a31 Change JSON MIME type to application/json (#311) 2018-07-24 20:13:14 +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
me-no-dev decdca5a73 git went crazy 2018-07-05 11:07:47 +02:00
me-no-dev b0f06c4dbc Merge branch 'master' of https://github.com/me-no-dev/ESPAsyncWebServer 2018-07-05 11:07:05 +02:00
me-no-dev b63ed5d93f fix wrong buffer length in web socket reserve 2018-07-05 11:06:51 +02:00
copercini 44d95ae127 Disable Nagle Algorithm by default (#335)
This speed up the response in up to 10 times
2018-03-10 17:49:31 +01: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
Hermann Kraus 8604f67a5f Add documentation for AwsFrameInfo. (#240) 2017-11-06 15:58:07 +02:00
Hermann Kraus c8c1784395 Expose _server and _pinfo members from AsyncWebSocketClient. (#242) 2017-11-06 15:55:58 +02:00
Qc 64adf2972d Update AsyncWebSocket.cpp (#247) 2017-11-06 15:54:49 +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
Alexandr Zarubkin 8139925eb9 Fixed templating engine bug. (#267)
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
2017-11-06 15:47:45 +02:00
omersiar d366e7c539 This re-enables previously removed WebSocket authentication which is … (#272)
* This re-enables previously removed WebSocket authentication which is orginaly implemented PR #143

* Update README.md
2017-10-30 09:43:31 +01:00