-
Notifications
You must be signed in to change notification settings - Fork 51
streamFile and serveStatic for ESP8266/ESP32 boards #22
Conversation
Used bufferization.
modified namespace to mime_esp to avoid conflicts with existing mimetable.h file
Added check to RequestHandlersImpl.h to include the code only on ESP8266 and ESP32 platforms.
…platforms On other platforms relevant code breaks, so it will be included only if ESP platforms is detected.
Thanks for your good efforts. I'll have a more detailed look at the new PR within several days. BTW, could you also provide the example code the test the new ESP streamFile feature to save me some time to write it to verify? I'll include it in the examples, with your credit, if the PR OK to be merged later. |
Done with the example sketch. |
Wow, you've spent a lot of time on the code. I just had a preliminary look and test compiled the simplest example AdvancedWebServer and still there are many compiler errors 1. For boards different from ESP8288/ESP32, this is simple to fix by not using
|
Still having issue with ESP32.
|
Fix now by comment out
Pls update the PR. |
The example serveStatic, I think, is written for ESP32 and deprecated SPIFFS. I'll rewrite to include LittleFS for both ESP32 and ESP8266, also remove all unnecessary #defines. |
Made all suggested changes except for cencode.h which was not necessary. Tested by compiling AdvancedWebServer for SAMD and ESP boards without errors. Feel free editing the example file. After all it will be a good example for LittleFS as well. |
On ESP8266 I am getting different error: AdvancedWebServer:183:14: error: 'class EthernetClass' has no member named 'init' I am using Arduino IDE 1.8.14, ESP8266 core 2.7.4. |
I tested the previous error - I am getting it even with the original code on ESP8266. |
Everything is OK here now. You have to check your settings / installation I'm writing an example to permit you to upload the files (e.g. page1, etc.) into LittleFS/SPIFFS so that you can use with the staticServe example. Already working, will ready for next release, with your example and PR. Also more complicated FS_EthernetWebServer example with Web editor. Still have to test everything to see where else it breaks. |
The ESP8266 compile result (IDE v1.8.13, ESP8266 core 2.7.4)
|
Ah ! Remember now. You have to rename the file Ethernet.h to Ethernet_8266.h in ./hardware/esp8266com/esp8266/libraries/Ethernet directory. I think I forget to mention in the README about this to avoid conflict. |
You mentioned it in defines.h for example sketches but it is in the middle of define statements and looks like something optional :) I think mentioning it in readme will be better. |
OK, here it is. Will include in README later.
|
Updated encode.c and cdecode.c files. And thank you for the great example, it looks gorgeous! |
I think everything is ready to merge the PR now, but I'd still like to have more compiling and testing to be sure no more issue before making final decision to merge. Can you help compile and test as many as you can, on whatever board you can? With your quick decision and good knowledge, I wish later you can help maintain this library. I'll post the new example code for you to test as well. Almost done. |
No rush, let's test throroughly. |
I just post the first 2 examples Can you test, then update your repo to avoid conflict in PR. |
### Releases v1.3.0 1. Add WebServer feature to serve from LittleFS/SPIFFS for ESP32/ESP8266 with examples. Check [**streamFile and serveStatic for ESP8266/ESP32 boards #22**](#22) 2. Add examples [**serveStatic**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStatic) and [**serveStaticLoadFile**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStaticLoadFile) to use new `serveStatic()`feature 3. Add examples [**ESP32_FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/ESP32_FS_EthernetWebServer) and [**FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/FS_EthernetWebServer) to use new `serveStatic()`feature
### Releases v1.3.0 1. Add WebServer feature to serve from LittleFS/SPIFFS for ESP32/ESP8266 with examples. Check [**streamFile and serveStatic for ESP8266/ESP32 boards #22**](#22) 2. Add examples [**serveStatic**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStatic) and [**serveStaticLoadFile**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStaticLoadFile) to use new `serveStatic()`feature 3. Add examples [**ESP32_FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/ESP32_FS_EthernetWebServer) and [**FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/FS_EthernetWebServer) to use new `serveStatic()`feature
### Releases v1.3.0 1. Add WebServer feature to serve from LittleFS/SPIFFS for ESP32/ESP8266 with examples. Check [**streamFile and serveStatic for ESP8266/ESP32 boards #22**](#22) 2. Add examples [**serveStatic**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStatic) and [**serveStaticLoadFile**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStaticLoadFile) to use new `serveStatic()`feature 3. Add examples [**ESP32_FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/ESP32_FS_EthernetWebServer) and [**FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/FS_EthernetWebServer) to use new `serveStatic()`feature
### Major Releases v1.3.0 1. Add WebServer feature to serve from LittleFS/SPIFFS for ESP32/ESP8266 with examples. Check [**streamFile and serveStatic for ESP8266/ESP32 boards #22**](#22) 2. Add examples [**serveStatic**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStatic) and [**serveStaticLoadFile**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/serveStaticLoadFile) to use new `serveStatic()`feature 3. Add examples [**ESP32_FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/ESP32_FS_EthernetWebServer) and [**FS_EthernetWebServer**](https://github.com/khoih-prog/EthernetWebServer/tree/master/examples/FS_EthernetWebServer) to use new `serveStatic()`feature
Congrats. The new EthernetWebServer v1.3.0 has just been published, thanks to your PR and contribution. Major Releases v1.3.0
Your contribution has been noted in Contributions and Thanks. Please have more tests, report issues and make more PRs. Best Regards, |
Per your request refactored the code to server only ESP8266/ESP32 platforms. I spent whole day to create a class which works but request handlers are broken. So, ended up separating the code.