express.io icon indicating copy to clipboard operation
express.io copied to clipboard

When a rawCookie exists, should use cookieParserUtils.signedCookie

Open bpytlik opened this issue 11 years ago • 0 comments

While authorizing a socket.io request after upgrading to the tip of express.io, I kept getting a 403 when my sio client tried to connect to the server. The problem is that the code currently calls cookieParserUtils.signedCookies on rawCookie. At least in my experience and code, rawCookie is a string, not an object and the method blows up like this:

TypeError: Object.keys called on non-object at Function.keys (native) at Object.exports.signedCookies (/node_modules/cookie-parser/lib/parse.js:14:24) at /node_modules/express.io/lib/index.coffee:164:41 at cookieParser (/node_modules/cookie-parser/index.js:48:5) at /node_modules/express.io/lib/index.coffee:125:16 at Manager.app_io_opts.gen_auth_middleware_f (/httpd/server.coffee:455:9) at Manager.authorize (/node_modules/express.io/node_modules/socket.io/lib/manager.js:925:31) at Manager.handleHandshake (/node_modules/express.io/node_modules/socket.io/lib/manager.js:801:8) at Manager.handleRequest (/node_modules/express.io/node_modules/socket.io/lib/manager.js:616:12) at Server. (/node_modules/express.io/node_modules/socket.io/lib/manager.js:119:10)

Changing the call from signedCookies to signedCookie fixed the issue for me.

bpytlik avatar Aug 27 '14 03:08 bpytlik