ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By dbetz
#53507 I'd like to add a second argument to the CGI function that would indicate the reason it is being invoked. It seems there are many times the CGI function is invoked:

1) Upon initial connection when the full header has been received and maybe part of the body
2) When more data arrives
3) When a send completes
4) On disconnect

There should probably also be a callback when "recon" occurs which I believe indicates a connection failure. Rather than the application having to figure out why the CGI function was called, what about adding a second enum parameter to the CGI function that indicates the reason? Something like this:

Code: Select allenum {
  CGI_CALLBACK_CONNECT,
  CGI_CALLBACK_RECEIVED_DATA,
  CGI_CALLBACK_SEND_COMPLETE,
  CGI_CALLBACK_DISCONNECT,
  CGI_CALLBACK_CONNECTION_FAILED
};


Is there a reason why this would be a bad idea? If not, I'm going to try implementing it myself and will submit a pull request once the work is done and tested.