From 437808ed8e2938cb0c3d2f11343af1fa068d9c8a Mon Sep 17 00:00:00 2001 From: Jason Scharlach Date: Mon, 4 Jun 2012 13:07:52 -0400 Subject: [PATCH 1/2] Adding basic ability to send cookies with xhr handshakes. --- lib/socket.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/socket.js b/lib/socket.js index dff44112d..13d5d94c2 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -148,6 +148,9 @@ } else { var xhr = io.util.request(); + if (this.options.cookie) { + xhr.setRequestHeader('Cookie', this.options.cookie); + } xhr.open('GET', url, true); xhr.withCredentials = true; xhr.onreadystatechange = function () { From 8acdc82d498b96b40d143573023262a03eea2fe3 Mon Sep 17 00:00:00 2001 From: jscharlach Date: Mon, 4 Jun 2012 14:22:49 -0300 Subject: [PATCH 2/2] Adding 'cookie' option example --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index cdb7715a5..f15fb8c94 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,14 @@ true The amount of attempts should we make using the current transport to connect to the server? After this we will do one final attempt, and re-try with all enabled transport methods before we give up. +- *'cookie'* + + Any cookies to pass along into the handshake. For example: + +```js + io.connect('http://localhost', {'cookie': 'express-sid=aGRKnI4jThJDdWPxEEZIDIGeH5DlA0Fs'}); +``` + ##### Properties: - *options*