Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ http.createServer(function (request, response) {

//The requested URL like http://localhost:8000/file.html
var uri = url.parse(request.url).pathname;
if (path.normalize(decodeURI(uri)) !== decodeURI(uri)) {
response.statusCode = 403;
response.end();
return;
}
//get the file.html from above and then find it from the current folder
var filename = path.join(process.cwd(), uri);

Expand Down