Skip to content

Commit

Permalink
Use utils.forbidden
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Mar 24, 2012
1 parent 84de9b6 commit 7ef49d1
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ module.exports = function (app, root) {
var scriptName = unescape(env.scriptName),
pathInfo = unescape(env.pathInfo);

if (pathInfo.indexOf("..") != -1) {
forbidden(callback);
if (pathInfo.indexOf("..") !== -1) {
utils.forbidden(callback);
return;
}

Expand All @@ -50,15 +50,6 @@ module.exports = function (app, root) {
}
};

function forbidden(callback) {
var content = "Forbidden";

callback(403, {
"Content-Type": "text/plain",
"Content-Length": Buffer.byteLength(content).toString()
}, content);
}

var page = [
'<html>',
'<head>',
Expand Down

0 comments on commit 7ef49d1

Please sign in to comment.