Commit Graph

134 Commits

Author SHA1 Message Date
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
Me No Dev
b5ba7f542c syntax error in readme 2016-06-25 23:05:16 +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 1621206357, reversing
changes made to a01972c9e5.

* Revert "HTTP 302 and 304 Support"

This reverts commit a01972c9e5.

* 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
Charles
26b2e2532b Added doc for ws.enable and ws.enabled (#33) 2016-05-25 21:13:26 +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
Me No Dev
b64691d4f7 Add known libs and projects that use async web server 2016-05-16 12:25:55 +03:00
Me No Dev
f5a68e3ff4 fix some readme typos 2016-05-15 03:49:38 +03:00
Me No Dev
8917b98332 update readme a bit 2016-05-15 03:42:27 +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
Me No Dev
95a14dbdf2 oops, not familiar with this 2016-05-10 11:47:22 +03:00
Me No Dev
c22033258b add platformio support 2016-05-10 11:40:19 +03:00
Me No Dev
00f40c0608 Merge pull request #25 from hallard/master
avoid client ID being 0
2016-05-06 18:04:40 +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
9d9c2b7bf4 add WebSocket info to readme 2016-04-23 15:47:27 +03:00
Me No Dev
a0d975c157 fix travis build 2016-04-23 15:19:56 +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