Commit Graph

170 Commits

Author SHA1 Message Date
Zhenyu Wu 213387b88f Convert resursive call to iterations, reduce stack usage (#120) 2017-01-22 12:47: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
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 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 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 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
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 46d41ddcd4 Update for ESP32 RTOS SDK 3.0.0 2016-08-02 14:28:21 +03:00
Sergey Anisimov b3db252acb Passing String parameters by const ref. (#57) 2016-07-25 20:07:02 +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 933ac023cb Optimizations 2016-07-14 00:01:34 +03:00
Me No Dev b8ba1c885b Add EventSource::count() 2016-06-30 11:26:20 +03:00
Me No Dev 330027a8de close event gracefully so pending messages get sent as well 2016-06-29 21:44:33 +03:00
Me No Dev acd03d5071 syntax error 2016-06-29 21:26:41 +03:00
Me No Dev 8399f0bcb9 add collection of LastEventId header 2016-06-29 21:21:10 +03:00
Me No Dev a5674fab69 fix onConnect not being called if there are no clients 2016-06-29 20:50:00 +03:00
Me No Dev 0d02922e52 Add onConnect callback to EventSources
usage:
  AsyncEventSource events("/events");
  events.onConnect([](AsyncEventSourceClient *client){
    client->send("Hello!",NULL,0,1000);
  });
  server.addHandler(&events);
  ...
  events.send("boot finished","system");//send "system" event
2016-06-29 19:29:39 +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 dce6d35ad4 close the web socket instead of aborting it
latest ESPAsyncTCP commits are needed for this to properly work
fixing: https://github.com/me-no-dev/ESPAsyncWebServer/issues/48
2016-06-28 13:35:32 +03:00
Me No Dev 082e6e7039 disable some functions on ESP31B 2016-06-28 01:45:43 +03:00
Me No Dev b02d4a03a7 allow last modified to be also set to time_t or current time
to start sntp:
```cpp
void startSNTP(){
  time_t rawtime;
  configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");
  while(time(&rawtime) == 0) delay(10);
}
```
2016-06-28 01:39:35 +03:00
Me No Dev e3e7a5e91e add option to set last modified from struct tm 2016-06-27 20:08:09 +03:00
Me No Dev f8141fcd0e fix warning about setting String to NULL 2016-06-26 16:21:44 +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 11b7bd1d3a Fix bug in AsyncStaticWebHandler (#37)
* 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/");
2016-06-18 19:43:52 +03:00
Me No Dev e46d4d7418 fix broken send of gzipped files 2016-06-18 01:28:36 +03:00
Hagai Shatz 89b19e8cde Bug fix (#45)
* 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");
2016-06-18 00:32:09 +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 5bbc732028 remove Access-Control-Allow-Origin 2016-06-17 17:41:06 +03:00
Clemens Kirchgatterer 78fc89d462 filename quote changed from ' to " (#43)
now for real. :-)
2016-06-17 17:34:38 +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 d8809137a3 fix typos 2016-06-17 01:53:21 +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 16a6016759 fix missed rename 2016-06-16 23:27:01 +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 5ee66e1842 send just the filename in Content-Disposition
Thanks go to: @hagai-shatz
2016-06-16 22:13:02 +03:00
Hagai Shatz a52873b451 Fix path problems in static handler and improve performance. (#41) 2016-06-16 12:52:11 +03:00
Clemens Kirchgatterer f384cd1f76 fix for file download/rendering response (#40)
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.
2016-06-15 18:21:16 +03:00
sticilface ba45a834e9 This handler will serve a 302 response to a client request for a SP… (#36)
*   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
2016-06-10 10:46:12 +03:00
Me No Dev bda2cd637a add WebSocket auto-ping option and fix pcb not being released properly on disconnect 2016-05-28 03:50:38 +03:00
Me No Dev 2b501e74a7 add method to disable new connections to a WebSocket instance 2016-05-25 19:48:04 +03:00
Me No Dev 8171edd7e1 attempt fix on some edge cases
attempt to fix a case where \r can be missed and post not parsed
correctly
2016-05-20 00:55:20 +03:00
Charles 29b3f72e80 Added printf_P method (#31)
* 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
2016-05-15 03:00:33 +03:00
Me No Dev 937d442fce urlDecode the GET path 2016-05-13 00:41:21 +03:00
Me No Dev 7cb06b1bb1 fix typo 2016-05-13 00:19:50 +03:00
Me No Dev ffa893f770 Atempt at fixing large uploads
Fixing: https://github.com/me-no-dev/ESPAsyncWebServer/issues/29
2016-05-13 00:01:42 +03:00
Charles 1d275900eb Prevent Buffer Overflow and Added FlashStringHelper for text and binary (#26)
* 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
2016-05-12 15:17:35 +03:00
Charles b1492fc213 avoid client ID being 0
Prevent having clientID set to 0
When managing an array of different clientID, it's preferable to a valid
client not having it's ID set to 0
2016-05-06 16:54:15 +02:00
Me No Dev 8dfd328627 quiet debug and add access to the AsyncClient and it's IP/Port 2016-05-03 04:49:51 +03:00
Me No Dev 060183974c return json object by default 2016-05-03 03:59:49 +03:00
Me No Dev d74a84455f AsyncJson: add option to init with root as json array
ref: https://github.com/bblanchon/ArduinoJson/issues/272
2016-05-02 19:54:37 +03:00
Me No Dev 59732a09bd add proper credits 2016-04-23 17:20:51 +03:00
Me No Dev 3c3f38e6f6 fix printf eating the last charecter 2016-04-23 16:11:57 +03:00
Me No Dev 8d67809acf Add AsyncWebSocket plugin 2016-04-23 15:11:32 +03:00
Me No Dev d65e4bd4e5 collect all headers for the default handler 2016-04-20 22:26:19 +03:00
Me No Dev c45b4002e5 fix leaked response if source is invalid 2016-04-11 21:42:37 +03:00
Me No Dev b1e1450bfb stability improvements for low memory 2016-04-08 17:43:16 +03:00
Me No Dev ced8ac1c4c Send as much as possible from the response with the headers
related to: https://github.com/me-no-dev/ESPAsyncWebServer/issues/15
2016-04-08 14:55:41 +03:00
andig 9a291c876c Gracefully handle out of memory 2016-04-07 12:39:07 +02:00
Me No Dev e871a222fc clean onError 2016-04-05 11:22:23 +03:00
Hopperpop 046716556e Fix buffer overflow in authenticate. 2016-03-18 22:34:18 +01: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
Me No Dev 729b9c223e Make ResponseStream resize when needed and actually work 2016-02-01 01:42:45 +02:00
Me No Dev b84fc1c976 fix chunked output 2016-02-01 01:08:33 +02:00
Me No Dev 9e79985575 ReadMe update 2016-01-31 17:15:23 +02:00
Me No Dev 3bce374c16 the destructor was not defined 2016-01-28 20:57:22 +02:00
Andrew Melvin fe49272cae Oops 2016-01-28 20:47:55 +02:00
Andrew Melvin 45b74f0cb6 fix return in skip
make setLength void
make destructor virtual
2016-01-28 20:31:56 +02:00
Andrew Melvin d9234dbc9c rename to AsyncJson.h from ESPasyncJson.h 2016-01-28 18:49:55 +02:00
Andrew Melvin cacf3b0c49 Add header to extend server for arduinojson 2016-01-28 18:34:27 +02:00
Andrew Melvin 09ed9271a2 Check if file exists before returning canHandle true for serveStatic 2016-01-28 00:06:08 +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
Andrew Melvin 1ffa6fb8e9 Merge branch 'master' into fix-serveStatic
Conflicts:
	src/AsyncWebServerHandlerImpl.h
2016-01-27 22:01:05 +02:00
Andrew Melvin d67ca5cbda fix serveStatic to map paths correctly 2016-01-27 21:59:27 +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 36b64df702 change to support new cbuf api 2016-01-27 16:17:34 +02:00
Me No Dev 8fed4c42f3 return if called from interrupt 2016-01-26 17:52:49 +02:00
Me No Dev 154ac0060f oops again 2016-01-23 19:08:28 +02:00