Added no-cache to MPS HTTP responses for #2462

This commit is contained in:
Ylian Saint-Hilaire 2021-04-07 10:27:25 -07:00
parent 9269c29bf0
commit a66bd9b595
2 changed files with 4 additions and 4 deletions

View File

@ -1234,7 +1234,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
if ((filestats == null) || (typeof filestats.size != 'number') || (filestats.size <= 0)) {
responseCode = 404; responseType = 'text/html'; responseData = 'File not found';
} else {
this.write('HTTP/1.1 200 OK\r\n' + hostHeader + 'Content-Type: ' + responseType + '\r\nConnection: keep-alive\r\nContent-Length: ' + filestats.size + '\r\n\r\n');
this.write('HTTP/1.1 200 OK\r\n' + hostHeader + 'Content-Type: ' + responseType + '\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nContent-Length: ' + filestats.size + '\r\n\r\n');
if (directives[0] == 'GET') { obj.fs.createReadStream(cookie.f, { flags: 'r' }).pipe(this); }
delete this.xdata;
return;
@ -1259,7 +1259,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
if ((filestats == null) || (typeof filestats.size != 'number') || (filestats.size <= 0)) {
responseCode = 404; responseType = 'text/html'; responseData = 'File not found';
} else {
this.write('HTTP/1.1 200 OK\r\n' + hostHeader + 'Content-Type: ' + responseType + '\r\nConnection: keep-alive\r\nContent-Length: ' + filestats.size + '\r\n\r\n');
this.write('HTTP/1.1 200 OK\r\n' + hostHeader + 'Content-Type: ' + responseType + '\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nContent-Length: ' + filestats.size + '\r\n\r\n');
if (directives[0] == 'GET') {
obj.fs.createReadStream(r.file, { flags: 'r' }).pipe(this);
if (typeof r.maxserve == 'number') { r.maxserve--; if (r.maxserve == 0) { delete obj.httpResponses[directives[1]]; } } // Check if this entry was server the maximum amount of times.
@ -1274,7 +1274,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
responseData = 'Invalid request';
}
}
this.write('HTTP/1.1 ' + responseCode + ' OK\r\n' + hostHeader + 'Connection: keep-alive\r\nContent-Type: ' + responseType + '\r\nContent-Length: ' + responseData.length + '\r\n\r\n');
this.write('HTTP/1.1 ' + responseCode + ' OK\r\n' + hostHeader + 'Connection: keep-alive\r\nCache-Control: no-cache\r\nContent-Type: ' + responseType + '\r\nContent-Length: ' + responseData.length + '\r\n\r\n');
this.write(responseData);
delete this.xdata;
}

View File

@ -3471,7 +3471,7 @@
) { menus.push({ n: "Desktop", f: 'setupDeviceMenu(1)' }); }
if ((currentDevicePanel != 5) &&
(urlargs.term == 1) &&
//(urlargs.term == 1) &&
(currentNode != null) &&
((meshrights & 8) || (meshrights & 256)) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 65536) == 0)) &&
(((currentNode.agent == null) && ((typeof currentNode.intelamt.sku !== 'number') || ((currentNode.intelamt.sku & 8) != 0))) || (currentNode.agent && (currentNode.agent.caps & 2)))