Permalink
Browse files

window redirect loop bugfix. ignore all invisible files (recursively)…

…. concise logging by default.
  • Loading branch information...
1 parent 760a697 commit 1590c432c31724dac0920826bbb9d471fd47feff @jairajs89 committed Jan 22, 2013
Showing with 14 additions and 12 deletions.
  1. +2 −1 apis.js
  2. +1 −1 package.json
  3. +11 −10 zerver.js
View
3 apis.js
@@ -127,7 +127,7 @@ exports.getScript = function (apiRoot, apiName, apiHost, apiDir) {
else {
return;
}
-console.log(REFRESH, LOGGING);
+
script = script.replace(INSERT_REFRESH, JSON.stringify(REFRESH));
script = script.replace(INSERT_LOGGING, JSON.stringify(LOGGING));
script = script.replace(INSERT_NAME , JSON.stringify(apiName));
@@ -169,6 +169,7 @@ function setupAPIObj (api, obj, functions) {
break;
case 'object':
+ //TODO: what if array?
obj[key] = {};
functions[key] = {};
setupAPIObj(value, obj[key], functions[key]);
View
2 package.json
@@ -2,7 +2,7 @@
"author": "Jairaj Sethi <j@jairaj.org> (http://jairaj.org/)",
"name": "zerver",
"description": "client-integrated webapp server",
- "version": "0.7.1",
+ "version": "0.7.2",
"repository": {
"type": "git",
"url": "git://github.com/jairajs89/zerver.git"
View
21 zerver.js
@@ -477,6 +477,7 @@ function compileOutput (type, data, callback) {
case 'application/javascript':
case 'text/javascript':
try {
+ //TODO: remove debug lines (;;; debug_code())
var ast = uglify.parser.parse(data);
ast = uglify.uglify.ast_mangle(ast);
ast = uglify.uglify.ast_squeeze(ast);
@@ -591,7 +592,7 @@ function respond500 (handler) {
function pathRequest (handler, pathname) {
handler.type = 'file';
- if (pathname.substr(0, 2) === '/.') {
+ if (pathname.indexOf('/.') !== -1) {
respond404(handler);
return;
}
@@ -608,9 +609,9 @@ function fileRequest (handler, fileName) {
}
if ( stats.isDirectory() ) {
- if (fileName[fileName.length - 1] !== '/') {
+ if (handler.pathname[handler.pathname.length - 1] !== '/') {
respond(handler, 301, 'text/plain', '', {
- 'Location' : handler.pathname + (handler.query || '') + (handler.hash || '')
+ 'Location' : handler.pathname + '/' + (handler.query || '') + (handler.hash || '')
});
}
else {
@@ -902,15 +903,15 @@ function logRequest (handler, status) {
}
console.log(logType + ' : ' + time + statusField + pathname);
- if (agent) {
- console.log(' ' + agent);
- }
+ // if (agent) {
+ // console.log(' ' + agent);
+ // }
- if (handler.referrer) {
- console.log(' referrer=' + handler.referrer);
- }
+ // if (handler.referrer) {
+ // console.log(' referrer=' + handler.referrer);
+ // }
- console.log('');
+ // console.log('');
}
var parseQueryString = function () {

0 comments on commit 1590c43

Please sign in to comment.