File tree Expand file tree Collapse file tree 3 files changed +24
-11
lines changed
Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Original file line number Diff line number Diff line change 11unreleased
22==========
33
4+ * Correctly inherit from ` EventEmitter ` class in ` Store ` base class
45 * Fix issue where ` Set-Cookie ` ` Expires ` was not always updated
56 * Methods are no longer enumerable on ` req.session ` object
67
Original file line number Diff line number Diff line change 99
1010/**
1111 * Module dependencies.
12+ * @private
1213 */
1314
15+ var Cookie = require ( './cookie' )
1416var EventEmitter = require ( 'events' ) . EventEmitter
15- , Session = require ( './session' )
16- , Cookie = require ( './cookie' ) ;
17+ var Session = require ( './session' )
18+ var util = require ( 'util' )
1719
1820/**
19- * Initialize abstract `Store`.
20- *
21- * @api private
21+ * Module exports.
22+ * @public
23+ */
24+
25+ module . exports = Store
26+
27+ /**
28+ * Abstract base class for session stores.
29+ * @public
2230 */
2331
24- var Store = module . exports = function Store ( options ) { } ;
32+ function Store ( ) {
33+ EventEmitter . call ( this )
34+ }
2535
2636/**
27- * Inherit from ` EventEmitter.prototype` .
37+ * Inherit from EventEmitter.
2838 */
2939
30- Store . prototype . __proto__ = EventEmitter . prototype ;
40+ util . inherits ( Store , EventEmitter )
3141
3242/**
3343 * Re-generate the given requests's session.
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ var express = require('express')
1111var fs = require ( 'fs' )
1212var http = require ( 'http' )
1313var https = require ( 'https' )
14+ var util = require ( 'util' )
1415
1516var min = 60 * 1000 ;
1617
@@ -2289,11 +2290,12 @@ function writePatch() {
22892290 }
22902291}
22912292
2292- function SyncStore ( ) {
2293- this . sessions = Object . create ( null ) ;
2293+ function SyncStore ( ) {
2294+ session . Store . call ( this )
2295+ this . sessions = Object . create ( null )
22942296}
22952297
2296- SyncStore . prototype . __proto__ = session . Store . prototype ;
2298+ util . inherits ( SyncStore , session . Store )
22972299
22982300SyncStore . prototype . destroy = function destroy ( sid , callback ) {
22992301 delete this . sessions [ sid ] ;
You can’t perform that action at this time.
0 commit comments