ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By jeffrey92
#33598 Israel Lot,

First of all, thank you for making this available to everyone.

Originally I was trying to compile with the c99 standard, but it appears your code makes use of quite a few inline functions. At least that's what I think they're termed (i.e. calling functions without explicitly declaring prototypes in the header files). I'm kind of lost when it comes to compiler issues, so I was wondering if you could explain the purpose of this somewhat, and if there is a specific reason why this can not compile under c99? I understand that it's performance-related, but some additional insight would be nice.

From what I've gathered, c99 does not allow this unless you explicitly declare a function as inline, and do so in the header file as well? Or perhaps disable checks for some parts of code?

Also, I am particularly curious about the implementation of your "cgi_enforce_method()" in cgi.c. It is called in http_server.c with 2 parameters, but the definition only takes 1. My best guess is it is some kind of "special" caller. I did some Googling to try to find out more but compiler literature is pretty dense, so I was wondering if you wouldn't mind explaining how that works, or what the proper term is for this kind of call :D
User avatar
By Israel Lot
#33693
jeffrey92 wrote:Israel Lot,

First of all, thank you for making this available to everyone.



Originally I was trying to compile with the c99 standard, but it appears your code makes use of quite a few inline functions. At least that's what I think they're termed (i.e. calling functions without explicitly declaring prototypes in the header files). I'm kind of lost when it comes to compiler issues, so I was wondering if you could explain the purpose of this somewhat, and if there is a specific reason why this can not compile under c99? I understand that it's performance-related, but some additional insight would be nice.

From what I've gathered, c99 does not allow this unless you explicitly declare a function as inline, and do so in the header file as well? Or perhaps disable checks for some parts of code?

Also, I am particularly curious about the implementation of your "cgi_enforce_method()" in cgi.c. It is called in http_server.c with 2 parameters, but the definition only takes 1. My best guess is it is some kind of "special" caller. I did some Googling to try to find out more but compiler literature is pretty dense, so I was wondering if you wouldn't mind explaining how that works, or what the proper term is for this kind of call :D



Thank you for you message jeffrey92. I see you dig deep on the code. This isn't a release or production ready code, but rather a fast written prototype. Don't take for granted any code you see on the project, or in any project I would say :)
First of all, there's no special reason why there are function without header declarations, I was writing without c99 enforcement and some functions were left without declarations by laziness or pure mistake.
The special case that you mentioned about the cgi_enforce_method(), that's simply a big code error that won't lead to a compile error nor a runtime error, but still is a typo that should be correct. I would like to improve the esp-ginx and rewrite a lot of stuff that I left unfinished, but I have no time right now. Feel free to join the project and right my wrongs :)
User avatar
By jeffrey92
#33760 Ah. Thanks for clearing that up. Looks like I was really over-thinking it!

I'm still just prototyping right now, but your DNS capture was the most robust implementation I've found that is based on lwip. I've already implemented my project using SpriteTm's esphttpd, but I wanted to try out esp-ginx to compare performance. And because our team recently contracted a backend dev that wrote a custom ginx for another platform.

I'd be happy to submit improvements and bugfixes where I find them. Is there a better way I can contact you? It would be nice to be able to get clarification on things here and there so I don't end up on wild goose chases. :|
User avatar
By Israel Lot
#33788
jeffrey92 wrote:Ah. Thanks for clearing that up. Looks like I was really over-thinking it!

I'm still just prototyping right now, but your DNS capture was the most robust implementation I've found that is based on lwip. I've already implemented my project using SpriteTm's esphttpd, but I wanted to try out esp-ginx to compare performance. And because our team recently contracted a backend dev that wrote a custom ginx for another platform.

I'd be happy to submit improvements and bugfixes where I find them. Is there a better way I can contact you? It would be nice to be able to get clarification on things here and there so I don't end up on wild goose chases. :|


You can always write me directly on github or on israel.lot at gmail dot com