Last active
October 18, 2018 15:45
-
-
Save echicken/5fdb45d19826ab1d0470ad53ed04f12d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /sbbs/ctrl/410.txt would be a line-by-line list of paths to pages that no longer exist: | |
// /some/deleted/page.html | |
load('sbbsdefs.js'); | |
var line; | |
const f = new File(system.ctrl_dir + '410.txt'); | |
if (f.open('r')) { | |
var bork = false; | |
while (!bork && !f.eof) { | |
line = f.readln(); | |
if (line !== null && line.replace(/\/$/, '').toLowerCase() == http_request.virtual_path.replace(/\/$/, '').toLowerCase()) { | |
http_reply.status = '410 Gone'; | |
writeln('Page is gone.'); | |
writeln(http_request.virtual_path); | |
bork = true; | |
log(LOG_DEBUG, 'something something 410'); | |
} | |
} | |
f.close(); | |
if (bork) exit(); | |
} | |
writeln('File not found'); |
Author
echicken
commented
Sep 24, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment