Compare commits
No commits in common. "fba428c9778088a0c68d3204de59f71b003c7a41" and "d94212b063ea248c502122bae45881b01e756ceb" have entirely different histories.
fba428c977
...
d94212b063
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,9 @@
|
||||
*.fzz
|
||||
#/sdCard_content/CONFIG/
|
||||
*.mp3
|
||||
*.jpg
|
||||
*.png
|
||||
*.ico
|
||||
*.o
|
||||
*.dll
|
||||
*.exe
|
||||
|
@ -99,7 +99,6 @@ void setup()
|
||||
sab.getWebServerManager().getWEBServer().addApiRoutine("/sab/io/set/mode", &(ioSetModeApi), &sab, WEBServer<WEBClient>::GET);
|
||||
sab.getWebServerManager().getWEBServer().addApiRoutine("/sab/ota/update/upload", &(otaUpdateUploadApi), NULL, WEBServer<WEBClient>::POST);
|
||||
sab.getWebServerManager().getWEBServer().addApiRoutine("/sab/ota/update/device", &(otaUpdateRemoteApi), &sab, WEBServer<WEBClient>::GET);
|
||||
sab.getWebServerManager().getWEBServer().addApiRoutine("/sab/web/cookietest", &(cookieTestApi), &sab, WEBServer<WEBClient>::GET);
|
||||
|
||||
sab.getIOManager().setISROnIOChange(&(ioISR), GPIO_3_RX);
|
||||
|
||||
|
@ -661,45 +661,3 @@ boolean otaUpdateRemoteApi(WEBServer<WEBClient> *ws, WEBServer<WEBClient>::HttpR
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean cookieTestApi(WEBServer<WEBClient> *ws, WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
|
||||
{
|
||||
(void)pData;
|
||||
|
||||
//We first check what kind of action we want to do:
|
||||
if(HRD.getParams("set") != NULL)
|
||||
{
|
||||
uint8_t cookieCount(HRD.getParams.count() - 1);
|
||||
Serial.printf("Cookies to be set/unset : %u\n", cookieCount);
|
||||
for(uint8_t i(0); i < HRD.getParams.count(); i++)
|
||||
{
|
||||
if(strcmp(HRD.getParams.getParameter(i), "set") != 0)
|
||||
{
|
||||
if(!strlen(HRD.getParams.getAt(i)->getString())) //We ask to remove the cookie
|
||||
{
|
||||
Serial.printf("Unsetting cookie %s->%s\n", HRD.getParams.getParameter(i), HRD.getParams.getAt(i)->getString());
|
||||
ws->addCookies(HRD.getParams.getParameter(i), HRD.getParams.getAt(i)->getString(), 0);
|
||||
}
|
||||
else //We add the cookie
|
||||
{
|
||||
Serial.printf("Setting cookie %s->%s\n", HRD.getParams.getParameter(i), HRD.getParams.getAt(i)->getString());
|
||||
ws->addCookies(HRD.getParams.getParameter(i), HRD.getParams.getAt(i)->getString(), 3600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ws->sendHTTPResponse(wc, HttpConstants::httpMIMETypeToString(HttpConstants::TEXT_PLAIN)); //We dont know the content length
|
||||
wc->printf("Setting/Unsetting %u cookies : \n", cookieCount);
|
||||
}
|
||||
else //We print the setted cookies
|
||||
{
|
||||
ws->sendHTTPResponse(wc, HttpConstants::httpMIMETypeToString(HttpConstants::TEXT_PLAIN)); //We dont know the content length
|
||||
wc->printf("Cookies to display : %u\n", HRD.cookies.count());
|
||||
for(uint8_t i(0); i < HRD.cookies.count(); i++)
|
||||
{
|
||||
wc->printf("cookie %u : %s->%s\n", i, HRD.cookies.getParameter(i), HRD.cookies.getAt(i)->value.getString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -32,6 +32,5 @@ boolean ioGetModeApi(WEBServer<WEBClient>*, WEBServer<WEBClient>::HttpRequestDat
|
||||
boolean ioSetModeApi(WEBServer<WEBClient>*, WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||
boolean otaUpdateUploadApi(WEBServer<WEBClient>*, WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||
boolean otaUpdateRemoteApi(WEBServer<WEBClient>*, WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||
boolean cookieTestApi(WEBServer<WEBClient>*, WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user