diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53bd98b..f0bcf0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,10 +47,12 @@ jobs: - name: Install core run: arduino-cli core install --additional-urls "${{ matrix.index_url }}" ${{ matrix.core }} - - name: Install AsyncTCP-esphome + - name: Install AsyncTCP (ESP32) + if: ${{ matrix.core == 'esp32:esp32' }} run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/AsyncTCP#v3.1.4 - - name: Install ESPAsyncTCP-esphome + - name: Install ESPAsyncTCP (ESP8266) + if: ${{ matrix.core == 'esp8266:esp8266' }} run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/esphome-ESPAsyncTCP#v2.0.0 - name: Build CaptivePortal diff --git a/README.md b/README.md index 9417b44..b4330ac 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Continuous Integration](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml/badge.svg)](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/mathieucarbou/library/ESP%20Async%20WebServer.svg)](https://registry.platformio.org/libraries/mathieucarbou/ESP%20Async%20WebServer) -Asynchronous HTTP and WebSocket Server Library for ESP32. +Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266 Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc. This fork is based on [yubox-node-org/ESPAsyncWebServer](https://github.com/yubox-node-org/ESPAsyncWebServer) and includes all the concurrency fixes. diff --git a/docs/_config.yml b/docs/_config.yml index 532070b..95d65c2 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,7 @@ # bundle exec jekyll serve --host=0.0.0.0 title: ESP Async WebServer -description: "Asynchronous HTTP and WebSocket Server Library for ESP32" +description: "Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266" remote_theme: pages-themes/cayman@v0.2.0 plugins: - jekyll-remote-theme diff --git a/docs/index.md b/docs/index.md index 9417b44..b4330ac 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ [![Continuous Integration](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml/badge.svg)](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/mathieucarbou/library/ESP%20Async%20WebServer.svg)](https://registry.platformio.org/libraries/mathieucarbou/ESP%20Async%20WebServer) -Asynchronous HTTP and WebSocket Server Library for ESP32. +Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266 Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc. This fork is based on [yubox-node-org/ESPAsyncWebServer](https://github.com/yubox-node-org/ESPAsyncWebServer) and includes all the concurrency fixes. diff --git a/library.json b/library.json index 37a8190..acd320c 100644 --- a/library.json +++ b/library.json @@ -1,7 +1,7 @@ { "name": "ESP Async WebServer", "version": "2.10.8", - "description": "Asynchronous HTTP and WebSocket Server Library for ESP32. Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc.", + "description": "Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266. Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc.", "keywords": "http,async,websocket,webserver", "homepage": "https://github.com/mathieucarbou/ESPAsyncWebServer", "repository": { diff --git a/library.properties b/library.properties index be71733..3858af9 100644 --- a/library.properties +++ b/library.properties @@ -2,7 +2,7 @@ name=ESP Async WebServer version=2.10.8 author=Me-No-Dev maintainer=Mathieu Carbou -sentence=Asynchronous HTTP and WebSocket Server Library for ESP32 +sentence=Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266 paragraph=Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc category=Other url=https://github.com/mathieucarbou/ESPAsyncWebServer diff --git a/platformio.ini b/platformio.ini index 1f19720..3d9a732 100644 --- a/platformio.ini +++ b/platformio.ini @@ -4,31 +4,31 @@ build_flags = -Wall -Wextra -D CONFIG_ARDUHAL_LOG_COLORS -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE -lib_deps = - bblanchon/ArduinoJson @ 7.0.4 - mathieucarbou/Async TCP @ ^3.1.4 - ; https://github.com/mathieucarbou/AsyncTCP - ; https://github.com/me-no-dev/AsyncTCP - esphome/ESPAsyncTCP-esphome @ 2.0.0 upload_protocol = esptool monitor_speed = 115200 monitor_filters = esp32_exception_decoder, log2file [platformio] lib_dir = . -src_dir = examples/CaptivePortal +; src_dir = examples/CaptivePortal ; src_dir = examples/SimpleServer -; src_dir = examples/StreamFiles +src_dir = examples/StreamFiles ; src_dir = examples/Filters ; src_dir = examples/Draft [env:arduino] platform = espressif32 board = esp32dev +lib_deps = + bblanchon/ArduinoJson @ 7.0.4 + mathieucarbou/Async TCP @ ^3.1.4 [env:arduino-2] platform = espressif32@6.7.0 board = esp32dev +lib_deps = + bblanchon/ArduinoJson @ 7.0.4 + mathieucarbou/Async TCP @ ^3.1.4 [env:arduino-3] platform = espressif32 @@ -36,6 +36,9 @@ platform_packages= platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1 platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip board = esp32dev +lib_deps = + bblanchon/ArduinoJson @ 7.0.4 + mathieucarbou/Async TCP @ ^3.1.4 [env:esp8266] platform = espressif8266 diff --git a/src/WebHandlers.cpp b/src/WebHandlers.cpp index 0b55b0d..d3d82cd 100644 --- a/src/WebHandlers.cpp +++ b/src/WebHandlers.cpp @@ -206,8 +206,14 @@ void AsyncStaticWebHandler::handleRequest(AsyncWebServerRequest *request) if (request->_tempFile == true) { time_t lw = request->_tempFile.getLastWrite(); // get last file mod time (if supported by FS) - if (lw) setLastModified(gmtime(&lw)); - String etag(lw ? lw : request->_tempFile.size()); // set etag to lastmod timestamp if available, otherwise to size + // set etag to lastmod timestamp if available, otherwise to size + String etag; + if (lw) { + setLastModified(gmtime(&lw)); + etag = String(lw); + } else { + etag = String(request->_tempFile.size()); + } if (_last_modified.length() && _last_modified == request->header(F("If-Modified-Since"))) { request->_tempFile.close(); request->send(304); // Not modified