Permalink
Browse files

Merge branch 'master' of github.com:Flotype/now

  • Loading branch information...
2 parents adbe86c + 32316d1 commit c183f56e6cb9da89a03f5627cc2fac56722ede68 @sridatta sridatta committed Aug 16, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/fileServer.js
View
@@ -34,13 +34,17 @@ handleResponse = function (request, response) {
} else {
// Make sure default listeners are still handled
for (i in defaultListeners) {
- defaultListeners[i].call(server, request, response);
+ if (nowUtil.hasProperty(defaultListeners, i)) {
+ defaultListeners[i].call(server, request, response);
+ }
}
}
} else {
for (i in defaultListeners) {
// Make sure default listeners are still handled
- defaultListeners[i].call(server, request, response);
+ if (nowUtil.hasProperty(defaultListeners, i)) {
+ defaultListeners[i].call(server, request, response);
+ }
}
}
};
@@ -97,9 +101,11 @@ serveFile = function (filename, request, response, options) {
generateClientLibs = function (hostServer, hostPort, callback) {
fs.readFile(__dirname + '/client/now.js', function (err, data) {
var nowText = data.toString();
- var initString = options.scope + '.now = nowInitialize("//'+ hostServer + ':' + hostPort + '", ' + options.client + ');\n';
+ var initString = options.scope + '.now = nowInitialize("' +
+ (options.protocol !== undefined ? options.protocol + ':' : '') +
+ '//' + hostServer + ':' + hostPort + '", ' + options.client + ');\n';
nowText += initString;
-
+
callback(nowText);
});
};

0 comments on commit c183f56

Please sign in to comment.