Page 1 of 1

IDF httpd vs libesphttpd

Posted: Mon Mar 14, 2022 12:57 pm
by Skedaddles
Hello,

We are porting a project based on the ESP8266 non-OS SDK over to the ESP32 IDF. The old project had a pretty extensive web interface that used Sprite's excellent libesphttpd. We were quite satisfied with the performance and other characteristics. There appears to be a forked project with support for the ESP32-IDF: https://github.com/chmorgan/libesphttpd

I'm wondering if anyone has experience in using the new libesphttpd, and how it compares to the HTTPD included with the IDF.

Areas of interest:
- What are the performance differences?
- Is there a difference in the ability to handle different network interfaces simultaneously? (eg, Ethernet, Wi-Fi STA, and Wi-Fi AP)
- HTTPS support

Any other thoughts or comments on these options and their trade-offs would be appreciated.

Thanks!

Re: IDF httpd vs libesphttpd

Posted: Tue Mar 15, 2022 2:23 am
by ESP_Sprite
Hi! Really happy to hear you still like the little project I started years ago. I abandoned it some years ago and cmorgan took it over, as you noted, so my info isn't entirely up to date anymore, but here's something:

* One of the main differences between libesphttpd and the ESP_IDF httpd is the way dynamic pages are handled: in httpd, you have a function that writes to a socket generating the page as it goes. In libesphttpd, the function gets called every time it needs to send a new chunk of data. This makes httpd easier to use, but you can only serve one file at a time (other requests won't get data); libesphttpd can serve multiple files simultaneously at the cost of page generating functions being more complex.
* Another difference is that libesphttpd uses dynamic memory, while httpd uses static memory only. This means the httpd memory usage is pretty much constant, while libesphttpds memory usage will vary.
* Libesphttpd is (well, was, it may have changed) written around... let's say my loose interpretation of the HTTP specs. I'm sure it works 99.9% of the time, but there may be incompatibilities. From what I can tell, httpd uses the ngix http_parser for most of the things it does, which is likely to be more compatible/tested.
* Both work on the basis of Posix sockets on the base level, so I imagine both can work on multiple network interfaces.
* I think both support HTTPS.
* I have no clue wrt performance, sorry.

Re: IDF httpd vs libesphttpd

Posted: Tue Mar 15, 2022 2:22 pm
by Deouss
I am actually looking for a very very light-weight HTTP IoT server. It doesn't need any TLS protocols and it would be nice to have REST WebAPI/Json comunication included
Thanks

Re: IDF httpd vs libesphttpd

Posted: Wed Mar 16, 2022 11:04 am
by Skedaddles
Thanks for the response Sprite, that is some useful information. We've made good use of that "little project" over the years. If we somehow cross paths we definitely owe you a beverage :D

@Deouss: you could also check out https://github.com/me-no-dev/ESPAsyncWebServer. It appears to be a solid choice, but we are avoiding the Arduino core and licensing on our projects for now.