Skip to content
Myr

Fixed bug preventing Opera from retaining the generated session id. Closes #292

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This might not be the best solution, I am not sure what the cookie spec states. But it works for now :)

authored by visionmedia · committed by visionmedia · parent 9202c75 · Browse files · 3 files+10 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−2 removed

  • tests:+8 added−1 removed
  • other:+2 added−1 removed

3 files+10 added−2 removed

modified:examples/chat/app.js+1 added-1 removed
modified:lib/express/plugins/session.js+1 added
208 unmodified lines
209 */210 211 request: function(event, callback) {212 var sid = event.request.cookie('sid')213 if (!sid && event.request.url.pathname === '/favicon.ico') return214 exports.Session.store.fetch(sid, function(err, session) {215 if (err) return callback(err)216 if (session.id != sid) 217 event.request.cookie('sid', session.id, exports.Session.cookie)
18 unmodified lines
modified:spec/spec.plugins.session.js+8 added-1 removed
12 unmodified lines
13 it 'should set sid cookie'14 get('/login', function(){ return '' })15 get('/login').headers['set-cookie'].should.match(/^sid=(\w+);/)16 end17 18 describe 'and requesting /favicon.ico'19 it 'should not set sid cookie'20 get('/favicon.ico', function(){ this.halt() })21 get('/favicon.ico').headers.should.not.have_property 'set-cookie'22 end23 end24 end1825 26 describe 'when existing sid cookie is present'27 it 'should not set sid'28 Session.store.commit(new Base(123))29 get('/login', function(){ return '' })
111 unmodified lines