Permalink
Browse files

Merge remote-tracking branch 'https-fix/master'

  • Loading branch information...
James Keane
James Keane committed Aug 25, 2012
2 parents d5cb546 + cb1a964 commit f4dbf32fdec9e73045348c427f2bdd3e852a4345
Showing with 15 additions and 7 deletions.
  1. +1 −1 dist/now.js
  2. +8 −3 lib/fileServer.js
  3. +4 −1 lib/now.js
  4. +2 −2 package.json
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -32,6 +32,7 @@ handleResponse = function (request, response) {
// Handle only GET requests for /nowjs/* files. Pass all other requests through
var i;
if (request.method === 'GET') {
+
// Detect if request involves the now.js file
if (request.url.split('?')[0] === '/nowjs/now.js') {
serveFile(__dirname + nowClient, request, response, options);
@@ -74,7 +75,8 @@ serveFile = function (filename, request, response, options) {
// Determine hostname / port if not given in options
var host = request.headers.host.split(':');
var hostServer = options['host'] || host[0];
- var hostPort = options['port'] || host[1] || ((request.headers.referer.split(':')[0] === 'https') ? '443' : '80');
+ var hostPort = options['port'] || host[1] || '80';
+
// Call generate client libs, which takes the desired host/port and executes callback with two parts of now.js as parameters
generateClientLibs(hostServer, hostPort, function (nowText) {
@@ -105,8 +107,11 @@ generateClientLibs = function (hostServer, hostPort, callback) {
fs.readFile(__dirname + nowClient, function (err, data) {
var nowText = data.toString();
var initString = options.scope + '.now = nowInitialize("' +
- (options.protocol !== undefined ? options.protocol + ':' : '') +
- '//' + hostServer + ':' + hostPort + '", ' + options.client + ');\n';
+ ( options.protocol !== undefined ?
+ options.protocol + '://' + hostServer :
+ '//' + hostServer + ':' + hostPort
+ ) +
+ '", ' + options.client + ');\n';
nowText += initString;
callback(nowText);
View
@@ -179,7 +179,10 @@ Now.prototype.initialize = function (server, options) {
var self = this;
fileServer.wrapServer(server, this.options);
- this.server = io.listen(server, this.options.socketio);
+ if(this.options.secureio && this.options.secureio==true)
+ this.server = io.listen(this.options.secureport, this.options.socketio);
+ else
+ this.server = io.listen(server, this.options.socketio);
// Need this to be separate from clientsMap.
this.server.sockets.on('connection', function (socket) {
View
@@ -3,10 +3,10 @@
"author": "Flotype",
"name": "now",
"description": "NowJS: An easy to use real-time RPC library",
- "version": "0.8.1",
+ "version": "0.8.2",
"repository": {
"type": "git",
- "url": "git://github.com/Flotype/now.git"
+ "url": "git://github.com/jameskeane/now.git"
},
"main": "lib/server.js",
"engines": {

0 comments on commit f4dbf32

Please sign in to comment.