ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By Eddiie
#40191 I see from the terminal output:

GET Args = led=2

Looking in the code, httpd.c , it uses something I am not familiar with, conn->getArgs
What is this? conn->getArgs a pointer? Shifting something into a variable? is this available anywhere in the program, like cgi.c?

Any hints on where to put the case / if statement?
User avatar
By Eddiie
#40192 I see in cgi.c a hint for POST..

//Cgi that turns the LED on or off according to the 'led' param in the POST data
int ICACHE_FLASH_ATTR cgiLed(HttpdConnData *connData) {
int len;
char buff[1024];

if (connData->conn==NULL) {
//Connection aborted. Clean up.
return HTTPD_CGI_DONE;
}

len=httpdFindArg(connData->post->buff, "led", buff, sizeof(buff));
if (len!=0) {
currLedState=atoi(buff);
ioLed(currLedState);
}

httpdRedirect(connData, "led.tpl");
return HTTPD_CGI_DONE;
}


Thinking...