in both windows and Android
If I kill chrome, re-launch it and type the server address It requests credentials which is perfect.
If I enter them and thereafter either refresh or enter the address again or kill the tab->create new one->enter the address it does not request credentials
This is very annoying because the address is remembered by chrome and so it can accidentally, the phone being in my pocket, go to the server and do dommages, even If I don't forget to kill the tab when I am done.
Is there a way to force the browser to ask for credentials say after some idle timeout e.g. of 5 seconds or so?
Below the server code
Thanks for your time
void serve(){
if(!hasEnet)return;
unsigned int genBufIndex;
EthernetClient client = server.available(); // try to get client
if (client) { // got client?
report(F(">>>new client\r\n"),HIGH_VERBOSITY);
memset(genBuf,'\0',sizeof(genBuf));//so that the strings ends where the client fills now
genBufIndex = 0;
authenticated=false;
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) { // client data available to read
char c = client.read(); // read 1 byte (character) from client
if (genBufIndex < (sizeof(genBuf)-1)) {//assemble up to the buffer size, ignore above
genBuf[genBufIndex++]=c; // save HTTP request
}
reportChar(c,HIGH_VERBOSITY);
if (c == '\n' && currentLineIsBlank) {// a request has been assembled
if(authenticated){
if (strstr(genBuf,"ajax_inputs")!=NULL)sendAjax(client);
else if (strstr(genBuf,"Dump")!=NULL)sendDump(client);
else sendPage(client);
}
else sendAuthenticationPage(client);
break; //end the cnx
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
if ((strstr(genBuf,"Authorization: Basic")!=NULL) && (strstr(genBuf,SERVER_CREDS)!=NULL)){
authenticated=true;
}
}
else if (c != '\r') currentLineIsBlank = false;
} // end if (client.available())
} // end while (client.connected())
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection
if(persHaltReq) logger(__LINE__,0,PERS_HALT);
report(F(">>>client stopped\r\n\r\n"),HIGH_VERBOSITY);
} // end if (client)
}