Skip to content

Commit

Permalink
Merge remote branch 'upstream/master' into nodenext
Browse files Browse the repository at this point in the history
  • Loading branch information
einaros committed Oct 28, 2011
2 parents 3a07cc2 + abd0326 commit 70c61fa
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
17 changes: 17 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@

0.8.6 / 2011-10-27
==================

* Added JSON decoding on jsonp-polling transport.
* Fixed README example.
* Major speed optimizations [3rd-Eden] [einaros] [visionmedia]
* Added decode/encode benchmarks [visionmedia]
* Added support for black-listing client sent events.
* Fixed logging options, closes #540 [3rd-Eden]
* Added vary header for gzip [3rd-Eden]
* Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client
* Patched to properly shut down when a finishClose call is made during connection establishment
* Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify]
* Began IE10 compatibility [einaros] [tbranyen]
* Misc WebSocket fixes [einaros]
* Added UTF8 to respone headers for htmlfile [3rd-Eden]

0.8.5 / 2011-10-07
==================

Expand Down
2 changes: 1 addition & 1 deletion lib/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var client = require('socket.io-client');
* Version.
*/

exports.version = '0.8.5';
exports.version = '0.8.6';

/**
* Supported protocol version.
Expand Down
2 changes: 1 addition & 1 deletion lib/transports/htmlfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ HTMLFile.prototype.handleRequest = function (req) {

if (req.method == 'GET') {
req.res.writeHead(200, {
'Content-Type': 'text/html'
'Content-Type': 'text/html; charset=UTF-8'
, 'Connection': 'keep-alive'
, 'Transfer-Encoding': 'chunked'
});
Expand Down
18 changes: 18 additions & 0 deletions lib/transports/jsonp-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ JSONPPolling.prototype.name = 'jsonppolling';

JSONPPolling.prototype.postEncoded = true;

/**
* Handles incoming data.
* Due to a bug in \n handling by browsers, we expect a JSONified string.
*
* @api private
*/

JSONPPolling.prototype.onData = function (data) {
try {
data = JSON.parse(data);
} catch (e) {
this.error('parse', 'reconnect');
return;
}

HTTPPolling.prototype.onData.call(this, data);
};

/**
* Performs the write.
*
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "socket.io"
, "version": "0.8.5"
, "version": "0.8.6"
, "description": "Real-time apps made cross-browser & easy with a WebSocket-like API"
, "homepage": "http://socket.io"
, "keywords": ["websocket", "socket", "realtime", "socket.io", "comet", "ajax"]
Expand All @@ -16,7 +16,7 @@
, "url": "https://github.com/LearnBoost/socket.io.git"
}
, "dependencies": {
"socket.io-client": "0.8.5"
"socket.io-client": "0.8.6"
, "policyfile": "0.0.4"
, "redis": "0.6.7"
}
Expand Down
28 changes: 14 additions & 14 deletions test/transports.jsonp-polling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ module.exports = {
io.sockets.on('connection', function (client) {
cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'disconnect' })
, JSON.stringify(parser.encodePacket({ type: 'disconnect' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down Expand Up @@ -394,11 +394,11 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePayload([
, JSON.stringify(parser.encodePayload([
parser.encodePacket({ type: 'message', data: 'a' })
, parser.encodePacket({ type: 'message', data: 'b' })
, parser.encodePacket({ type: 'disconnect' })
])
]))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down Expand Up @@ -508,7 +508,7 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/woot' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/woot' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down Expand Up @@ -589,21 +589,21 @@ module.exports = {
cl.get('/socket.io/{protocol}/jsonp-polling/' + sid, function () {
cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/woot' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/woot' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'disconnect', endpoint: '/woot' })
, JSON.stringify(parser.encodePacket({ type: 'disconnect', endpoint: '/woot' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'message', data: 'ferret' })
, JSON.stringify(parser.encodePacket({ type: 'message', data: 'ferret' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down Expand Up @@ -660,7 +660,7 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/a' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/a' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand All @@ -669,7 +669,7 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/b' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/b' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down Expand Up @@ -725,7 +725,7 @@ module.exports = {
cl.get('/socket.io/{protocol}/jsonp-polling/' + sid, function (res, data) {
cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'message', data: '' })
, JSON.stringify(parser.encodePacket({ type: 'message', data: '' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand All @@ -734,14 +734,14 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/a' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/a' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'message', endpoint: '/a', data: 'a' })
, JSON.stringify(parser.encodePacket({ type: 'message', endpoint: '/a', data: 'a' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand All @@ -752,14 +752,14 @@ module.exports = {

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'connect', endpoint: '/b' })
, JSON.stringify(parser.encodePacket({ type: 'connect', endpoint: '/b' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');

cl.post(
'/socket.io/{protocol}/jsonp-polling/' + sid
, parser.encodePacket({ type: 'message', endpoint: '/b', data: 'b' })
, JSON.stringify(parser.encodePacket({ type: 'message', endpoint: '/b', data: 'b' }))
, function (res, data) {
res.statusCode.should.eql(200);
data.should.eql('1');
Expand Down

0 comments on commit 70c61fa

Please sign in to comment.