Tpl engine now accepts %% as an escape for %
This commit is contained in:
@@ -124,8 +124,15 @@ int ICACHE_FLASH_ATTR cgiEspFsTemplate(HttpdConnData *connData) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (buff[x]=='%') {
|
if (buff[x]=='%') {
|
||||||
|
if (tpd->tokenPos==0) {
|
||||||
|
//This is the second % of a %% escape string.
|
||||||
|
//Send a single % and resume with the normal program flow.
|
||||||
|
espconn_sent(connData->conn, (uint8 *)"%", 1);
|
||||||
|
} else {
|
||||||
|
//This is an actual token.
|
||||||
tpd->token[tpd->tokenPos++]=0; //zero-terminate token
|
tpd->token[tpd->tokenPos++]=0; //zero-terminate token
|
||||||
((TplCallback)(connData->cgiArg))(connData, tpd->token, &tpd->tplArg);
|
((TplCallback)(connData->cgiArg))(connData, tpd->token, &tpd->tplArg);
|
||||||
|
}
|
||||||
//Go collect normal chars again.
|
//Go collect normal chars again.
|
||||||
e=&buff[x+1];
|
e=&buff[x+1];
|
||||||
tpd->tokenPos=-1;
|
tpd->tokenPos=-1;
|
||||||
|
|||||||
Reference in New Issue
Block a user