Permalink
Browse files

Handle 404 Errors Only on Non /git/ user-agents

  • Loading branch information...
bencevans committed Oct 7, 2012
1 parent f57ba39 commit aa5238ebc54b7c8b8b8e62aed06b9dca55afb525
Showing with 6 additions and 6 deletions.
  1. +6 −6 app.js
View
12 app.js
@@ -1,11 +1,12 @@
// Generic Requirements
var fs = require('fs');
+var path = require('path');
var tmp = require('tmp');
var wrench = require('wrench');
// Config
var config = {};
-config.repoPath = process.env.REPO_PATH || "/tmp/repos";
+config.repoPath = path.resolve(process.env.REPO_PATH || "/tmp/repos");
config.port = process.env.PORT || 3000;
config.externalPort = process.env.EXTERNAL_PORT || config.port;
config.externalHost = process.env.EXTERNAL_HOST || 'localhost';
@@ -37,11 +38,10 @@ var server = http.createServer(function (req, res) {
if(req.headers['user-agent'])
if(req.headers['user-agent'].match(/git/))
return repos.handle(req, res);
-
- if(req.url !== '/') {
- res.statusCode = 404;
- res.end('404');
- }
+ else {
+ res.statusCode = 404;
+ return res.end('404');
+ }
var locals = {}

0 comments on commit aa5238e

Please sign in to comment.