Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/transports/htmlfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports = module.exports = HTMLFile;

function HTMLFile (mng, data, req) {
HTTPTransport.call(this, mng, data, req);
};
}

/**
* Inherits from Transport.
Expand Down Expand Up @@ -55,6 +55,7 @@ HTMLFile.prototype.handleRequest = function (req) {
'Content-Type': 'text/html; charset=UTF-8'
, 'Connection': 'keep-alive'
, 'Transfer-Encoding': 'chunked'
, 'Cache-Control': 'no-cache'
});

req.res.write(
Expand Down
2 changes: 1 addition & 1 deletion lib/transports/http-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports = module.exports = HTTPPolling;

function HTTPPolling (mng, data, req) {
HTTPTransport.call(this, mng, data, req);
};
}

/**
* Inherits from HTTPTransport.
Expand Down
10 changes: 7 additions & 3 deletions lib/transports/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports = module.exports = HTTPTransport;

function HTTPTransport (mng, data, req) {
Transport.call(this, mng, data, req);
};
}

/**
* Inherits from Transport.
Expand All @@ -46,11 +46,15 @@ HTTPTransport.prototype.handleRequest = function (req) {
// Always set the response in case an error is returned to the client
this.response = req.res;

if (req.method == 'POST') {
if (req.method === 'POST') {
var buffer = ''
, res = req.res
, origin = req.headers.origin
, headers = { 'Content-Length': 1, 'Content-Type': 'text/plain; charset=UTF-8' }
, headers = {
'Content-Length': 1
, 'Content-Type': 'text/plain; charset=UTF-8'
, 'Cache-Control': 'no-cache'
}
, self = this;

req.on('data', function (data) {
Expand Down
7 changes: 4 additions & 3 deletions lib/transports/jsonp-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* Module requirements.
*/

var HTTPPolling = require('./http-polling');
var jsonpolling_re = /^\d+$/
var HTTPPolling = require('./http-polling')
, jsonpolling_re = /^\d+$/;

/**
* Export the constructor.
Expand All @@ -33,7 +33,7 @@ function JSONPPolling (mng, data, req) {
if (data.query.i && jsonpolling_re.test(data.query.i)) {
this.head = 'io.j[' + data.query.i + '](';
}
};
}

/**
* Inherits from Transport.
Expand Down Expand Up @@ -89,6 +89,7 @@ JSONPPolling.prototype.doWrite = function (data) {
'Content-Type': 'text/javascript; charset=UTF-8'
, 'Content-Length': Buffer.byteLength(data)
, 'Connection': 'Keep-Alive'
, 'Cache-Control': 'no-cache'
, 'X-XSS-Protection': '0'
});

Expand Down
3 changes: 2 additions & 1 deletion lib/transports/xhr-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports = module.exports = XHRPolling;

function XHRPolling (mng, data, req) {
HTTPPolling.call(this, mng, data, req);
};
}

/**
* Inherits from Transport.
Expand Down Expand Up @@ -55,6 +55,7 @@ XHRPolling.prototype.doWrite = function (data) {
'Content-Type': 'text/plain; charset=UTF-8'
, 'Content-Length': data === undefined ? 0 : Buffer.byteLength(data)
, 'Connection': 'Keep-Alive'
, 'Cache-Control': 'no-cache'
};

if (origin) {
Expand Down