khoih-prog / WiFiWebServer

This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD, STM32, RP2040-based, etc. boards running WiFi modules/shields (WiFiNINA, CYW43439, U-Blox W101, W102, etc.). The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Now using WiFiMulti_Generic library
MIT License
105 stars 21 forks source link

server.send buffer size limited to 4k #23

Closed jlemieux55 closed 2 years ago

jlemieux55 commented 2 years ago

html file or message is > 4500 bytes server.send buffer truncates at > 4096 String message=""; message+=("html content is over 4500 bytes"); server.send(200, "text/html", message);

jlemieux55 commented 2 years ago

forgot to say: Platform: Arduino MKR1010 (wifinina)

khoih-prog commented 2 years ago

HI @jlemieux55

Actually, the limitation is not the bug of this library, but the limitation of WiFiNINA library and certainly modified WiFiNINA_Generic, prevent this library to send in chunks to deal with large html.

The issue affects all WiFiNINA-based boards, such as Nano_33_IoT, Nano_RP2040_Connect, MKR1010, etc. usng this library or not.

You can test and verify by using other boards, such as ESP32/ESP8266, Portenta_H7, RP2040W and see sending html contents much larger than 4K is OK

You can post an issue on WiFiNINA to help fix thus issue / enhance.

I don't know if I have time to check and fix the WiFiNINA_Generic.

Try to switch to better, even cheaper boards, such as RP2040W, ESP32/ESP8266, etc.

khoih-prog commented 2 years ago

Hi @jlemieux55

Good news. I just fix the limitation of WiFiNINA_Generic and you now can send very large HTML size.

Will post the new WiFiNINA_Generic and let you know to try after some more abusive tests.

Be patient.

khoih-prog commented 2 years ago

Hi @jlemieux55

Please check the new release WiFiNINA_Generic v1.8.15-0 which permits sending much larger data than total 4K.

Your contribution is noted in Contributions and Thanks


Releases v1.8.15-0

  1. Fix severe limitation to permit sending much larger data than total 4K. Check server.send buffer size limited to 4k #23
  2. Add examples WiFiWebServer_BigData to demo how to send much larger data than total 4K
  3. Optimize code
  4. Clean up

Debug Terminal

The following is debug terminal output when running example WiFiWebServer_BigData on NANO_RP2040_CONNECT board, using this WiFiNINA_Generic Library, to demo how to send much larger data than total 4K

Start WiFiWebServer_BigData on NANO_RP2040_CONNECT
WiFiNINA_Generic v1.8.15-0
WiFiWebServer v1.10.0
Attempting to connect to SSID: HueNet
Attempting to connect to SSID: HueNet
SSID: HueNet
IP Address: 192.168.2.117
Signal strength (RSSI):-24 dBm
String Len = 27609
String Len = 27609