Browse Source

initial commit

Roman Matiasko 10 years ago
parent
commit
06084c1d06
100 changed files with 10996 additions and 3 deletions
  1. 28 3
      README.md
  2. 143 0
      app.js
  3. 14 0
      manifest.yml
  4. 1 0
      node_modules/.bin/express
  5. 1 0
      node_modules/.bin/jade
  6. 9 0
      node_modules/express/.npmignore
  7. 4 0
      node_modules/express/.travis.yml
  8. 1178 0
      node_modules/express/History.md
  9. 22 0
      node_modules/express/LICENSE
  10. 33 0
      node_modules/express/Makefile
  11. 179 0
      node_modules/express/Readme.md
  12. 422 0
      node_modules/express/bin/express
  13. 4 0
      node_modules/express/index.js
  14. 535 0
      node_modules/express/lib/application.js
  15. 86 0
      node_modules/express/lib/express.js
  16. 32 0
      node_modules/express/lib/middleware.js
  17. 526 0
      node_modules/express/lib/request.js
  18. 757 0
      node_modules/express/lib/response.js
  19. 273 0
      node_modules/express/lib/router/index.js
  20. 72 0
      node_modules/express/lib/router/route.js
  21. 313 0
      node_modules/express/lib/utils.js
  22. 77 0
      node_modules/express/lib/view.js
  23. 1 0
      node_modules/express/node_modules/buffer-crc32/.npmignore
  24. 8 0
      node_modules/express/node_modules/buffer-crc32/.travis.yml
  25. 47 0
      node_modules/express/node_modules/buffer-crc32/README.md
  26. 88 0
      node_modules/express/node_modules/buffer-crc32/index.js
  27. 36 0
      node_modules/express/node_modules/buffer-crc32/package.json
  28. 89 0
      node_modules/express/node_modules/buffer-crc32/tests/crc.test.js
  29. 158 0
      node_modules/express/node_modules/commander/History.md
  30. 276 0
      node_modules/express/node_modules/commander/Readme.md
  31. 1152 0
      node_modules/express/node_modules/commander/index.js
  32. 101 0
      node_modules/express/node_modules/commander/node_modules/keypress/README.md
  33. 346 0
      node_modules/express/node_modules/commander/node_modules/keypress/index.js
  34. 23 0
      node_modules/express/node_modules/commander/node_modules/keypress/package.json
  35. 28 0
      node_modules/express/node_modules/commander/node_modules/keypress/test.js
  36. 32 0
      node_modules/express/node_modules/commander/package.json
  37. 12 0
      node_modules/express/node_modules/connect/.npmignore
  38. 4 0
      node_modules/express/node_modules/connect/.travis.yml
  39. 24 0
      node_modules/express/node_modules/connect/LICENSE
  40. 133 0
      node_modules/express/node_modules/connect/Readme.md
  41. 4 0
      node_modules/express/node_modules/connect/index.js
  42. 81 0
      node_modules/express/node_modules/connect/lib/cache.js
  43. 92 0
      node_modules/express/node_modules/connect/lib/connect.js
  44. 50 0
      node_modules/express/node_modules/connect/lib/index.js
  45. 103 0
      node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
  46. 61 0
      node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
  47. 189 0
      node_modules/express/node_modules/connect/lib/middleware/compress.js
  48. 62 0
      node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
  49. 115 0
      node_modules/express/node_modules/connect/lib/middleware/cookieSession.js
  50. 74 0
      node_modules/express/node_modules/connect/lib/middleware/csrf.js
  51. 229 0
      node_modules/express/node_modules/connect/lib/middleware/directory.js
  52. 86 0
      node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
  53. 80 0
      node_modules/express/node_modules/connect/lib/middleware/favicon.js
  54. 89 0
      node_modules/express/node_modules/connect/lib/middleware/json.js
  55. 78 0
      node_modules/express/node_modules/connect/lib/middleware/limit.js
  56. 339 0
      node_modules/express/node_modules/connect/lib/middleware/logger.js
  57. 59 0
      node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
  58. 133 0
      node_modules/express/node_modules/connect/lib/middleware/multipart.js
  59. 46 0
      node_modules/express/node_modules/connect/lib/middleware/query.js
  60. 32 0
      node_modules/express/node_modules/connect/lib/middleware/responseTime.js
  61. 355 0
      node_modules/express/node_modules/connect/lib/middleware/session.js
  62. 140 0
      node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
  63. 129 0
      node_modules/express/node_modules/connect/lib/middleware/session/memory.js
  64. 116 0
      node_modules/express/node_modules/connect/lib/middleware/session/session.js
  65. 84 0
      node_modules/express/node_modules/connect/lib/middleware/session/store.js
  66. 95 0
      node_modules/express/node_modules/connect/lib/middleware/static.js
  67. 231 0
      node_modules/express/node_modules/connect/lib/middleware/staticCache.js
  68. 55 0
      node_modules/express/node_modules/connect/lib/middleware/timeout.js
  69. 78 0
      node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
  70. 40 0
      node_modules/express/node_modules/connect/lib/middleware/vhost.js
  71. 79 0
      node_modules/express/node_modules/connect/lib/patch.js
  72. 230 0
      node_modules/express/node_modules/connect/lib/proto.js
  73. 81 0
      node_modules/express/node_modules/connect/lib/public/directory.html
  74. 14 0
      node_modules/express/node_modules/connect/lib/public/error.html
  75. BIN
      node_modules/express/node_modules/connect/lib/public/favicon.ico
  76. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page.png
  77. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_add.png
  78. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
  79. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_code.png
  80. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
  81. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
  82. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
  83. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_error.png
  84. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
  85. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_find.png
  86. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
  87. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_go.png
  88. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_green.png
  89. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_key.png
  90. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
  91. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_link.png
  92. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
  93. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
  94. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_red.png
  95. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
  96. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_save.png
  97. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_white.png
  98. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
  99. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
  100. BIN
      node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png

+ 28 - 3
README.md

@@ -1,4 +1,29 @@
-RetiChess
-=========
+Reti Chess
+==========
 
-Reti Chess is a lightweight version of real-time chess app built in Node.js, Express and Socket.IO
+Reti Chess is opensource chess app built in [Node.js](http://nodejs.org/) with use of [Express framework](http://expressjs.com/) and [Socket.IO](http://socket.io/). Reti Chess also uses [chess.js](https://github.com/jhlywa/chess.js) for move validation and check/mate/draw detection.
+
+Why another online chess?
+-------------------------
+
+The project may be useful resource for poeple willing to learn Node.js and Socket.IO. Read the source code, fork it, add more functionality and learn something. Besides programming, playing chess is also fun!
+
+Why Reti?
+---------
+
+The project is named after famous Czechoslovakian chess player Richard Rรฉti. After him is also named a chess opening which begins with the move: 1. Nf3.
+
+What features chess supports?
+-----------------------------
+
+This is a very lightweight version of chess. You can only play real-time against the human, an AI is not available. Reti Chess doesn't have any timer, the time for a move is unlimited. Although, if you reload the window or disconnect from the game, the game will be cancelled.
+
+People behind this project
+--------------------------
+
+[Roman Matiasko](http://github.com/romanmatiasko/), [Stepan Bujnak](http://github.com/stepanbujnak/) and [Lukas Matiasko](http://github.com/lukasmatiasko/).
+
+License
+_______
+
+Available under [the MIT License (MIT)](http://opensource.org/licenses/MIT).

+ 143 - 0
app.js

@@ -0,0 +1,143 @@
+var express = require('express')
+  , path    = require('path')
+  , crypto  = require('crypto')
+  , http    = require('http');
+
+var app = express();
+
+app.configure(function() {
+  app.set('port', process.env.PORT || 3000);
+  app.set('views', __dirname + '/views');
+  app.set('view engine', 'jade');
+  app.use(express.favicon());
+  app.use(express.logger('dev'));
+  app.use(express.bodyParser());
+  app.use(express.methodOverride());
+  app.use(express.cookieParser('45710b553b5b7293753d03bd3601f70a'));
+  app.use(express.session());
+  app.use(app.router);
+  app.use(express.static(path.join(__dirname, 'public')));
+});
+
+app.configure('development', function() {
+  app.use(express.errorHandler());
+});
+
+app.get('/', function(req, res) {
+  res.render('index');
+});
+
+app.get('/about', function(req, res) {
+  res.render('about');
+});
+
+app.get('/play/:token', function(req, res) {
+  res.render('play', {
+    'token': req.params.token
+  });
+});
+
+var server = http.createServer(app).listen(app.get('port'), function() {
+  console.log("Express server listening on port " + app.get('port'));
+});
+
+var games = {};
+
+/**
+ * Sockets
+ */
+var io = require('socket.io').listen(server, {log: false});
+
+io.sockets.on('connection', function (socket) {
+  socket.on('start', function (data) {
+    var token;
+
+    var b = new Buffer(Math.random() + new Date().getTime() + socket.id);
+    token = b.toString('base64').slice(12, 32);
+
+    games[token] = {
+      'creator': socket,
+      'players': []
+    };
+
+    socket.emit('created', {
+      'token': token
+    });
+  });
+
+  socket.on('join', function (data) {
+    var game, color;
+
+    if (!(data.token in games)) {
+      return;
+    }
+
+    game = games[data.token];
+
+    if (game.players.length > 2) {
+      socket.emit('full');
+      return;
+    } else if (game.players.length == 1) {
+      if (game.players[0].color == 'black') {
+        color = 'white';
+      } else {
+        color = 'black';
+      }
+    } else {
+      var colors = ['black', 'white'];
+
+      color = colors[Math.floor(Math.random() * 2)];
+    }
+
+    games[data.token].players.push({
+      'id': socket.id,
+      'socket': socket,
+      'color': color
+    });
+
+    game.creator.emit('ready', {});
+
+    socket.emit('joined', {
+      'color': color
+    });
+  });
+
+  socket.on('new-move', function (data) {
+    var receiver, game;
+
+    if (!(data.token in games)) {
+      return;
+    }
+
+    game = games[data.token];
+
+    if (game.players[0].id == socket.id) {
+      receiver = game.players[1].socket;
+    } else if (game.players[1].id == socket.id) {
+      receiver = game.players[0].socket;
+    } else {
+      return;
+    }
+
+    receiver.emit('move', {
+      'move': data.move,
+    });
+  });
+
+  socket.on('disconnect', function () {
+    for (token in games) {
+      var game = games[token];
+
+      for (j in game.players) {
+        var player = game.players[j];
+
+        if (player.socket == socket) {
+          var opponent = game.players[Math.abs(j - 1)];
+
+          delete games[token];
+          opponent.socket.emit('opponent-disconnected');
+        }
+      }
+    }
+  });
+});

+ 14 - 0
manifest.yml

@@ -0,0 +1,14 @@
+---
+applications:
+  .:
+    name: retichess
+    framework:
+      name: node
+      info:
+        mem: 64M
+        description: Node.js Application
+        exec: 
+    infra: eu-aws
+    url: ${name}.${target-base}
+    mem: 2G
+    instances: 4

+ 1 - 0
node_modules/.bin/express

@@ -0,0 +1 @@
+../express/bin/express

+ 1 - 0
node_modules/.bin/jade

@@ -0,0 +1 @@
+../jade/bin/jade

+ 9 - 0
node_modules/express/.npmignore

@@ -0,0 +1,9 @@
+.git*
+docs/
+examples/
+support/
+test/
+testing.js
+.DS_Store
+coverage.html
+lib-cov

+ 4 - 0
node_modules/express/.travis.yml

@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+  - "0.8"
+  - "0.10"

+ 1178 - 0
node_modules/express/History.md

@@ -0,0 +1,1178 @@
+
+3.3.3 / 2013-07-04 
+==================
+
+ * update connect
+
+3.3.2 / 2013-07-03 
+==================
+
+ * update connect
+ * update send
+ * remove .version export
+
+3.3.1 / 2013-06-27 
+==================
+
+ * update connect
+
+3.3.0 / 2013-06-26 
+==================
+
+ * update connect
+ * add support for multiple X-Forwarded-Proto values. Closes #1646
+ * change: remove charset from json responses. Closes #1631
+ * change: return actual booleans from req.accept* functions
+ * fix jsonp callback array throw
+
+3.2.6 / 2013-06-02 
+==================
+
+ * update connect
+
+3.2.5 / 2013-05-21 
+==================
+
+ * update connect
+ * update node-cookie
+ * add: throw a meaningful error when there is no default engine
+ * change generation of ETags with res.send() to GET requests only. Closes #1619
+
+3.2.4 / 2013-05-09 
+==================
+  
+  * fix `req.subdomains` when no Host is present
+  * fix `req.host` when no Host is present, return undefined
+
+3.2.3 / 2013-05-07 
+==================
+
+  * update connect / qs
+
+3.2.2 / 2013-05-03 
+==================
+
+  * update qs
+
+3.2.1 / 2013-04-29 
+==================
+
+  * add app.VERB() paths array deprecation warning
+  * update connect
+  * update qs and remove all ~ semver crap
+  * fix: accept number as value of Signed Cookie
+
+3.2.0 / 2013-04-15 
+==================
+
+  * add "view" constructor setting to override view behaviour
+  * add req.acceptsEncoding(name)
+  * add req.acceptedEncodings
+  * revert cookie signature change causing session race conditions
+  * fix sorting of Accept values of the same quality  
+
+3.1.2 / 2013-04-12 
+==================
+
+  * add support for custom Accept parameters
+  * update cookie-signature
+
+3.1.1 / 2013-04-01 
+==================
+
+  * add X-Forwarded-Host support to `req.host`
+  * fix relative redirects  
+  * update mkdirp 
+  * update buffer-crc32
+  * remove legacy app.configure() method from app template.
+
+3.1.0 / 2013-01-25
+==================
+
+  * add support for leading "." in "view engine" setting
+  * add array support to `res.set()`
+  * add node 0.8.x to travis.yml
+  * add "subdomain offset" setting for tweaking `req.subdomains`
+  * add `res.location(url)` implementing `res.redirect()`-like setting of Location
+  * use app.get() for x-powered-by setting for inheritance
+  * fix colons in passwords for `req.auth`
+
+3.0.6 / 2013-01-04
+==================
+
+  * add http verb methods to Router
+  * update connect
+  * fix mangling of the `res.cookie()` options object
+  * fix jsonp whitespace escape. Closes #1132
+
+3.0.5 / 2012-12-19
+==================
+
+  * add throwing when a non-function is passed to a route
+  * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses
+  * revert "add 'etag' option"
+
+3.0.4 / 2012-12-05
+==================
+
+  * add 'etag' option to disable `res.send()` Etags
+  * add escaping of urls in text/plain in `res.redirect()`
+    for old browsers interpreting as html
+  * change crc32 module for a more liberal license
+  * update connect
+
+3.0.3 / 2012-11-13
+==================
+
+  * update connect
+  * update cookie module
+  * fix cookie max-age
+
+3.0.2 / 2012-11-08
+==================
+
+  * add OPTIONS to cors example. Closes #1398
+  * fix route chaining regression. Closes #1397
+
+3.0.1 / 2012-11-01
+==================
+
+  * update connect
+
+3.0.0 / 2012-10-23
+==================
+
+  * add `make clean`
+  * add "Basic" check to req.auth
+  * add `req.auth` test coverage
+  * add cb && cb(payload) to `res.jsonp()`. Closes #1374
+  * add backwards compat for `res.redirect()` status. Closes #1336
+  * add support for `res.json()` to retain previously defined Content-Types. Closes #1349
+  * update connect
+  * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382
+  * remove non-primitive string support for `res.send()`
+  * fix view-locals example. Closes #1370
+  * fix route-separation example
+
+3.0.0rc5 / 2012-09-18
+==================
+
+  * update connect
+  * add redis search example
+  * add static-files example
+  * add "x-powered-by" setting (`app.disable('x-powered-by')`)
+  * add "application/octet-stream" redirect Accept test case. Closes #1317
+
+3.0.0rc4 / 2012-08-30
+==================
+
+  * add `res.jsonp()`. Closes #1307
+  * add "verbose errors" option to error-pages example
+  * add another route example to express(1) so people are not so confused
+  * add redis online user activity tracking example
+  * update connect dep
+  * fix etag quoting. Closes #1310
+  * fix error-pages 404 status
+  * fix jsonp callback char restrictions
+  * remove old OPTIONS default response
+
+3.0.0rc3 / 2012-08-13
+==================
+
+  * update connect dep
+  * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds]
+  * fix `res.render()` clobbering of "locals"
+
+3.0.0rc2 / 2012-08-03
+==================
+
+  * add CORS example
+  * update connect dep
+  * deprecate `.createServer()` & remove old stale examples
+  * fix: escape `res.redirect()` link
+  * fix vhost example
+
+3.0.0rc1 / 2012-07-24
+==================
+
+  * add more examples to view-locals
+  * add scheme-relative redirects (`res.redirect("//foo.com")`) support
+  * update cookie dep
+  * update connect dep
+  * update send dep
+  * fix `express(1)` -h flag, use -H for hogan. Closes #1245
+  * fix `res.sendfile()` socket error handling regression
+
+3.0.0beta7 / 2012-07-16
+==================
+
+  * update connect dep for `send()` root normalization regression
+
+3.0.0beta6 / 2012-07-13
+==================
+
+  * add `err.view` property for view errors. Closes #1226
+  * add "jsonp callback name" setting
+  * add support for "/foo/:bar*" non-greedy matches
+  * change `res.sendfile()` to use `send()` module
+  * change `res.send` to use "response-send" module
+  * remove `app.locals.use` and `res.locals.use`, use regular middleware
+
+3.0.0beta5 / 2012-07-03
+==================
+
+  * add "make check" support
+  * add route-map example
+  * add `res.json(obj, status)` support back for BC
+  * add "methods" dep, remove internal methods module
+  * update connect dep
+  * update auth example to utilize cores pbkdf2
+  * updated tests to use "supertest"
+
+3.0.0beta4 / 2012-06-25
+==================
+
+  * Added `req.auth`
+  * Added `req.range(size)`
+  * Added `res.links(obj)`
+  * Added `res.send(body, status)` support back for backwards compat
+  * Added `.default()` support to `res.format()`
+  * Added 2xx / 304 check to `req.fresh`
+  * Revert "Added + support to the router"
+  * Fixed `res.send()` freshness check, respect res.statusCode
+
+3.0.0beta3 / 2012-06-15
+==================
+
+  * Added hogan `--hjs` to express(1) [nullfirm]
+  * Added another example to content-negotiation
+  * Added `fresh` dep
+  * Changed: `res.send()` always checks freshness
+  * Fixed: expose connects mime module. Cloases #1165
+
+3.0.0beta2 / 2012-06-06
+==================
+
+  * Added `+` support to the router
+  * Added `req.host`
+  * Changed `req.param()` to check route first
+  * Update connect dep
+
+3.0.0beta1 / 2012-06-01
+==================
+
+  * Added `res.format()` callback to override default 406 behaviour
+  * Fixed `res.redirect()` 406. Closes #1154
+
+3.0.0alpha5 / 2012-05-30
+==================
+
+  * Added `req.ip`
+  * Added `{ signed: true }` option to `res.cookie()`
+  * Removed `res.signedCookie()`
+  * Changed: dont reverse `req.ips`
+  * Fixed "trust proxy" setting check for `req.ips`
+
+3.0.0alpha4 / 2012-05-09
+==================
+
+  * Added: allow `[]` in jsonp callback. Closes #1128
+  * Added `PORT` env var support in generated template. Closes #1118 [benatkin]
+  * Updated: connect 2.2.2
+
+3.0.0alpha3 / 2012-05-04
+==================
+
+  * Added public `app.routes`. Closes #887
+  * Added _view-locals_ example
+  * Added _mvc_ example
+  * Added `res.locals.use()`. Closes #1120
+  * Added conditional-GET support to `res.send()`
+  * Added: coerce `res.set()` values to strings
+  * Changed: moved `static()` in generated apps below router
+  * Changed: `res.send()` only set ETag when not previously set
+  * Changed connect 2.2.1 dep
+  * Changed: `make test` now runs unit / acceptance tests
+  * Fixed req/res proto inheritance
+
+3.0.0alpha2 / 2012-04-26
+==================
+
+  * Added `make benchmark` back
+  * Added `res.send()` support for `String` objects
+  * Added client-side data exposing example
+  * Added `res.header()` and `req.header()` aliases for BC
+  * Added `express.createServer()` for BC
+  * Perf: memoize parsed urls
+  * Perf: connect 2.2.0 dep
+  * Changed: make `expressInit()` middleware self-aware
+  * Fixed: use app.get() for all core settings
+  * Fixed redis session example
+  * Fixed session example. Closes #1105
+  * Fixed generated express dep. Closes #1078
+
+3.0.0alpha1 / 2012-04-15
+==================
+
+  * Added `app.locals.use(callback)`
+  * Added `app.locals` object
+  * Added `app.locals(obj)`
+  * Added `res.locals` object
+  * Added `res.locals(obj)`
+  * Added `res.format()` for content-negotiation
+  * Added `app.engine()`
+  * Added `res.cookie()` JSON cookie support
+  * Added "trust proxy" setting
+  * Added `req.subdomains`
+  * Added `req.protocol`
+  * Added `req.secure`
+  * Added `req.path`
+  * Added `req.ips`
+  * Added `req.fresh`
+  * Added `req.stale`
+  * Added comma-delmited / array support for `req.accepts()`
+  * Added debug instrumentation
+  * Added `res.set(obj)`
+  * Added `res.set(field, value)`
+  * Added `res.get(field)`
+  * Added `app.get(setting)`. Closes #842
+  * Added `req.acceptsLanguage()`
+  * Added `req.acceptsCharset()`
+  * Added `req.accepted`
+  * Added `req.acceptedLanguages`
+  * Added `req.acceptedCharsets`
+  * Added "json replacer" setting
+  * Added "json spaces" setting
+  * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92
+  * Added `--less` support to express(1)
+  * Added `express.response` prototype
+  * Added `express.request` prototype
+  * Added `express.application` prototype
+  * Added `app.path()`
+  * Added `app.render()`
+  * Added `res.type()` to replace `res.contentType()`
+  * Changed: `res.redirect()` to add relative support
+  * Changed: enable "jsonp callback" by default
+  * Changed: renamed "case sensitive routes" to "case sensitive routing"
+  * Rewrite of all tests with mocha
+  * Removed "root" setting
+  * Removed `res.redirect('home')` support
+  * Removed `req.notify()`
+  * Removed `app.register()`
+  * Removed `app.redirect()`
+  * Removed `app.is()`
+  * Removed `app.helpers()`
+  * Removed `app.dynamicHelpers()`
+  * Fixed `res.sendfile()` with non-GET. Closes #723
+  * Fixed express(1) public dir for windows. Closes #866
+
+2.5.9/ 2012-04-02
+==================
+
+  * Added support for PURGE request method [pbuyle]
+  * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki]
+
+2.5.8 / 2012-02-08
+==================
+
+  * Update mkdirp dep. Closes #991
+
+2.5.7 / 2012-02-06
+==================
+
+  * Fixed `app.all` duplicate DELETE requests [mscdex]
+
+2.5.6 / 2012-01-13
+==================
+
+  * Updated hamljs dev dep. Closes #953
+
+2.5.5 / 2012-01-08
+==================
+
+  * Fixed: set `filename` on cached templates [matthewleon]
+
+2.5.4 / 2012-01-02
+==================
+
+  * Fixed `express(1)` eol on 0.4.x. Closes #947
+
+2.5.3 / 2011-12-30
+==================
+
+  * Fixed `req.is()` when a charset is present
+
+2.5.2 / 2011-12-10
+==================
+
+  * Fixed: express(1) LF -> CRLF for windows
+
+2.5.1 / 2011-11-17
+==================
+
+  * Changed: updated connect to 1.8.x
+  * Removed sass.js support from express(1)
+
+2.5.0 / 2011-10-24
+==================
+
+  * Added ./routes dir for generated app by default
+  * Added npm install reminder to express(1) app gen
+  * Added 0.5.x support
+  * Removed `make test-cov` since it wont work with node 0.5.x
+  * Fixed express(1) public dir for windows. Closes #866
+
+2.4.7 / 2011-10-05
+==================
+
+  * Added mkdirp to express(1). Closes #795
+  * Added simple _json-config_ example
+  * Added  shorthand for the parsed request's pathname via `req.path`
+  * Changed connect dep to 1.7.x to fix npm issue...
+  * Fixed `res.redirect()` __HEAD__ support. [reported by xerox]
+  * Fixed `req.flash()`, only escape args
+  * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie]
+
+2.4.6 / 2011-08-22
+==================
+
+  * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode]
+
+2.4.5 / 2011-08-19
+==================
+
+  * Added support for routes to handle errors. Closes #809
+  * Added `app.routes.all()`. Closes #803
+  * Added "basepath" setting to work in conjunction with reverse proxies etc.
+  * Refactored `Route` to use a single array of callbacks
+  * Added support for multiple callbacks for `app.param()`. Closes #801
+Closes #805
+  * Changed: removed .call(self) for route callbacks
+  * Dependency: `qs >= 0.3.1`
+  * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808
+
+2.4.4 / 2011-08-05
+==================
+
+  * Fixed `res.header()` intention of a set, even when `undefined`
+  * Fixed `*`, value no longer required
+  * Fixed `res.send(204)` support. Closes #771
+
+2.4.3 / 2011-07-14
+==================
+
+  * Added docs for `status` option special-case. Closes #739
+  * Fixed `options.filename`, exposing the view path to template engines
+
+2.4.2. / 2011-07-06
+==================
+
+  * Revert "removed jsonp stripping" for XSS
+
+2.4.1 / 2011-07-06
+==================
+
+  * Added `res.json()` JSONP support. Closes #737
+  * Added _extending-templates_ example. Closes #730
+  * Added "strict routing" setting for trailing slashes
+  * Added support for multiple envs in `app.configure()` calls. Closes #735
+  * Changed: `res.send()` using `res.json()`
+  * Changed: when cookie `path === null` don't default it
+  * Changed; default cookie path to "home" setting. Closes #731
+  * Removed _pids/logs_ creation from express(1)
+
+2.4.0 / 2011-06-28
+==================
+
+  * Added chainable `res.status(code)`
+  * Added `res.json()`, an explicit version of `res.send(obj)`
+  * Added simple web-service example
+
+2.3.12 / 2011-06-22
+==================
+
+  * \#express is now on freenode! come join!
+  * Added `req.get(field, param)`
+  * Added links to Japanese documentation, thanks @hideyukisaito!
+  * Added; the `express(1)` generated app outputs the env
+  * Added `content-negotiation` example
+  * Dependency: connect >= 1.5.1 < 2.0.0
+  * Fixed view layout bug. Closes #720
+  * Fixed; ignore body on 304. Closes #701
+
+2.3.11 / 2011-06-04
+==================
+
+  * Added `npm test`
+  * Removed generation of dummy test file from `express(1)`
+  * Fixed; `express(1)` adds express as a dep
+  * Fixed; prune on `prepublish`
+
+2.3.10 / 2011-05-27
+==================
+
+  * Added `req.route`, exposing the current route
+  * Added _package.json_ generation support to `express(1)`
+  * Fixed call to `app.param()` function for optional params. Closes #682
+
+2.3.9 / 2011-05-25
+==================
+
+  * Fixed bug-ish with `../' in `res.partial()` calls
+
+2.3.8 / 2011-05-24
+==================
+
+  * Fixed `app.options()`
+
+2.3.7 / 2011-05-23
+==================
+
+  * Added route `Collection`, ex: `app.get('/user/:id').remove();`
+  * Added support for `app.param(fn)` to define param logic
+  * Removed `app.param()` support for callback with return value
+  * Removed module.parent check from express(1) generated app. Closes #670
+  * Refactored router. Closes #639
+
+2.3.6 / 2011-05-20
+==================
+
+  * Changed; using devDependencies instead of git submodules
+  * Fixed redis session example
+  * Fixed markdown example
+  * Fixed view caching, should not be enabled in development
+
+2.3.5 / 2011-05-20
+==================
+
+  * Added export `.view` as alias for `.View`
+
+2.3.4 / 2011-05-08
+==================
+
+  * Added `./examples/say`
+  * Fixed `res.sendfile()` bug preventing the transfer of files with spaces
+
+2.3.3 / 2011-05-03
+==================
+
+  * Added "case sensitive routes" option.
+  * Changed; split methods supported per rfc [slaskis]
+  * Fixed route-specific middleware when using the same callback function several times
+
+2.3.2 / 2011-04-27
+==================
+
+  * Fixed view hints
+
+2.3.1 / 2011-04-26
+==================
+
+  * Added `app.match()` as `app.match.all()`
+  * Added `app.lookup()` as `app.lookup.all()`
+  * Added `app.remove()` for `app.remove.all()`
+  * Added `app.remove.VERB()`
+  * Fixed template caching collision issue. Closes #644
+  * Moved router over from connect and started refactor
+
+2.3.0 / 2011-04-25
+==================
+
+  * Added options support to `res.clearCookie()`
+  * Added `res.helpers()` as alias of `res.locals()`
+  * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel   * Dependency `connect >= 1.4.0`
+  * Changed; auto set Content-Type in res.attachement [Aaron Heckmann]
+  * Renamed "cache views" to "view cache". Closes #628
+  * Fixed caching of views when using several apps. Closes #637
+  * Fixed gotcha invoking `app.param()` callbacks once per route middleware.
+Closes #638
+  * Fixed partial lookup precedence. Closes #631
+Shaw]
+
+2.2.2 / 2011-04-12
+==================
+
+  * Added second callback support for `res.download()` connection errors
+  * Fixed `filename` option passing to template engine
+
+2.2.1 / 2011-04-04
+==================
+
+  * Added `layout(path)` helper to change the layout within a view. Closes #610
+  * Fixed `partial()` collection object support.
+    Previously only anything with `.length` would work.
+    When `.length` is present one must still be aware of holes,
+    however now `{ collection: {foo: 'bar'}}` is valid, exposes
+    `keyInCollection` and `keysInCollection`.
+
+  * Performance improved with better view caching
+  * Removed `request` and `response` locals
+  * Changed; errorHandler page title is now `Express` instead of `Connect`
+
+2.2.0 / 2011-03-30
+==================
+
+  * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606
+  * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606
+  * Added `app.VERB(path)` as alias of `app.lookup.VERB()`.
+  * Dependency `connect >= 1.2.0`
+
+2.1.1 / 2011-03-29
+==================
+
+  * Added; expose `err.view` object when failing to locate a view
+  * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann]
+  * Fixed; `res.send(undefined)` responds with 204 [aheckmann]
+
+2.1.0 / 2011-03-24
+==================
+
+  * Added `<root>/_?<name>` partial lookup support. Closes #447
+  * Added `request`, `response`, and `app` local variables
+  * Added `settings` local variable, containing the app's settings
+  * Added `req.flash()` exception if `req.session` is not available
+  * Added `res.send(bool)` support (json response)
+  * Fixed stylus example for latest version
+  * Fixed; wrap try/catch around `res.render()`
+
+2.0.0 / 2011-03-17
+==================
+
+  * Fixed up index view path alternative.
+  * Changed; `res.locals()` without object returns the locals
+
+2.0.0rc3 / 2011-03-17
+==================
+
+  * Added `res.locals(obj)` to compliment `res.local(key, val)`
+  * Added `res.partial()` callback support
+  * Fixed recursive error reporting issue in `res.render()`
+
+2.0.0rc2 / 2011-03-17
+==================
+
+  * Changed; `partial()` "locals" are now optional
+  * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01]
+  * Fixed .filename view engine option [reported by drudge]
+  * Fixed blog example
+  * Fixed `{req,res}.app` reference when mounting [Ben Weaver]
+
+2.0.0rc / 2011-03-14
+==================
+
+  * Fixed; expose `HTTPSServer` constructor
+  * Fixed express(1) default test charset. Closes #579 [reported by secoif]
+  * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP]
+
+2.0.0beta3 / 2011-03-09
+==================
+
+  * Added support for `res.contentType()` literal
+    The original `res.contentType('.json')`,
+    `res.contentType('application/json')`, and `res.contentType('json')`
+    will work now.
+  * Added `res.render()` status option support back
+  * Added charset option for `res.render()`
+  * Added `.charset` support (via connect 1.0.4)
+  * Added view resolution hints when in development and a lookup fails
+  * Added layout lookup support relative to the page view.
+    For example while rendering `./views/user/index.jade` if you create
+    `./views/user/layout.jade` it will be used in favour of the root layout.
+  * Fixed `res.redirect()`. RFC states absolute url [reported by unlink]
+  * Fixed; default `res.send()` string charset to utf8
+  * Removed `Partial` constructor (not currently used)
+
+2.0.0beta2 / 2011-03-07
+==================
+
+  * Added res.render() `.locals` support back to aid in migration process
+  * Fixed flash example
+
+2.0.0beta / 2011-03-03
+==================
+
+  * Added HTTPS support
+  * Added `res.cookie()` maxAge support
+  * Added `req.header()` _Referrer_ / _Referer_ special-case, either works
+  * Added mount support for `res.redirect()`, now respects the mount-point
+  * Added `union()` util, taking place of `merge(clone())` combo
+  * Added stylus support to express(1) generated app
+  * Added secret to session middleware used in examples and generated app
+  * Added `res.local(name, val)` for progressive view locals
+  * Added default param support to `req.param(name, default)`
+  * Added `app.disabled()` and `app.enabled()`
+  * Added `app.register()` support for omitting leading ".", either works
+  * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539
+  * Added `app.param()` to map route params to async/sync logic
+  * Added; aliased `app.helpers()` as `app.locals()`. Closes #481
+  * Added extname with no leading "." support to `res.contentType()`
+  * Added `cache views` setting, defaulting to enabled in "production" env
+  * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_.
+  * Added `req.accepts()` support for extensions
+  * Changed; `res.download()` and `res.sendfile()` now utilize Connect's
+    static file server `connect.static.send()`.
+  * Changed; replaced `connect.utils.mime()` with npm _mime_ module
+  * Changed; allow `req.query` to be pre-defined (via middleware or other parent
+  * Changed view partial resolution, now relative to parent view
+  * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`.
+  * Fixed `req.param()` bug returning Array.prototype methods. Closes #552
+  * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()`
+  * Fixed; using _qs_ module instead of _querystring_
+  * Fixed; strip unsafe chars from jsonp callbacks
+  * Removed "stream threshold" setting
+
+1.0.8 / 2011-03-01
+==================
+
+  * Allow `req.query` to be pre-defined (via middleware or other parent app)
+  * "connect": ">= 0.5.0 < 1.0.0". Closes #547
+  * Removed the long deprecated __EXPRESS_ENV__ support
+
+1.0.7 / 2011-02-07
+==================
+
+  * Fixed `render()` setting inheritance.
+    Mounted apps would not inherit "view engine"
+
+1.0.6 / 2011-02-07
+==================
+
+  * Fixed `view engine` setting bug when period is in dirname
+
+1.0.5 / 2011-02-05
+==================
+
+  * Added secret to generated app `session()` call
+
+1.0.4 / 2011-02-05
+==================
+
+  * Added `qs` dependency to _package.json_
+  * Fixed namespaced `require()`s for latest connect support
+
+1.0.3 / 2011-01-13
+==================
+
+  * Remove unsafe characters from JSONP callback names [Ryan Grove]
+
+1.0.2 / 2011-01-10
+==================
+
+  * Removed nested require, using `connect.router`
+
+1.0.1 / 2010-12-29
+==================
+
+  * Fixed for middleware stacked via `createServer()`
+    previously the `foo` middleware passed to `createServer(foo)`
+    would not have access to Express methods such as `res.send()`
+    or props like `req.query` etc.
+
+1.0.0 / 2010-11-16
+==================
+
+  * Added; deduce partial object names from the last segment.
+    For example by default `partial('forum/post', postObject)` will
+    give you the _post_ object, providing a meaningful default.
+  * Added http status code string representation to `res.redirect()` body
+  * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__.
+  * Added `req.is()` to aid in content negotiation
+  * Added partial local inheritance [suggested by masylum]. Closes #102
+    providing access to parent template locals.
+  * Added _-s, --session[s]_ flag to express(1) to add session related middleware
+  * Added _--template_ flag to express(1) to specify the
+    template engine to use.
+  * Added _--css_ flag to express(1) to specify the
+    stylesheet engine to use (or just plain css by default).
+  * Added `app.all()` support [thanks aheckmann]
+  * Added partial direct object support.
+    You may now `partial('user', user)` providing the "user" local,
+    vs previously `partial('user', { object: user })`.
+  * Added _route-separation_ example since many people question ways
+    to do this with CommonJS modules. Also view the _blog_ example for
+    an alternative.
+  * Performance; caching view path derived partial object names
+  * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454
+  * Fixed jsonp support; _text/javascript_ as per mailinglist discussion
+
+1.0.0rc4 / 2010-10-14
+==================
+
+  * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0
+  * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware))
+  * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass]
+  * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass]
+  * Added `partial()` support for array-like collections. Closes #434
+  * Added support for swappable querystring parsers
+  * Added session usage docs. Closes #443
+  * Added dynamic helper caching. Closes #439 [suggested by maritz]
+  * Added authentication example
+  * Added basic Range support to `res.sendfile()` (and `res.download()` etc)
+  * Changed; `express(1)` generated app using 2 spaces instead of 4
+  * Default env to "development" again [aheckmann]
+  * Removed _context_ option is no more, use "scope"
+  * Fixed; exposing _./support_ libs to examples so they can run without installs
+  * Fixed mvc example
+
+1.0.0rc3 / 2010-09-20
+==================
+
+  * Added confirmation for `express(1)` app generation. Closes #391
+  * Added extending of flash formatters via `app.flashFormatters`
+  * Added flash formatter support. Closes #411
+  * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold"
+  * Added _stream threshold_ setting for `res.sendfile()`
+  * Added `res.send()` __HEAD__ support
+  * Added `res.clearCookie()`
+  * Added `res.cookie()`
+  * Added `res.render()` headers option
+  * Added `res.redirect()` response bodies
+  * Added `res.render()` status option support. Closes #425 [thanks aheckmann]
+  * Fixed `res.sendfile()` responding with 403 on malicious path
+  * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_
+  * Fixed; mounted apps settings now inherit from parent app [aheckmann]
+  * Fixed; stripping Content-Length / Content-Type when 204
+  * Fixed `res.send()` 204. Closes #419
+  * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402
+  * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo]
+
+
+1.0.0rc2 / 2010-08-17
+==================
+
+  * Added `app.register()` for template engine mapping. Closes #390
+  * Added `res.render()` callback support as second argument (no options)
+  * Added callback support to `res.download()`
+  * Added callback support for `res.sendfile()`
+  * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()`
+  * Added "partials" setting to docs
+  * Added default expresso tests to `express(1)` generated app. Closes #384
+  * Fixed `res.sendfile()` error handling, defer via `next()`
+  * Fixed `res.render()` callback when a layout is used [thanks guillermo]
+  * Fixed; `make install` creating ~/.node_libraries when not present
+  * Fixed issue preventing error handlers from being defined anywhere. Closes #387
+
+1.0.0rc / 2010-07-28
+==================
+
+  * Added mounted hook. Closes #369
+  * Added connect dependency to _package.json_
+
+  * Removed "reload views" setting and support code
+    development env never caches, production always caches.
+
+  * Removed _param_ in route callbacks, signature is now
+    simply (req, res, next), previously (req, res, params, next).
+    Use _req.params_ for path captures, _req.query_ for GET params.
+
+  * Fixed "home" setting
+  * Fixed middleware/router precedence issue. Closes #366
+  * Fixed; _configure()_ callbacks called immediately. Closes #368
+
+1.0.0beta2 / 2010-07-23
+==================
+
+  * Added more examples
+  * Added; exporting `Server` constructor
+  * Added `Server#helpers()` for view locals
+  * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349
+  * Added support for absolute view paths
+  * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363
+  * Added Guillermo Rauch to the contributor list
+  * Added support for "as" for non-collection partials. Closes #341
+  * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf]
+  * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo]
+  * Fixed instanceof `Array` checks, now `Array.isArray()`
+  * Fixed express(1) expansion of public dirs. Closes #348
+  * Fixed middleware precedence. Closes #345
+  * Fixed view watcher, now async [thanks aheckmann]
+
+1.0.0beta / 2010-07-15
+==================
+
+  * Re-write
+    - much faster
+    - much lighter
+    - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs
+
+0.14.0 / 2010-06-15
+==================
+
+  * Utilize relative requires
+  * Added Static bufferSize option [aheckmann]
+  * Fixed caching of view and partial subdirectories [aheckmann]
+  * Fixed mime.type() comments now that ".ext" is not supported
+  * Updated haml submodule
+  * Updated class submodule
+  * Removed bin/express
+
+0.13.0 / 2010-06-01
+==================
+
+  * Added node v0.1.97 compatibility
+  * Added support for deleting cookies via Request#cookie('key', null)
+  * Updated haml submodule
+  * Fixed not-found page, now using using charset utf-8
+  * Fixed show-exceptions page, now using using charset utf-8
+  * Fixed view support due to fs.readFile Buffers
+  * Changed; mime.type() no longer accepts ".type" due to node extname() changes
+
+0.12.0 / 2010-05-22
+==================
+
+  * Added node v0.1.96 compatibility
+  * Added view `helpers` export which act as additional local variables
+  * Updated haml submodule
+  * Changed ETag; removed inode, modified time only
+  * Fixed LF to CRLF for setting multiple cookies
+  * Fixed cookie complation; values are now urlencoded
+  * Fixed cookies parsing; accepts quoted values and url escaped cookies
+
+0.11.0 / 2010-05-06
+==================
+
+  * Added support for layouts using different engines
+    - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' })
+    - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml'
+    - this.render('page.html.haml', { layout: false }) // no layout
+  * Updated ext submodule
+  * Updated haml submodule
+  * Fixed EJS partial support by passing along the context. Issue #307
+
+0.10.1 / 2010-05-03
+==================
+
+  * Fixed binary uploads.
+
+0.10.0 / 2010-04-30
+==================
+
+  * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s
+    encoding is set to 'utf8' or 'utf-8'.
+  * Added "encoding" option to Request#render(). Closes #299
+  * Added "dump exceptions" setting, which is enabled by default.
+  * Added simple ejs template engine support
+  * Added error reponse support for text/plain, application/json. Closes #297
+  * Added callback function param to Request#error()
+  * Added Request#sendHead()
+  * Added Request#stream()
+  * Added support for Request#respond(304, null) for empty response bodies
+  * Added ETag support to Request#sendfile()
+  * Added options to Request#sendfile(), passed to fs.createReadStream()
+  * Added filename arg to Request#download()
+  * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request
+  * Performance enhanced by preventing several calls to toLowerCase() in Router#match()
+  * Changed; Request#sendfile() now streams
+  * Changed; Renamed Request#halt() to Request#respond(). Closes #289
+  * Changed; Using sys.inspect() instead of JSON.encode() for error output
+  * Changed; run() returns the http.Server instance. Closes #298
+  * Changed; Defaulting Server#host to null (INADDR_ANY)
+  * Changed; Logger "common" format scale of 0.4f
+  * Removed Logger "request" format
+  * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found
+  * Fixed several issues with http client
+  * Fixed Logger Content-Length output
+  * Fixed bug preventing Opera from retaining the generated session id. Closes #292
+
+0.9.0 / 2010-04-14
+==================
+
+  * Added DSL level error() route support
+  * Added DSL level notFound() route support
+  * Added Request#error()
+  * Added Request#notFound()
+  * Added Request#render() callback function. Closes #258
+  * Added "max upload size" setting
+  * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254
+  * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js
+  * Added callback function support to Request#halt() as 3rd/4th arg
+  * Added preprocessing of route param wildcards using param(). Closes #251
+  * Added view partial support (with collections etc)
+  * Fixed bug preventing falsey params (such as ?page=0). Closes #286
+  * Fixed setting of multiple cookies. Closes #199
+  * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml)
+  * Changed; session cookie is now httpOnly
+  * Changed; Request is no longer global
+  * Changed; Event is no longer global
+  * Changed; "sys" module is no longer global
+  * Changed; moved Request#download to Static plugin where it belongs
+  * Changed; Request instance created before body parsing. Closes #262
+  * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253
+  * Changed; Pre-caching view partials in memory when "cache view partials" is enabled
+  * Updated support to node --version 0.1.90
+  * Updated dependencies
+  * Removed set("session cookie") in favour of use(Session, { cookie: { ... }})
+  * Removed utils.mixin(); use Object#mergeDeep()
+
+0.8.0 / 2010-03-19
+==================
+
+  * Added coffeescript example app. Closes #242
+  * Changed; cache api now async friendly. Closes #240
+  * Removed deprecated 'express/static' support. Use 'express/plugins/static'
+
+0.7.6 / 2010-03-19
+==================
+
+  * Added Request#isXHR. Closes #229
+  * Added `make install` (for the executable)
+  * Added `express` executable for setting up simple app templates
+  * Added "GET /public/*" to Static plugin, defaulting to <root>/public
+  * Added Static plugin
+  * Fixed; Request#render() only calls cache.get() once
+  * Fixed; Namespacing View caches with "view:"
+  * Fixed; Namespacing Static caches with "static:"
+  * Fixed; Both example apps now use the Static plugin
+  * Fixed set("views"). Closes #239
+  * Fixed missing space for combined log format
+  * Deprecated Request#sendfile() and 'express/static'
+  * Removed Server#running
+
+0.7.5 / 2010-03-16
+==================
+
+  * Added Request#flash() support without args, now returns all flashes
+  * Updated ext submodule
+
+0.7.4 / 2010-03-16
+==================
+
+  * Fixed session reaper
+  * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft)
+
+0.7.3 / 2010-03-16
+==================
+
+  * Added package.json
+  * Fixed requiring of haml / sass due to kiwi removal
+
+0.7.2 / 2010-03-16
+==================
+
+  * Fixed GIT submodules (HAH!)
+
+0.7.1 / 2010-03-16
+==================
+
+  * Changed; Express now using submodules again until a PM is adopted
+  * Changed; chat example using millisecond conversions from ext
+
+0.7.0 / 2010-03-15
+==================
+
+  * Added Request#pass() support (finds the next matching route, or the given path)
+  * Added Logger plugin (default "common" format replaces CommonLogger)
+  * Removed Profiler plugin
+  * Removed CommonLogger plugin
+
+0.6.0 / 2010-03-11
+==================
+
+  * Added seed.yml for kiwi package management support
+  * Added HTTP client query string support when method is GET. Closes #205
+
+  * Added support for arbitrary view engines.
+    For example "foo.engine.html" will now require('engine'),
+    the exports from this module are cached after the first require().
+
+  * Added async plugin support
+
+  * Removed usage of RESTful route funcs as http client
+    get() etc, use http.get() and friends
+
+  * Removed custom exceptions
+
+0.5.0 / 2010-03-10
+==================
+
+  * Added ext dependency (library of js extensions)
+  * Removed extname() / basename() utils. Use path module
+  * Removed toArray() util. Use arguments.values
+  * Removed escapeRegexp() util. Use RegExp.escape()
+  * Removed process.mixin() dependency. Use utils.mixin()
+  * Removed Collection
+  * Removed ElementCollection
+  * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com)  ;)
+
+0.4.0 / 2010-02-11
+==================
+
+  * Added flash() example to sample upload app
+  * Added high level restful http client module (express/http)
+  * Changed; RESTful route functions double as HTTP clients. Closes #69
+  * Changed; throwing error when routes are added at runtime
+  * Changed; defaulting render() context to the current Request. Closes #197
+  * Updated haml submodule
+
+0.3.0 / 2010-02-11
+==================
+
+  * Updated haml / sass submodules. Closes #200
+  * Added flash message support. Closes #64
+  * Added accepts() now allows multiple args. fixes #117
+  * Added support for plugins to halt. Closes #189
+  * Added alternate layout support. Closes #119
+  * Removed Route#run(). Closes #188
+  * Fixed broken specs due to use(Cookie) missing
+
+0.2.1 / 2010-02-05
+==================
+
+  * Added "plot" format option for Profiler (for gnuplot processing)
+  * Added request number to Profiler plugin
+  * Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8
+  * Fixed issue with routes not firing when not files are present. Closes #184
+  * Fixed process.Promise -> events.Promise
+
+0.2.0 / 2010-02-03
+==================
+
+  * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180
+  * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174
+  * Added expiration support to cache api with reaper. Closes #133
+  * Added cache Store.Memory#reap()
+  * Added Cache; cache api now uses first class Cache instances
+  * Added abstract session Store. Closes #172
+  * Changed; cache Memory.Store#get() utilizing Collection
+  * Renamed MemoryStore -> Store.Memory
+  * Fixed use() of the same plugin several time will always use latest options. Closes #176
+
+0.1.0 / 2010-02-03
+==================
+
+  * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context
+  * Updated node support to 0.1.27 Closes #169
+  * Updated dirname(__filename) -> __dirname
+  * Updated libxmljs support to v0.2.0
+  * Added session support with memory store / reaping
+  * Added quick uid() helper
+  * Added multi-part upload support
+  * Added Sass.js support / submodule
+  * Added production env caching view contents and static files
+  * Added static file caching. Closes #136
+  * Added cache plugin with memory stores
+  * Added support to StaticFile so that it works with non-textual files.
+  * Removed dirname() helper
+  * Removed several globals (now their modules must be required)
+
+0.0.2 / 2010-01-10
+==================
+
+  * Added view benchmarks; currently haml vs ejs
+  * Added Request#attachment() specs. Closes #116
+  * Added use of node's parseQuery() util. Closes #123
+  * Added `make init` for submodules
+  * Updated Haml
+  * Updated sample chat app to show messages on load
+  * Updated libxmljs parseString -> parseHtmlString
+  * Fixed `make init` to work with older versions of git
+  * Fixed specs can now run independant specs for those who cant build deps. Closes #127
+  * Fixed issues introduced by the node url module changes. Closes 126.
+  * Fixed two assertions failing due to Collection#keys() returning strings
+  * Fixed faulty Collection#toArray() spec due to keys() returning strings
+  * Fixed `make test` now builds libxmljs.node before testing
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release

+ 22 - 0
node_modules/express/LICENSE

@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2009-2011 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 33 - 0
node_modules/express/Makefile

@@ -0,0 +1,33 @@
+
+MOCHA_OPTS= --check-leaks
+REPORTER = dot
+
+check: test
+
+test: test-unit test-acceptance
+
+test-unit:
+	@NODE_ENV=test ./node_modules/.bin/mocha \
+		--reporter $(REPORTER) \
+		$(MOCHA_OPTS)
+
+test-acceptance:
+	@NODE_ENV=test ./node_modules/.bin/mocha \
+		--reporter $(REPORTER) \
+		--bail \
+		test/acceptance/*.js
+
+test-cov: lib-cov
+	@EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
+
+lib-cov:
+	@jscoverage lib lib-cov
+
+benchmark:
+	@./support/bench
+
+clean:
+	rm -f coverage.html
+	rm -fr lib-cov
+
+.PHONY: test test-unit test-acceptance benchmark clean

+ 179 - 0
node_modules/express/Readme.md

@@ -0,0 +1,179 @@
+![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)
+
+  Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express)
+
+```js
+var express = require('express');
+var app = express();
+
+app.get('/', function(req, res){
+  res.send('Hello World');
+});
+
+app.listen(3000);
+```
+
+## Installation
+
+    $ npm install -g express
+
+## Quick Start
+
+ The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
+
+ Create the app:
+
+    $ npm install -g express
+    $ express /tmp/foo && cd /tmp/foo
+
+ Install dependencies:
+
+    $ npm install
+
+ Start the server:
+
+    $ node app
+
+## Features
+
+  * Built on [Connect](http://github.com/senchalabs/connect)
+  * Robust routing
+  * HTTP helpers (redirection, caching, etc)
+  * View system supporting 14+ template engines
+  * Content negotiation
+  * Focus on high performance
+  * Environment based configuration
+  * Executable for generating applications quickly
+  * High test coverage
+
+## Philosophy
+
+  The Express philosophy is to provide small, robust tooling for HTTP servers. Making
+  it a great solution for single page applications, web sites, hybrids, or public
+  HTTP APIs.
+
+  Built on Connect you can use _only_ what you need, and nothing more, applications
+  can be as big or as small as you like, even a single file. Express does
+  not force you to use any specific ORM or template engine. With support for over
+  14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)
+  you can quickly craft your perfect framework.
+
+## More Information
+
+  * Join #express on freenode
+  * [Google Group](http://groups.google.com/group/express-js) for discussion
+  * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
+  * Visit the [Wiki](http://github.com/visionmedia/express/wiki)
+  * [ะ ัƒััะบะพัะทั‹ั‡ะฝะฐั ะดะพะบัƒะผะตะฝั‚ะฐั†ะธั](http://jsman.ru/express/)
+  * Run express examples [online](https://runnable.com/express)
+
+## Viewing Examples
+
+Clone the Express repo, then install the dev dependencies to install all the example / test suite deps:
+
+    $ git clone git://github.com/visionmedia/express.git --depth 1
+    $ cd express
+    $ npm install
+
+then run whichever tests you want:
+
+    $ node examples/content-negotiation
+
+## Running Tests
+
+To run the test suite first invoke the following command within the repo, installing the development dependencies:
+
+    $ npm install
+
+then run the tests:
+
+    $ make test
+
+## Contributors
+
+```
+project: express
+commits: 3559
+active : 468 days
+files  : 237
+authors:
+ 1891	Tj Holowaychuk          53.1%
+ 1285	visionmedia             36.1%
+  182	TJ Holowaychuk          5.1%
+   54	Aaron Heckmann          1.5%
+   34	csausdev                1.0%
+   26	ciaranj                 0.7%
+   21	Robert Skรถld            0.6%
+    6	Guillermo Rauch         0.2%
+    3	Dav Glass               0.1%
+    3	Nick Poulden            0.1%
+    2	Randy Merrill           0.1%
+    2	Benny Wong              0.1%
+    2	Hunter Loftis           0.1%
+    2	Jake Gordon             0.1%
+    2	Brian McKinney          0.1%
+    2	Roman Shtylman          0.1%
+    2	Ben Weaver              0.1%
+    2	Dave Hoover             0.1%
+    2	Eivind Fjeldstad        0.1%
+    2	Daniel Shaw             0.1%
+    1	Matt Colyer             0.0%
+    1	Pau Ramon               0.0%
+    1	Pero Pejovic            0.0%
+    1	Peter Rekdal Sunde      0.0%
+    1	Raynos                  0.0%
+    1	Teng Siong Ong          0.0%
+    1	Viktor Kelemen          0.0%
+    1	ctide                   0.0%
+    1	8bitDesigner            0.0%
+    1	isaacs                  0.0%
+    1	mgutz                   0.0%
+    1	pikeas                  0.0%
+    1	shuwatto                0.0%
+    1	tstrimple               0.0%
+    1	ewoudj                  0.0%
+    1	Adam Sanderson          0.0%
+    1	Andrii Kostenko         0.0%
+    1	Andy Hiew               0.0%
+    1	Arpad Borsos            0.0%
+    1	Ashwin Purohit          0.0%
+    1	Benjen                  0.0%
+    1	Darren Torpey           0.0%
+    1	Greg Ritter             0.0%
+    1	Gregory Ritter          0.0%
+    1	James Herdman           0.0%
+    1	Jim Snodgrass           0.0%
+    1	Joe McCann              0.0%
+    1	Jonathan Dumaine        0.0%
+    1	Jonathan Palardy        0.0%
+    1	Jonathan Zacsh          0.0%
+    1	Justin Lilly            0.0%
+    1	Ken Sato                0.0%
+    1	Maciej Maล‚ecki          0.0%
+    1	Masahiro Hayashi        0.0%
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 422 - 0
node_modules/express/bin/express

@@ -0,0 +1,422 @@
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var exec = require('child_process').exec
+  , program = require('commander')
+  , mkdirp = require('mkdirp')
+  , pkg = require('../package.json')
+  , version = pkg.version
+  , os = require('os')
+  , fs = require('fs');
+
+// CLI
+
+program
+  .version(version)
+  .option('-s, --sessions', 'add session support')
+  .option('-e, --ejs', 'add ejs engine support (defaults to jade)')
+  .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
+  .option('-H, --hogan', 'add hogan.js engine support')
+  .option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
+  .option('-f, --force', 'force on non-empty directory')
+  .parse(process.argv);
+
+// Path
+
+var path = program.args.shift() || '.';
+
+// end-of-line code
+
+var eol = os.EOL
+
+// Template engine
+
+program.template = 'jade';
+if (program.ejs) program.template = 'ejs';
+if (program.jshtml) program.template = 'jshtml';
+if (program.hogan) program.template = 'hjs';
+
+/**
+ * Routes index template.
+ */
+
+var index = [
+    ''
+  , '/*'
+  , ' * GET home page.'
+  , ' */'
+  , ''
+  , 'exports.index = function(req, res){'
+  , '  res.render(\'index\', { title: \'Express\' });'
+  , '};'
+].join(eol);
+
+/**
+ * Routes users template.
+ */
+
+var users = [
+    ''
+  , '/*'
+  , ' * GET users listing.'
+  , ' */'
+  , ''
+  , 'exports.list = function(req, res){'
+  , '  res.send("respond with a resource");'
+  , '};'
+].join(eol);
+
+/**
+ * Jade layout template.
+ */
+
+var jadeLayout = [
+    'doctype 5'
+  , 'html'
+  , '  head'
+  , '    title= title'
+  , '    link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'
+  , '  body'
+  , '    block content'
+].join(eol);
+
+/**
+ * Jade index template.
+ */
+
+var jadeIndex = [
+    'extends layout'
+  , ''
+  , 'block content'
+  , '  h1= title'
+  , '  p Welcome to #{title}'
+].join(eol);
+
+/**
+ * EJS index template.
+ */
+
+var ejsIndex = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title><%= title %></title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    <h1><%= title %></h1>'
+  , '    <p>Welcome to <%= title %></p>'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * JSHTML layout template.
+ */
+
+var jshtmlLayout = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title> @write(title) </title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    @write(body)'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * JSHTML index template.
+ */
+
+var jshtmlIndex = [
+    '<h1>@write(title)</h1>'
+  , '<p>Welcome to @write(title)</p>'
+].join(eol);
+
+/**
+ * Hogan.js index template.
+ */
+var hoganIndex = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title>{{ title }}</title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    <h1>{{ title }}</h1>'
+  , '    <p>Welcome to {{ title }}</p>'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * Default css template.
+ */
+
+var css = [
+    'body {'
+  , '  padding: 50px;'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+  , '}'
+  , ''
+  , 'a {'
+  , '  color: #00B7FF;'
+  , '}'
+].join(eol);
+
+/**
+ * Default less template.
+ */
+
+var less = [
+    'body {'
+  , '  padding: 50px;'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+  , '}'
+  , ''
+  , 'a {'
+  , '  color: #00B7FF;'
+  , '}'
+].join(eol);
+
+/**
+ * Default stylus template.
+ */
+
+var stylus = [
+    'body'
+  , '  padding: 50px'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif'
+  , 'a'
+  , '  color: #00B7FF'
+].join(eol);
+
+/**
+ * App template.
+ */
+
+var app = [
+    ''
+  , '/**'
+  , ' * Module dependencies.'
+  , ' */'
+  , ''
+  , 'var express = require(\'express\')'
+  , '  , routes = require(\'./routes\')'
+  , '  , user = require(\'./routes/user\')'
+  , '  , http = require(\'http\')'
+  , '  , path = require(\'path\');'
+  , ''
+  , 'var app = express();'
+  , ''
+  , '// all environments'
+  , 'app.set(\'port\', process.env.PORT || 3000);'
+  , 'app.set(\'views\', __dirname + \'/views\');'
+  , 'app.set(\'view engine\', \':TEMPLATE\');'
+  , 'app.use(express.favicon());'
+  , 'app.use(express.logger(\'dev\'));'
+  , 'app.use(express.bodyParser());'
+  , 'app.use(express.methodOverride());{sess}'
+  , 'app.use(app.router);{css}'
+  , 'app.use(express.static(path.join(__dirname, \'public\')));'
+  , ''
+  , '// development only'
+  , 'if (\'development\' == app.get(\'env\')) {'
+  , '  app.use(express.errorHandler());'
+  , '}'
+  , ''
+  , 'app.get(\'/\', routes.index);'
+  , 'app.get(\'/users\', user.list);'
+  , ''
+  , 'http.createServer(app).listen(app.get(\'port\'), function(){'
+  , '  console.log(\'Express server listening on port \' + app.get(\'port\'));'
+  , '});'
+  , ''
+].join(eol);
+
+// Generate application
+
+(function createApplication(path) {
+  emptyDirectory(path, function(empty){
+    if (empty || program.force) {
+      createApplicationAt(path);
+    } else {
+      program.confirm('destination is not empty, continue? ', function(ok){
+        if (ok) {
+          process.stdin.destroy();
+          createApplicationAt(path);
+        } else {
+          abort('aborting');
+        }
+      });
+    }
+  });
+})(path);
+
+/**
+ * Create application at the given directory `path`.
+ *
+ * @param {String} path
+ */
+
+function createApplicationAt(path) {
+  console.log();
+  process.on('exit', function(){
+    console.log();
+    console.log('   install dependencies:');
+    console.log('     $ cd %s && npm install', path);
+    console.log();
+    console.log('   run the app:');
+    console.log('     $ node app');
+    console.log();
+  });
+
+  mkdir(path, function(){
+    mkdir(path + '/public');
+    mkdir(path + '/public/javascripts');
+    mkdir(path + '/public/images');
+    mkdir(path + '/public/stylesheets', function(){
+      switch (program.css) {
+        case 'less':
+          write(path + '/public/stylesheets/style.less', less);
+          break;
+        case 'stylus':
+          write(path + '/public/stylesheets/style.styl', stylus);
+          break;
+        default:
+          write(path + '/public/stylesheets/style.css', css);
+      }
+    });
+
+    mkdir(path + '/routes', function(){
+      write(path + '/routes/index.js', index);
+      write(path + '/routes/user.js', users);
+    });
+
+    mkdir(path + '/views', function(){
+      switch (program.template) {
+        case 'ejs':
+          write(path + '/views/index.ejs', ejsIndex);
+          break;
+        case 'jade':
+          write(path + '/views/layout.jade', jadeLayout);
+          write(path + '/views/index.jade', jadeIndex);
+          break;
+        case 'jshtml':
+          write(path + '/views/layout.jshtml', jshtmlLayout);
+          write(path + '/views/index.jshtml', jshtmlIndex);
+          break;
+        case 'hjs':
+          write(path + '/views/index.hjs', hoganIndex);
+          break;
+
+      }
+    });
+
+    // CSS Engine support
+    switch (program.css) {
+      case 'less':
+        app = app.replace('{css}', eol + 'app.use(require(\'less-middleware\')({ src: __dirname + \'/public\' }));');
+        break;
+      case 'stylus':
+        app = app.replace('{css}', eol + 'app.use(require(\'stylus\').middleware(__dirname + \'/public\'));');
+        break;
+      default:
+        app = app.replace('{css}', '');
+    }
+
+    // Session support
+    app = app.replace('{sess}', program.sessions
+      ? eol + 'app.use(express.cookieParser(\'your secret here\'));' + eol + 'app.use(express.session());'
+      : '');
+
+    // Template support
+    app = app.replace(':TEMPLATE', program.template);
+
+    // package.json
+    var pkg = {
+        name: 'application-name'
+      , version: '0.0.1'
+      , private: true
+      , scripts: { start: 'node app.js' }
+      , dependencies: {
+        express: version
+      }
+    }
+
+    if (program.template) pkg.dependencies[program.template] = '*';
+
+    // CSS Engine support
+    switch (program.css) {
+      case 'less':
+        pkg.dependencies['less-middleware'] = '*';
+        break;
+      default:
+        if (program.css) {
+          pkg.dependencies[program.css] = '*';
+        }
+    }
+
+    write(path + '/package.json', JSON.stringify(pkg, null, 2));
+    write(path + '/app.js', app);
+  });
+}
+
+/**
+ * Check if the given directory `path` is empty.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function emptyDirectory(path, fn) {
+  fs.readdir(path, function(err, files){
+    if (err && 'ENOENT' != err.code) throw err;
+    fn(!files || !files.length);
+  });
+}
+
+/**
+ * echo str > path.
+ *
+ * @param {String} path
+ * @param {String} str
+ */
+
+function write(path, str) {
+  fs.writeFile(path, str);
+  console.log('   \x1b[36mcreate\x1b[0m : ' + path);
+}
+
+/**
+ * Mkdir -p.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function mkdir(path, fn) {
+  mkdirp(path, 0755, function(err){
+    if (err) throw err;
+    console.log('   \033[36mcreate\033[0m : ' + path);
+    fn && fn();
+  });
+}
+
+/**
+ * Exit with the given `str`.
+ *
+ * @param {String} str
+ */
+
+function abort(str) {
+  console.error(str);
+  process.exit(1);
+}

+ 4 - 0
node_modules/express/index.js

@@ -0,0 +1,4 @@
+
+module.exports = process.env.EXPRESS_COV
+  ? require('./lib-cov/express')
+  : require('./lib/express');

+ 535 - 0
node_modules/express/lib/application.js

@@ -0,0 +1,535 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+  , Router = require('./router')
+  , methods = require('methods')
+  , middleware = require('./middleware')
+  , debug = require('debug')('express:application')
+  , locals = require('./utils').locals
+  , View = require('./view')
+  , utils = connect.utils
+  , path = require('path')
+  , http = require('http')
+  , join = path.join;
+
+/**
+ * Application prototype.
+ */
+
+var app = exports = module.exports = {};
+
+/**
+ * Initialize the server.
+ *
+ *   - setup default configuration
+ *   - setup default middleware
+ *   - setup route reflection methods
+ *
+ * @api private
+ */
+
+app.init = function(){
+  this.cache = {};
+  this.settings = {};
+  this.engines = {};
+  this.defaultConfiguration();
+};
+
+/**
+ * Initialize application configuration.
+ *
+ * @api private
+ */
+
+app.defaultConfiguration = function(){
+  // default settings
+  this.enable('x-powered-by');
+  this.set('env', process.env.NODE_ENV || 'development');
+  this.set('subdomain offset', 2);
+  debug('booting in %s mode', this.get('env'));
+
+  // implicit middleware
+  this.use(connect.query());
+  this.use(middleware.init(this));
+
+  // inherit protos
+  this.on('mount', function(parent){
+    this.request.__proto__ = parent.request;
+    this.response.__proto__ = parent.response;
+    this.engines.__proto__ = parent.engines;
+    this.settings.__proto__ = parent.settings;
+  });
+
+  // router
+  this._router = new Router(this);
+  this.routes = this._router.map;
+  this.__defineGetter__('router', function(){
+    this._usedRouter = true;
+    this._router.caseSensitive = this.enabled('case sensitive routing');
+    this._router.strict = this.enabled('strict routing');
+    return this._router.middleware;
+  });
+
+  // setup locals
+  this.locals = locals(this);
+
+  // default locals
+  this.locals.settings = this.settings;
+
+  // default configuration
+  this.set('view', View);
+  this.set('views', process.cwd() + '/views');
+  this.set('jsonp callback name', 'callback');
+
+  this.configure('development', function(){
+    this.set('json spaces', 2);
+  });
+
+  this.configure('production', function(){
+    this.enable('view cache');
+  });
+};
+
+/**
+ * Proxy `connect#use()` to apply settings to
+ * mounted applications.
+ *
+ * @param {String|Function|Server} route
+ * @param {Function|Server} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+  var app;
+
+  // default route to '/'
+  if ('string' != typeof route) fn = route, route = '/';
+
+  // express app
+  if (fn.handle && fn.set) app = fn;
+
+  // restore .app property on req and res
+  if (app) {
+    app.route = route;
+    fn = function(req, res, next) {
+      var orig = req.app;
+      app.handle(req, res, function(err){
+        req.__proto__ = orig.request;
+        res.__proto__ = orig.response;
+        next(err);
+      });
+    };
+  }
+
+  connect.proto.use.call(this, route, fn);
+
+  // mounted an app
+  if (app) {
+    app.parent = this;
+    app.emit('mount', this);
+  }
+
+  return this;
+};
+
+/**
+ * Register the given template engine callback `fn`
+ * as `ext`.
+ *
+ * By default will `require()` the engine based on the
+ * file extension. For example if you try to render
+ * a "foo.jade" file Express will invoke the following internally:
+ *
+ *     app.engine('jade', require('jade').__express);
+ *
+ * For engines that do not provide `.__express` out of the box,
+ * or if you wish to "map" a different extension to the template engine
+ * you may use this method. For example mapping the EJS template engine to
+ * ".html" files:
+ *
+ *     app.engine('html', require('ejs').renderFile);
+ *
+ * In this case EJS provides a `.renderFile()` method with
+ * the same signature that Express expects: `(path, options, callback)`,
+ * though note that it aliases this method as `ejs.__express` internally
+ * so if you're using ".ejs" extensions you dont need to do anything.
+ *
+ * Some template engines do not follow this convention, the
+ * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
+ * library was created to map all of node's popular template
+ * engines to follow this convention, thus allowing them to
+ * work seamlessly within Express.
+ *
+ * @param {String} ext
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.engine = function(ext, fn){
+  if ('function' != typeof fn) throw new Error('callback function required');
+  if ('.' != ext[0]) ext = '.' + ext;
+  this.engines[ext] = fn;
+  return this;
+};
+
+/**
+ * Map the given param placeholder `name`(s) to the given callback(s).
+ *
+ * Parameter mapping is used to provide pre-conditions to routes
+ * which use normalized placeholders. For example a _:user_id_ parameter
+ * could automatically load a user's information from the database without
+ * any additional code,
+ *
+ * The callback uses the samesignature as middleware, the only differencing
+ * being that the value of the placeholder is passed, in this case the _id_
+ * of the user. Once the `next()` function is invoked, just like middleware
+ * it will continue on to execute the route, or subsequent parameter functions.
+ *
+ *      app.param('user_id', function(req, res, next, id){
+ *        User.find(id, function(err, user){
+ *          if (err) {
+ *            next(err);
+ *          } else if (user) {
+ *            req.user = user;
+ *            next();
+ *          } else {
+ *            next(new Error('failed to load user'));
+ *          }
+ *        });
+ *      });
+ *
+ * @param {String|Array} name
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.param = function(name, fn){
+  var self = this
+    , fns = [].slice.call(arguments, 1);
+
+  // array
+  if (Array.isArray(name)) {
+    name.forEach(function(name){
+      fns.forEach(function(fn){
+        self.param(name, fn);
+      });
+    });
+  // param logic
+  } else if ('function' == typeof name) {
+    this._router.param(name);
+  // single
+  } else {
+    if (':' == name[0]) name = name.substr(1);
+    fns.forEach(function(fn){
+      self._router.param(name, fn);
+    });
+  }
+
+  return this;
+};
+
+/**
+ * Assign `setting` to `val`, or return `setting`'s value.
+ *
+ *    app.set('foo', 'bar');
+ *    app.get('foo');
+ *    // => "bar"
+ *
+ * Mounted servers inherit their parent server's settings.
+ *
+ * @param {String} setting
+ * @param {String} val
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.set = function(setting, val){
+  if (1 == arguments.length) {
+    return this.settings[setting];
+  } else {
+    this.settings[setting] = val;
+    return this;
+  }
+};
+
+/**
+ * Return the app's absolute pathname
+ * based on the parent(s) that have
+ * mounted it.
+ *
+ * For example if the application was
+ * mounted as "/admin", which itself
+ * was mounted as "/blog" then the
+ * return value would be "/blog/admin".
+ *
+ * @return {String}
+ * @api private
+ */
+
+app.path = function(){
+  return this.parent
+    ? this.parent.path() + this.route
+    : '';
+};
+
+/**
+ * Check if `setting` is enabled (truthy).
+ *
+ *    app.enabled('foo')
+ *    // => false
+ *
+ *    app.enable('foo')
+ *    app.enabled('foo')
+ *    // => true
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.enabled = function(setting){
+  return !!this.set(setting);
+};
+
+/**
+ * Check if `setting` is disabled.
+ *
+ *    app.disabled('foo')
+ *    // => true
+ *
+ *    app.enable('foo')
+ *    app.disabled('foo')
+ *    // => false
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.disabled = function(setting){
+  return !this.set(setting);
+};
+
+/**
+ * Enable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.enable = function(setting){
+  return this.set(setting, true);
+};
+
+/**
+ * Disable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.disable = function(setting){
+  return this.set(setting, false);
+};
+
+/**
+ * Configure callback for zero or more envs,
+ * when no `env` is specified that callback will
+ * be invoked for all environments. Any combination
+ * can be used multiple times, in any order desired.
+ *
+ * Examples:
+ *
+ *    app.configure(function(){
+ *      // executed for all envs
+ *    });
+ *
+ *    app.configure('stage', function(){
+ *      // executed staging env
+ *    });
+ *
+ *    app.configure('stage', 'production', function(){
+ *      // executed for stage and production
+ *    });
+ *
+ * Note:
+ *
+ *  These callbacks are invoked immediately, and
+ *  are effectively sugar for the following:
+ *
+ *     var env = process.env.NODE_ENV || 'development';
+ *
+ *      switch (env) {
+ *        case 'development':
+ *          ...
+ *          break;
+ *        case 'stage':
+ *          ...
+ *          break;
+ *        case 'production':
+ *          ...
+ *          break;
+ *      }
+ *
+ * @param {String} env...
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.configure = function(env, fn){
+  var envs = 'all'
+    , args = [].slice.call(arguments);
+  fn = args.pop();
+  if (args.length) envs = args;
+  if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);
+  return this;
+};
+
+/**
+ * Delegate `.VERB(...)` calls to `router.VERB(...)`.
+ */
+
+methods.forEach(function(method){
+  app[method] = function(path){
+    if ('get' == method && 1 == arguments.length) return this.set(path);
+
+    // deprecated
+    if (Array.isArray(path)) {
+      console.trace('passing an array to app.VERB() is deprecated and will be removed in 4.0');
+    }
+
+    // if no router attached yet, attach the router
+    if (!this._usedRouter) this.use(this.router);
+
+    // setup route
+    this._router[method].apply(this._router, arguments);
+    return this;
+  };
+});
+
+/**
+ * Special-cased "all" method, applying the given route `path`,
+ * middleware, and callback to _every_ HTTP method.
+ *
+ * @param {String} path
+ * @param {Function} ...
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.all = function(path){
+  var args = arguments;
+  methods.forEach(function(method){
+    app[method].apply(this, args);
+  }, this);
+  return this;
+};
+
+// del -> delete alias
+
+app.del = app.delete;
+
+/**
+ * Render the given view `name` name with `options`
+ * and a callback accepting an error and the
+ * rendered template string.
+ *
+ * Example:
+ *
+ *    app.render('email', { name: 'Tobi' }, function(err, html){
+ *      // ...
+ *    })
+ *
+ * @param {String} name
+ * @param {String|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+app.render = function(name, options, fn){
+  var opts = {}
+    , cache = this.cache
+    , engines = this.engines
+    , view;
+
+  // support callback function as second arg
+  if ('function' == typeof options) {
+    fn = options, options = {};
+  }
+
+  // merge app.locals
+  utils.merge(opts, this.locals);
+
+  // merge options._locals
+  if (options._locals) utils.merge(opts, options._locals);
+
+  // merge options
+  utils.merge(opts, options);
+
+  // set .cache unless explicitly provided
+  opts.cache = null == opts.cache
+    ? this.enabled('view cache')
+    : opts.cache;
+
+  // primed cache
+  if (opts.cache) view = cache[name];
+
+  // view
+  if (!view) {
+    view = new (this.get('view'))(name, {
+      defaultEngine: this.get('view engine'),
+      root: this.get('views'),
+      engines: engines
+    });
+
+    if (!view.path) {
+      var err = new Error('Failed to lookup view "' + name + '"');
+      err.view = view;
+      return fn(err);
+    }
+
+    // prime the cache
+    if (opts.cache) cache[name] = view;
+  }
+
+  // render
+  try {
+    view.render(opts, fn);
+  } catch (err) {
+    fn(err);
+  }
+};
+
+/**
+ * Listen for connections.
+ *
+ * A node `http.Server` is returned, with this
+ * application (which is a `Function`) as its
+ * callback. If you wish to create both an HTTP
+ * and HTTPS server you may do so with the "http"
+ * and "https" modules as shown here:
+ *
+ *    var http = require('http')
+ *      , https = require('https')
+ *      , express = require('express')
+ *      , app = express();
+ *
+ *    http.createServer(app).listen(80);
+ *    https.createServer({ ... }, app).listen(443);
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+  var server = http.createServer(this);
+  return server.listen.apply(server, arguments);
+};

+ 86 - 0
node_modules/express/lib/express.js

@@ -0,0 +1,86 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+  , proto = require('./application')
+  , Route = require('./router/route')
+  , Router = require('./router')
+  , req = require('./request')
+  , res = require('./response')
+  , utils = connect.utils;
+
+/**
+ * Expose `createApplication()`.
+ */
+
+exports = module.exports = createApplication;
+
+/**
+ * Expose mime.
+ */
+
+exports.mime = connect.mime;
+
+/**
+ * Create an express application.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createApplication() {
+  var app = connect();
+  utils.merge(app, proto);
+  app.request = { __proto__: req, app: app };
+  app.response = { __proto__: res, app: app };
+  app.init();
+  return app;
+}
+
+/**
+ * Expose connect.middleware as express.*
+ * for example `express.logger` etc.
+ */
+
+for (var key in connect.middleware) {
+  Object.defineProperty(
+      exports
+    , key
+    , Object.getOwnPropertyDescriptor(connect.middleware, key));
+}
+
+/**
+ * Error on createServer().
+ */
+
+exports.createServer = function(){
+  console.warn('Warning: express.createServer() is deprecated, express');
+  console.warn('applications no longer inherit from http.Server,');
+  console.warn('please use:');
+  console.warn('');
+  console.warn('  var express = require("express");');
+  console.warn('  var app = express();');
+  console.warn('');
+  return createApplication();
+};
+
+/**
+ * Expose the prototypes.
+ */
+
+exports.application = proto;
+exports.request = req;
+exports.response = res;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Route = Route;
+exports.Router = Router;
+
+// Error handler title
+
+exports.errorHandler.title = 'Express';
+

+ 32 - 0
node_modules/express/lib/middleware.js

@@ -0,0 +1,32 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils');
+
+/**
+ * Initialization middleware, exposing the
+ * request and response to eachother, as well
+ * as defaulting the X-Powered-By header field.
+ *
+ * @param {Function} app
+ * @return {Function}
+ * @api private
+ */
+
+exports.init = function(app){
+  return function expressInit(req, res, next){
+    if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');
+    req.res = res;
+    res.req = req;
+    req.next = next;
+
+    req.__proto__ = app.request;
+    res.__proto__ = app.response;
+
+    res.locals = res.locals || utils.locals(res);
+
+    next();
+  }
+};

+ 526 - 0
node_modules/express/lib/request.js

@@ -0,0 +1,526 @@
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , utils = require('./utils')
+  , connect = require('connect')
+  , fresh = require('fresh')
+  , parseRange = require('range-parser')
+  , parse = connect.utils.parseUrl
+  , mime = connect.mime;
+
+/**
+ * Request prototype.
+ */
+
+var req = exports = module.exports = {
+  __proto__: http.IncomingMessage.prototype
+};
+
+/**
+ * Return request header.
+ *
+ * The `Referrer` header field is special-cased,
+ * both `Referrer` and `Referer` are interchangeable.
+ *
+ * Examples:
+ *
+ *     req.get('Content-Type');
+ *     // => "text/plain"
+ *
+ *     req.get('content-type');
+ *     // => "text/plain"
+ *
+ *     req.get('Something');
+ *     // => undefined
+ *
+ * Aliased as `req.header()`.
+ *
+ * @param {String} name
+ * @return {String}
+ * @api public
+ */
+
+req.get =
+req.header = function(name){
+  switch (name = name.toLowerCase()) {
+    case 'referer':
+    case 'referrer':
+      return this.headers.referrer
+        || this.headers.referer;
+    default:
+      return this.headers[name];
+  }
+};
+
+/**
+ * Check if the given `type(s)` is acceptable, returning
+ * the best match when true, otherwise `undefined`, in which
+ * case you should respond with 406 "Not Acceptable".
+ *
+ * The `type` value may be a single mime type string
+ * such as "application/json", the extension name
+ * such as "json", a comma-delimted list such as "json, html, text/plain",
+ * or an array `["json", "html", "text/plain"]`. When a list
+ * or array is given the _best_ match, if any is returned.
+ *
+ * Examples:
+ *
+ *     // Accept: text/html
+ *     req.accepts('html');
+ *     // => "html"
+ *
+ *     // Accept: text/*, application/json
+ *     req.accepts('html');
+ *     // => "html"
+ *     req.accepts('text/html');
+ *     // => "text/html"
+ *     req.accepts('json, text');
+ *     // => "json"
+ *     req.accepts('application/json');
+ *     // => "application/json"
+ *
+ *     // Accept: text/*, application/json
+ *     req.accepts('image/png');
+ *     req.accepts('png');
+ *     // => undefined
+ *
+ *     // Accept: text/*;q=.5, application/json
+ *     req.accepts(['html', 'json']);
+ *     req.accepts('html, json');
+ *     // => "json"
+ *
+ * @param {String|Array} type(s)
+ * @return {String}
+ * @api public
+ */
+
+req.accepts = function(type){
+  return utils.accepts(type, this.get('Accept'));
+};
+
+/**
+ * Check if the given `encoding` is accepted.
+ *
+ * @param {String} encoding
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsEncoding = function(encoding){
+  return !! ~this.acceptedEncodings.indexOf(encoding);
+};
+
+/**
+ * Check if the given `charset` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} charset
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsCharset = function(charset){
+  var accepted = this.acceptedCharsets;
+  return accepted.length
+    ? !! ~accepted.indexOf(charset)
+    : true;
+};
+
+/**
+ * Check if the given `lang` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} lang
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsLanguage = function(lang){
+  var accepted = this.acceptedLanguages;
+  return accepted.length
+    ? !! ~accepted.indexOf(lang)
+    : true;
+};
+
+/**
+ * Parse Range header field,
+ * capping to the given `size`.
+ *
+ * Unspecified ranges such as "0-" require
+ * knowledge of your resource length. In
+ * the case of a byte range this is of course
+ * the total number of bytes. If the Range
+ * header field is not given `null` is returned,
+ * `-1` when unsatisfiable, `-2` when syntactically invalid.
+ *
+ * NOTE: remember that ranges are inclusive, so
+ * for example "Range: users=0-3" should respond
+ * with 4 users when available, not 3.
+ *
+ * @param {Number} size
+ * @return {Array}
+ * @api public
+ */
+
+req.range = function(size){
+  var range = this.get('Range');
+  if (!range) return;
+  return parseRange(size, range);
+};
+
+/**
+ * Return an array of encodings.
+ *
+ * Examples:
+ *
+ *     ['gzip', 'deflate']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedEncodings', function(){
+  var accept = this.get('Accept-Encoding');
+  return accept
+    ? accept.trim().split(/ *, */)
+    : [];
+});
+
+/**
+ * Return an array of Accepted media types
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     [ { value: 'application/json',
+ *         quality: 1,
+ *         type: 'application',
+ *         subtype: 'json' },
+ *       { value: 'text/html',
+ *         quality: 0.5,
+ *         type: 'text',
+ *         subtype: 'html' } ]
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('accepted', function(){
+  var accept = this.get('Accept');
+  return accept
+    ? utils.parseAccept(accept)
+    : [];
+});
+
+/**
+ * Return an array of Accepted languages
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     Accept-Language: en;q=.5, en-us
+ *     ['en-us', 'en']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedLanguages', function(){
+  var accept = this.get('Accept-Language');
+  return accept
+    ? utils
+      .parseParams(accept)
+      .map(function(obj){
+        return obj.value;
+      })
+    : [];
+});
+
+/**
+ * Return an array of Accepted charsets
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8
+ *     ['unicode-1-1', 'iso-8859-5']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedCharsets', function(){
+  var accept = this.get('Accept-Charset');
+  return accept
+    ? utils
+      .parseParams(accept)
+      .map(function(obj){
+        return obj.value;
+      })
+    : [];
+});
+
+/**
+ * Return the value of param `name` when present or `defaultValue`.
+ *
+ *  - Checks route placeholders, ex: _/user/:id_
+ *  - Checks body params, ex: id=12, {"id":12}
+ *  - Checks query string params, ex: ?id=12
+ *
+ * To utilize request bodies, `req.body`
+ * should be an object. This can be done by using
+ * the `connect.bodyParser()` middleware.
+ *
+ * @param {String} name
+ * @param {Mixed} [defaultValue]
+ * @return {String}
+ * @api public
+ */
+
+req.param = function(name, defaultValue){
+  var params = this.params || {};
+  var body = this.body || {};
+  var query = this.query || {};
+  if (null != params[name] && params.hasOwnProperty(name)) return params[name];
+  if (null != body[name]) return body[name];
+  if (null != query[name]) return query[name];
+  return defaultValue;
+};
+
+/**
+ * Check if the incoming request contains the "Content-Type"
+ * header field, and it contains the give mime `type`.
+ *
+ * Examples:
+ *
+ *      // With Content-Type: text/html; charset=utf-8
+ *      req.is('html');
+ *      req.is('text/html');
+ *      req.is('text/*');
+ *      // => true
+ *
+ *      // When Content-Type is application/json
+ *      req.is('json');
+ *      req.is('application/json');
+ *      req.is('application/*');
+ *      // => true
+ *
+ *      req.is('html');
+ *      // => false
+ *
+ * @param {String} type
+ * @return {Boolean}
+ * @api public
+ */
+
+req.is = function(type){
+  var ct = this.get('Content-Type');
+  if (!ct) return false;
+  ct = ct.split(';')[0];
+  if (!~type.indexOf('/')) type = mime.lookup(type);
+  if (~type.indexOf('*')) {
+    type = type.split('/');
+    ct = ct.split('/');
+    if ('*' == type[0] && type[1] == ct[1]) return true;
+    if ('*' == type[1] && type[0] == ct[0]) return true;
+    return false;
+  }
+  return !! ~ct.indexOf(type);
+};
+
+/**
+ * Return the protocol string "http" or "https"
+ * when requested with TLS. When the "trust proxy"
+ * setting is enabled the "X-Forwarded-Proto" header
+ * field will be trusted. If you're running behind
+ * a reverse proxy that supplies https for you this
+ * may be enabled.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('protocol', function(){
+  var trustProxy = this.app.get('trust proxy');
+  if (this.connection.encrypted) return 'https';
+  if (!trustProxy) return 'http';
+  var proto = this.get('X-Forwarded-Proto') || 'http';
+  return proto.split(/\s*,\s*/)[0];
+});
+
+/**
+ * Short-hand for:
+ *
+ *    req.protocol == 'https'
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('secure', function(){
+  return 'https' == this.protocol;
+});
+
+/**
+ * Return the remote address, or when
+ * "trust proxy" is `true` return
+ * the upstream addr.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('ip', function(){
+  return this.ips[0] || this.connection.remoteAddress;
+});
+
+/**
+ * When "trust proxy" is `true`, parse
+ * the "X-Forwarded-For" ip address list.
+ *
+ * For example if the value were "client, proxy1, proxy2"
+ * you would receive the array `["client", "proxy1", "proxy2"]`
+ * where "proxy2" is the furthest down-stream.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('ips', function(){
+  var trustProxy = this.app.get('trust proxy');
+  var val = this.get('X-Forwarded-For');
+  return trustProxy && val
+    ? val.split(/ *, */)
+    : [];
+});
+
+/**
+ * Return basic auth credentials.
+ *
+ * Examples:
+ *
+ *    // http://tobi:hello@example.com
+ *    req.auth
+ *    // => { username: 'tobi', password: 'hello' }
+ *
+ * @return {Object} or undefined
+ * @api public
+ */
+
+req.__defineGetter__('auth', function(){
+  // missing
+  var auth = this.get('Authorization');
+  if (!auth) return;
+
+  // malformed
+  var parts = auth.split(' ');
+  if ('basic' != parts[0].toLowerCase()) return;
+  if (!parts[1]) return;
+  auth = parts[1];
+
+  // credentials
+  auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/);
+  if (!auth) return;
+  return { username: auth[1], password: auth[2] };
+});
+
+/**
+ * Return subdomains as an array.
+ *
+ * Subdomains are the dot-separated parts of the host before the main domain of
+ * the app. By default, the domain of the app is assumed to be the last two
+ * parts of the host. This can be changed by setting "subdomain offset".
+ *
+ * For example, if the domain is "tobi.ferrets.example.com":
+ * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
+ * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('subdomains', function(){
+  var offset = this.app.get('subdomain offset');
+  return (this.host || '')
+    .split('.')
+    .reverse()
+    .slice(offset);
+});
+
+/**
+ * Short-hand for `url.parse(req.url).pathname`.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('path', function(){
+  return parse(this).pathname;
+});
+
+/**
+ * Parse the "Host" header field hostname.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('host', function(){
+  var trustProxy = this.app.get('trust proxy');
+  var host = trustProxy && this.get('X-Forwarded-Host');
+  host = host || this.get('Host');
+  if (!host) return;
+  return host.split(':')[0];
+});
+
+/**
+ * Check if the request is fresh, aka
+ * Last-Modified and/or the ETag
+ * still match.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('fresh', function(){
+  var method = this.method;
+  var s = this.res.statusCode;
+
+  // GET or HEAD for weak freshness validation only
+  if ('GET' != method && 'HEAD' != method) return false;
+
+  // 2xx or 304 as per rfc2616 14.26
+  if ((s >= 200 && s < 300) || 304 == s) {
+    return fresh(this.headers, this.res._headers);
+  }
+
+  return false;
+});
+
+/**
+ * Check if the request is stale, aka
+ * "Last-Modified" and / or the "ETag" for the
+ * resource has changed.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('stale', function(){
+  return !this.fresh;
+});
+
+/**
+ * Check if the request was an _XMLHttpRequest_.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('xhr', function(){
+  var val = this.get('X-Requested-With') || '';
+  return 'xmlhttprequest' == val.toLowerCase();
+});

+ 757 - 0
node_modules/express/lib/response.js

@@ -0,0 +1,757 @@
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , path = require('path')
+  , connect = require('connect')
+  , utils = connect.utils
+  , sign = require('cookie-signature').sign
+  , normalizeType = require('./utils').normalizeType
+  , normalizeTypes = require('./utils').normalizeTypes
+  , etag = require('./utils').etag
+  , statusCodes = http.STATUS_CODES
+  , cookie = require('cookie')
+  , send = require('send')
+  , mime = connect.mime
+  , basename = path.basename
+  , extname = path.extname
+  , join = path.join;
+
+/**
+ * Response prototype.
+ */
+
+var res = module.exports = {
+  __proto__: http.ServerResponse.prototype
+};
+
+/**
+ * Set status `code`.
+ *
+ * @param {Number} code
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.status = function(code){
+  this.statusCode = code;
+  return this;
+};
+
+/**
+ * Set Link header field with the given `links`.
+ *
+ * Examples:
+ *
+ *    res.links({
+ *      next: 'http://api.example.com/users?page=2',
+ *      last: 'http://api.example.com/users?page=5'
+ *    });
+ *
+ * @param {Object} links
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.links = function(links){
+  return this.set('Link', Object.keys(links).map(function(rel){
+    return '<' + links[rel] + '>; rel="' + rel + '"';
+  }).join(', '));
+};
+
+/**
+ * Send a response.
+ *
+ * Examples:
+ *
+ *     res.send(new Buffer('wahoo'));
+ *     res.send({ some: 'json' });
+ *     res.send('<p>some html</p>');
+ *     res.send(404, 'Sorry, cant find that');
+ *     res.send(404);
+ *
+ * @param {Mixed} body or status
+ * @param {Mixed} body
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.send = function(body){
+  var req = this.req;
+  var head = 'HEAD' == req.method;
+  var len;
+
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.send(body, status) backwards compat
+    if ('number' != typeof body && 'number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = body;
+      body = arguments[1];
+    }
+  }
+
+  switch (typeof body) {
+    // response status
+    case 'number':
+      this.get('Content-Type') || this.type('txt');
+      this.statusCode = body;
+      body = http.STATUS_CODES[body];
+      break;
+    // string defaulting to html
+    case 'string':
+      if (!this.get('Content-Type')) {
+        this.charset = this.charset || 'utf-8';
+        this.type('html');
+      }
+      break;
+    case 'boolean':
+    case 'object':
+      if (null == body) {
+        body = '';
+      } else if (Buffer.isBuffer(body)) {
+        this.get('Content-Type') || this.type('bin');
+      } else {
+        return this.json(body);
+      }
+      break;
+  }
+
+  // populate Content-Length
+  if (undefined !== body && !this.get('Content-Length')) {
+    this.set('Content-Length', len = Buffer.isBuffer(body)
+      ? body.length
+      : Buffer.byteLength(body));
+  }
+
+  // ETag support
+  // TODO: W/ support
+  if (len > 1024 && 'GET' == req.method) {
+    if (!this.get('ETag')) {
+      this.set('ETag', etag(body));
+    }
+  }
+
+  // freshness
+  if (req.fresh) this.statusCode = 304;
+
+  // strip irrelevant headers
+  if (204 == this.statusCode || 304 == this.statusCode) {
+    this.removeHeader('Content-Type');
+    this.removeHeader('Content-Length');
+    this.removeHeader('Transfer-Encoding');
+    body = '';
+  }
+
+  // respond
+  this.end(head ? null : body);
+  return this;
+};
+
+/**
+ * Send JSON response.
+ *
+ * Examples:
+ *
+ *     res.json(null);
+ *     res.json({ user: 'tj' });
+ *     res.json(500, 'oh noes!');
+ *     res.json(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.json = function(obj){
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.json(body, status) backwards compat
+    if ('number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = obj;
+      obj = arguments[1];
+    }
+  }
+
+  // settings
+  var app = this.app;
+  var replacer = app.get('json replacer');
+  var spaces = app.get('json spaces');
+  var body = JSON.stringify(obj, replacer, spaces);
+
+  // content-type
+  this.get('Content-Type') || this.set('Content-Type', 'application/json');
+
+  return this.send(body);
+};
+
+/**
+ * Send JSON response with JSONP callback support.
+ *
+ * Examples:
+ *
+ *     res.jsonp(null);
+ *     res.jsonp({ user: 'tj' });
+ *     res.jsonp(500, 'oh noes!');
+ *     res.jsonp(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.jsonp = function(obj){
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.json(body, status) backwards compat
+    if ('number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = obj;
+      obj = arguments[1];
+    }
+  }
+
+  // settings
+  var app = this.app;
+  var replacer = app.get('json replacer');
+  var spaces = app.get('json spaces');
+  var body = JSON.stringify(obj, replacer, spaces)
+    .replace(/\u2028/g, '\\u2028')
+    .replace(/\u2029/g, '\\u2029');
+  var callback = this.req.query[app.get('jsonp callback name')];
+
+  // content-type
+  this.charset = this.charset || 'utf-8';
+  this.set('Content-Type', 'application/json');
+
+  // jsonp
+  if (callback) {
+    if (callback instanceof Array) callback = callback[0];
+    this.set('Content-Type', 'text/javascript');
+    var cb = callback.replace(/[^\[\]\w$.]/g, '');
+    body = cb + ' && ' + cb + '(' + body + ');';
+  }
+
+  return this.send(body);
+};
+
+/**
+ * Transfer the file at the given `path`.
+ *
+ * Automatically sets the _Content-Type_ response header field.
+ * The callback `fn(err)` is invoked when the transfer is complete
+ * or when an error occurs. Be sure to check `res.sentHeader`
+ * if you wish to attempt responding, as the header and some data
+ * may have already been transferred.
+ *
+ * Options:
+ *
+ *   - `maxAge` defaulting to 0
+ *   - `root`   root directory for relative filenames
+ *
+ * Examples:
+ *
+ *  The following example illustrates how `res.sendfile()` may
+ *  be used as an alternative for the `static()` middleware for
+ *  dynamic situations. The code backing `res.sendfile()` is actually
+ *  the same code, so HTTP cache support etc is identical.
+ *
+ *     app.get('/user/:uid/photos/:file', function(req, res){
+ *       var uid = req.params.uid
+ *         , file = req.params.file;
+ *
+ *       req.user.mayViewFilesFrom(uid, function(yes){
+ *         if (yes) {
+ *           res.sendfile('/uploads/' + uid + '/' + file);
+ *         } else {
+ *           res.send(403, 'Sorry! you cant see that.');
+ *         }
+ *       });
+ *     });
+ *
+ * @param {String} path
+ * @param {Object|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.sendfile = function(path, options, fn){
+  var self = this
+    , req = self.req
+    , next = this.req.next
+    , options = options || {}
+    , done;
+
+  // support function as second arg
+  if ('function' == typeof options) {
+    fn = options;
+    options = {};
+  }
+
+  // socket errors
+  req.socket.on('error', error);
+
+  // errors
+  function error(err) {
+    if (done) return;
+    done = true;
+
+    // clean up
+    cleanup();
+    if (!self.headerSent) self.removeHeader('Content-Disposition');
+
+    // callback available
+    if (fn) return fn(err);
+
+    // list in limbo if there's no callback
+    if (self.headerSent) return;
+
+    // delegate
+    next(err);
+  }
+
+  // streaming
+  function stream() {
+    if (done) return;
+    cleanup();
+    if (fn) self.on('finish', fn);
+  }
+
+  // cleanup
+  function cleanup() {
+    req.socket.removeListener('error', error);
+  }
+
+  // transfer
+  var file = send(req, path);
+  if (options.root) file.root(options.root);
+  file.maxage(options.maxAge || 0);
+  file.on('error', error);
+  file.on('directory', next);
+  file.on('stream', stream);
+  file.pipe(this);
+  this.on('finish', cleanup);
+};
+
+/**
+ * Transfer the file at the given `path` as an attachment.
+ *
+ * Optionally providing an alternate attachment `filename`,
+ * and optional callback `fn(err)`. The callback is invoked
+ * when the data transfer is complete, or when an error has
+ * ocurred. Be sure to check `res.headerSent` if you plan to respond.
+ *
+ * This method uses `res.sendfile()`.
+ *
+ * @param {String} path
+ * @param {String|Function} filename or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.download = function(path, filename, fn){
+  // support function as second arg
+  if ('function' == typeof filename) {
+    fn = filename;
+    filename = null;
+  }
+
+  filename = filename || path;
+  this.set('Content-Disposition', 'attachment; filename="' + basename(filename) + '"');
+  return this.sendfile(path, fn);
+};
+
+/**
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
+ *
+ * Examples:
+ *
+ *     res.type('.html');
+ *     res.type('html');
+ *     res.type('json');
+ *     res.type('application/json');
+ *     res.type('png');
+ *
+ * @param {String} type
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.contentType =
+res.type = function(type){
+  return this.set('Content-Type', ~type.indexOf('/')
+    ? type
+    : mime.lookup(type));
+};
+
+/**
+ * Respond to the Acceptable formats using an `obj`
+ * of mime-type callbacks.
+ *
+ * This method uses `req.accepted`, an array of
+ * acceptable types ordered by their quality values.
+ * When "Accept" is not present the _first_ callback
+ * is invoked, otherwise the first match is used. When
+ * no match is performed the server responds with
+ * 406 "Not Acceptable".
+ *
+ * Content-Type is set for you, however if you choose
+ * you may alter this within the callback using `res.type()`
+ * or `res.set('Content-Type', ...)`.
+ *
+ *    res.format({
+ *      'text/plain': function(){
+ *        res.send('hey');
+ *      },
+ *
+ *      'text/html': function(){
+ *        res.send('<p>hey</p>');
+ *      },
+ *
+ *      'appliation/json': function(){
+ *        res.send({ message: 'hey' });
+ *      }
+ *    });
+ *
+ * In addition to canonicalized MIME types you may
+ * also use extnames mapped to these types:
+ *
+ *    res.format({
+ *      text: function(){
+ *        res.send('hey');
+ *      },
+ *
+ *      html: function(){
+ *        res.send('<p>hey</p>');
+ *      },
+ *
+ *      json: function(){
+ *        res.send({ message: 'hey' });
+ *      }
+ *    });
+ *
+ * By default Express passes an `Error`
+ * with a `.status` of 406 to `next(err)`
+ * if a match is not made. If you provide
+ * a `.default` callback it will be invoked
+ * instead.
+ *
+ * @param {Object} obj
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.format = function(obj){
+  var req = this.req
+    , next = req.next;
+
+  var fn = obj.default;
+  if (fn) delete obj.default;
+  var keys = Object.keys(obj);
+
+  var key = req.accepts(keys);
+
+  this.set('Vary', 'Accept');
+
+  if (key) {
+    this.set('Content-Type', normalizeType(key).value);
+    obj[key](req, this, next);
+  } else if (fn) {
+    fn();
+  } else {
+    var err = new Error('Not Acceptable');
+    err.status = 406;
+    err.types = normalizeTypes(keys).map(function(o){ return o.value });
+    next(err);
+  }
+
+  return this;
+};
+
+/**
+ * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
+ *
+ * @param {String} filename
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.attachment = function(filename){
+  if (filename) this.type(extname(filename));
+  this.set('Content-Disposition', filename
+    ? 'attachment; filename="' + basename(filename) + '"'
+    : 'attachment');
+  return this;
+};
+
+/**
+ * Set header `field` to `val`, or pass
+ * an object of header fields.
+ *
+ * Examples:
+ *
+ *    res.set('Foo', ['bar', 'baz']);
+ *    res.set('Accept', 'application/json');
+ *    res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
+ *
+ * Aliased as `res.header()`.
+ *
+ * @param {String|Object|Array} field
+ * @param {String} val
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.set =
+res.header = function(field, val){
+  if (2 == arguments.length) {
+    if (Array.isArray(val)) val = val.map(String);
+    else val = String(val);
+    this.setHeader(field, val);
+  } else {
+    for (var key in field) {
+      this.set(key, field[key]);
+    }
+  }
+  return this;
+};
+
+/**
+ * Get value for header `field`.
+ *
+ * @param {String} field
+ * @return {String}
+ * @api public
+ */
+
+res.get = function(field){
+  return this.getHeader(field);
+};
+
+/**
+ * Clear cookie `name`.
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @param {ServerResponse} for chaining
+ * @api public
+ */
+
+res.clearCookie = function(name, options){
+  var opts = { expires: new Date(1), path: '/' };
+  return this.cookie(name, '', options
+    ? utils.merge(opts, options)
+    : opts);
+};
+
+/**
+ * Set cookie `name` to `val`, with the given `options`.
+ *
+ * Options:
+ *
+ *    - `maxAge`   max-age in milliseconds, converted to `expires`
+ *    - `signed`   sign the cookie
+ *    - `path`     defaults to "/"
+ *
+ * Examples:
+ *
+ *    // "Remember Me" for 15 minutes
+ *    res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
+ *
+ *    // save as above
+ *    res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
+ *
+ * @param {String} name
+ * @param {String|Object} val
+ * @param {Options} options
+ * @api public
+ */
+
+res.cookie = function(name, val, options){
+  options = utils.merge({}, options);
+  var secret = this.req.secret;
+  var signed = options.signed;
+  if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies');
+  if ('number' == typeof val) val = val.toString();
+  if ('object' == typeof val) val = 'j:' + JSON.stringify(val);
+  if (signed) val = 's:' + sign(val, secret);
+  if ('maxAge' in options) {
+    options.expires = new Date(Date.now() + options.maxAge);
+    options.maxAge /= 1000;
+  }
+  if (null == options.path) options.path = '/';
+  this.set('Set-Cookie', cookie.serialize(name, String(val), options));
+  return this;
+};
+
+
+/**
+ * Set the location header to `url`.
+ *
+ * The given `url` can also be the name of a mapped url, for
+ * example by default express supports "back" which redirects
+ * to the _Referrer_ or _Referer_ headers or "/".
+ *
+ * Examples:
+ *
+ *    res.location('/foo/bar').;
+ *    res.location('http://example.com');
+ *    res.location('../login'); // /blog/post/1 -> /blog/login
+ *
+ * Mounting:
+ *
+ *   When an application is mounted and `res.location()`
+ *   is given a path that does _not_ lead with "/" it becomes
+ *   relative to the mount-point. For example if the application
+ *   is mounted at "/blog", the following would become "/blog/login".
+ *
+ *      res.location('login');
+ *
+ *   While the leading slash would result in a location of "/login":
+ *
+ *      res.location('/login');
+ *
+ * @param {String} url
+ * @api public
+ */
+
+res.location = function(url){
+  var app = this.app
+    , req = this.req;
+
+  // setup redirect map
+  var map = { back: req.get('Referrer') || '/' };
+
+  // perform redirect
+  url = map[url] || url;
+
+  // relative
+  if (!~url.indexOf('://') && 0 != url.indexOf('//')) {
+    var path
+
+    // relative to path
+    if ('.' == url[0]) {
+      path = req.originalUrl.split('?')[0]
+      url =  path + ('/' == path[path.length - 1] ? '' : '/') + url;
+      // relative to mount-point
+    } else if ('/' != url[0]) {
+      path = app.path();
+      url = path + '/' + url;
+    }
+  }
+
+  // Respond
+  this.set('Location', url);
+  return this;
+};
+
+/**
+ * Redirect to the given `url` with optional response `status`
+ * defaulting to 302.
+ *
+ * The resulting `url` is determined by `res.location()`, so
+ * it will play nicely with mounted apps, relative paths,
+ * `"back"` etc.
+ *
+ * Examples:
+ *
+ *    res.redirect('/foo/bar');
+ *    res.redirect('http://example.com');
+ *    res.redirect(301, 'http://example.com');
+ *    res.redirect('http://example.com', 301);
+ *    res.redirect('../login'); // /blog/post/1 -> /blog/login
+ *
+ * @param {String} url
+ * @param {Number} code
+ * @api public
+ */
+
+res.redirect = function(url){
+  var app = this.app
+    , head = 'HEAD' == this.req.method
+    , status = 302
+    , body;
+
+  // allow status / url
+  if (2 == arguments.length) {
+    if ('number' == typeof url) {
+      status = url;
+      url = arguments[1];
+    } else {
+      status = arguments[1];
+    }
+  }
+
+  // Set location header
+  this.location(url);
+  url = this.get('Location');
+
+  // Support text/{plain,html} by default
+  this.format({
+    text: function(){
+      body = statusCodes[status] + '. Redirecting to ' + encodeURI(url);
+    },
+
+    html: function(){
+      var u = utils.escape(url);
+      body = '<p>' + statusCodes[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>';
+    },
+
+    default: function(){
+      body = '';
+    }
+  });
+
+  // Respond
+  this.statusCode = status;
+  this.set('Content-Length', Buffer.byteLength(body));
+  this.end(head ? null : body);
+};
+
+/**
+ * Render `view` with the given `options` and optional callback `fn`.
+ * When a callback function is given a response will _not_ be made
+ * automatically, otherwise a response of _200_ and _text/html_ is given.
+ *
+ * Options:
+ *
+ *  - `cache`     boolean hinting to the engine it should cache
+ *  - `filename`  filename of the view being rendered
+ *
+ * @param  {String} view
+ * @param  {Object|Function} options or callback function
+ * @param  {Function} fn
+ * @api public
+ */
+
+res.render = function(view, options, fn){
+  var self = this
+    , options = options || {}
+    , req = this.req
+    , app = req.app;
+
+  // support callback function as second arg
+  if ('function' == typeof options) {
+    fn = options, options = {};
+  }
+
+  // merge res.locals
+  options._locals = self.locals;
+
+  // default callback to respond
+  fn = fn || function(err, str){
+    if (err) return req.next(err);
+    self.send(str);
+  };
+
+  // render
+  app.render(view, options, fn);
+};

+ 273 - 0
node_modules/express/lib/router/index.js

@@ -0,0 +1,273 @@
+/**
+ * Module dependencies.
+ */
+
+var Route = require('./route')
+  , utils = require('../utils')
+  , methods = require('methods')
+  , debug = require('debug')('express:router')
+  , parse = require('connect').utils.parseUrl;
+
+/**
+ * Expose `Router` constructor.
+ */
+
+exports = module.exports = Router;
+
+/**
+ * Initialize a new `Router` with the given `options`.
+ *
+ * @param {Object} options
+ * @api private
+ */
+
+function Router(options) {
+  options = options || {};
+  var self = this;
+  this.map = {};
+  this.params = {};
+  this._params = [];
+  this.caseSensitive = options.caseSensitive;
+  this.strict = options.strict;
+  this.middleware = function router(req, res, next){
+    self._dispatch(req, res, next);
+  };
+}
+
+/**
+ * Register a param callback `fn` for the given `name`.
+ *
+ * @param {String|Function} name
+ * @param {Function} fn
+ * @return {Router} for chaining
+ * @api public
+ */
+
+Router.prototype.param = function(name, fn){
+  // param logic
+  if ('function' == typeof name) {
+    this._params.push(name);
+    return;
+  }
+
+  // apply param functions
+  var params = this._params
+    , len = params.length
+    , ret;
+
+  for (var i = 0; i < len; ++i) {
+    if (ret = params[i](name, fn)) {
+      fn = ret;
+    }
+  }
+
+  // ensure we end up with a
+  // middleware function
+  if ('function' != typeof fn) {
+    throw new Error('invalid param() call for ' + name + ', got ' + fn);
+  }
+
+  (this.params[name] = this.params[name] || []).push(fn);
+  return this;
+};
+
+/**
+ * Route dispatcher aka the route "middleware".
+ *
+ * @param {IncomingMessage} req
+ * @param {ServerResponse} res
+ * @param {Function} next
+ * @api private
+ */
+
+Router.prototype._dispatch = function(req, res, next){
+  var params = this.params
+    , self = this;
+
+  debug('dispatching %s %s (%s)', req.method, req.url, req.originalUrl);
+
+  // route dispatch
+  (function pass(i, err){
+    var paramCallbacks
+      , paramIndex = 0
+      , paramVal
+      , route
+      , keys
+      , key;
+
+    // match next route
+    function nextRoute(err) {
+      pass(req._route_index + 1, err);
+    }
+
+    // match route
+    req.route = route = self.matchRequest(req, i);
+
+    // no route
+    if (!route) return next(err);
+    debug('matched %s %s', route.method, route.path);
+
+    // we have a route
+    // start at param 0
+    req.params = route.params;
+    keys = route.keys;
+    i = 0;
+
+    // param callbacks
+    function param(err) {
+      paramIndex = 0;
+      key = keys[i++];
+      paramVal = key && req.params[key.name];
+      paramCallbacks = key && params[key.name];
+
+      try {
+        if ('route' == err) {
+          nextRoute();
+        } else if (err) {
+          i = 0;
+          callbacks(err);
+        } else if (paramCallbacks && undefined !== paramVal) {
+          paramCallback();
+        } else if (key) {
+          param();
+        } else {
+          i = 0;
+          callbacks();
+        }
+      } catch (err) {
+        param(err);
+      }
+    };
+
+    param(err);
+
+    // single param callbacks
+    function paramCallback(err) {
+      var fn = paramCallbacks[paramIndex++];
+      if (err || !fn) return param(err);
+      fn(req, res, paramCallback, paramVal, key.name);
+    }
+
+    // invoke route callbacks
+    function callbacks(err) {
+      var fn = route.callbacks[i++];
+      try {
+        if ('route' == err) {
+          nextRoute();
+        } else if (err && fn) {
+          if (fn.length < 4) return callbacks(err);
+          fn(err, req, res, callbacks);
+        } else if (fn) {
+          if (fn.length < 4) return fn(req, res, callbacks);
+          callbacks();
+        } else {
+          nextRoute(err);
+        }
+      } catch (err) {
+        callbacks(err);
+      }
+    }
+  })(0);
+};
+
+/**
+ * Attempt to match a route for `req`
+ * with optional starting index of `i`
+ * defaulting to 0.
+ *
+ * @param {IncomingMessage} req
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.matchRequest = function(req, i, head){
+  var method = req.method.toLowerCase()
+    , url = parse(req)
+    , path = url.pathname
+    , routes = this.map
+    , i = i || 0
+    , route;
+
+  // HEAD support
+  if (!head && 'head' == method) {
+    route = this.matchRequest(req, i, true);
+    if (route) return route;
+     method = 'get';
+  }
+
+  // routes for this method
+  if (routes = routes[method]) {
+
+    // matching routes
+    for (var len = routes.length; i < len; ++i) {
+      route = routes[i];
+      if (route.match(path)) {
+        req._route_index = i;
+        return route;
+      }
+    }
+  }
+};
+
+/**
+ * Attempt to match a route for `method`
+ * and `url` with optional starting
+ * index of `i` defaulting to 0.
+ *
+ * @param {String} method
+ * @param {String} url
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.match = function(method, url, i, head){
+  var req = { method: method, url: url };
+  return  this.matchRequest(req, i, head);
+};
+
+/**
+ * Route `method`, `path`, and one or more callbacks.
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Function} callback...
+ * @return {Router} for chaining
+ * @api private
+ */
+
+Router.prototype.route = function(method, path, callbacks){
+  var method = method.toLowerCase()
+    , callbacks = utils.flatten([].slice.call(arguments, 2));
+
+  // ensure path was given
+  if (!path) throw new Error('Router#' + method + '() requires a path');
+
+  // ensure all callbacks are functions
+  callbacks.forEach(function(fn, i){
+    if ('function' == typeof fn) return;
+    var type = {}.toString.call(fn);
+    var msg = '.' + method + '() requires callback functions but got a ' + type;
+    throw new Error(msg);
+  });
+
+  // create the route
+  debug('defined %s %s', method, path);
+  var route = new Route(method, path, callbacks, {
+    sensitive: this.caseSensitive,
+    strict: this.strict
+  });
+
+  // add it
+  (this.map[method] = this.map[method] || []).push(route);
+  return this;
+};
+
+methods.forEach(function(method){
+  Router.prototype[method] = function(path){
+    var args = [method].concat([].slice.call(arguments));
+    this.route.apply(this, args);
+    return this;
+  };
+});

+ 72 - 0
node_modules/express/lib/router/route.js

@@ -0,0 +1,72 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Expose `Route`.
+ */
+
+module.exports = Route;
+
+/**
+ * Initialize `Route` with the given HTTP `method`, `path`,
+ * and an array of `callbacks` and `options`.
+ *
+ * Options:
+ *
+ *   - `sensitive`    enable case-sensitive routes
+ *   - `strict`       enable strict matching for trailing slashes
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Array} callbacks
+ * @param {Object} options.
+ * @api private
+ */
+
+function Route(method, path, callbacks, options) {
+  options = options || {};
+  this.path = path;
+  this.method = method;
+  this.callbacks = callbacks;
+  this.regexp = utils.pathRegexp(path
+    , this.keys = []
+    , options.sensitive
+    , options.strict);
+}
+
+/**
+ * Check if this route matches `path`, if so
+ * populate `.params`.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+Route.prototype.match = function(path){
+  var keys = this.keys
+    , params = this.params = []
+    , m = this.regexp.exec(path);
+
+  if (!m) return false;
+
+  for (var i = 1, len = m.length; i < len; ++i) {
+    var key = keys[i - 1];
+
+    var val = 'string' == typeof m[i]
+      ? decodeURIComponent(m[i])
+      : m[i];
+
+    if (key) {
+      params[key.name] = val;
+    } else {
+      params.push(val);
+    }
+  }
+
+  return true;
+};

+ 313 - 0
node_modules/express/lib/utils.js

@@ -0,0 +1,313 @@
+
+/**
+ * Module dependencies.
+ */
+
+var mime = require('connect').mime
+  , crc32 = require('buffer-crc32');
+
+/**
+ * toString ref.
+ */
+
+var toString = {}.toString;
+
+/**
+ * Return ETag for `body`.
+ *
+ * @param {String|Buffer} body
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(body){
+  return '"' + crc32.signed(body) + '"';
+};
+
+/**
+ * Make `locals()` bound to the given `obj`.
+ *
+ * This is used for `app.locals` and `res.locals`.
+ *
+ * @param {Object} obj
+ * @return {Function}
+ * @api private
+ */
+
+exports.locals = function(obj){
+  function locals(obj){
+    for (var key in obj) locals[key] = obj[key];
+    return obj;
+  };
+
+  return locals;
+};
+
+/**
+ * Check if `path` looks absolute.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.isAbsolute = function(path){
+  if ('/' == path[0]) return true;
+  if (':' == path[1] && '\\' == path[2]) return true;
+};
+
+/**
+ * Flatten the given `arr`.
+ *
+ * @param {Array} arr
+ * @return {Array}
+ * @api private
+ */
+
+exports.flatten = function(arr, ret){
+  var ret = ret || []
+    , len = arr.length;
+  for (var i = 0; i < len; ++i) {
+    if (Array.isArray(arr[i])) {
+      exports.flatten(arr[i], ret);
+    } else {
+      ret.push(arr[i]);
+    }
+  }
+  return ret;
+};
+
+/**
+ * Normalize the given `type`, for example "html" becomes "text/html".
+ *
+ * @param {String} type
+ * @return {Object}
+ * @api private
+ */
+
+exports.normalizeType = function(type){
+  return ~type.indexOf('/')
+    ? acceptParams(type)
+    : { value: mime.lookup(type), params: {} };
+};
+
+/**
+ * Normalize `types`, for example "html" becomes "text/html".
+ *
+ * @param {Array} types
+ * @return {Array}
+ * @api private
+ */
+
+exports.normalizeTypes = function(types){
+  var ret = [];
+
+  for (var i = 0; i < types.length; ++i) {
+    ret.push(exports.normalizeType(types[i]));
+  }
+
+  return ret;
+};
+
+/**
+ * Return the acceptable type in `types`, if any.
+ *
+ * @param {Array} types
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+exports.acceptsArray = function(types, str){
+  // accept anything when Accept is not present
+  if (!str) return types[0];
+
+  // parse
+  var accepted = exports.parseAccept(str)
+    , normalized = exports.normalizeTypes(types)
+    , len = accepted.length;
+
+  for (var i = 0; i < len; ++i) {
+    for (var j = 0, jlen = types.length; j < jlen; ++j) {
+      if (exports.accept(normalized[j], accepted[i])) {
+        return types[j];
+      }
+    }
+  }
+};
+
+/**
+ * Check if `type(s)` are acceptable based on
+ * the given `str`.
+ *
+ * @param {String|Array} type(s)
+ * @param {String} str
+ * @return {Boolean|String}
+ * @api private
+ */
+
+exports.accepts = function(type, str){
+  if ('string' == typeof type) type = type.split(/ *, */);
+  return exports.acceptsArray(type, str);
+};
+
+/**
+ * Check if `type` array is acceptable for `other`.
+ *
+ * @param {Object} type
+ * @param {Object} other
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.accept = function(type, other){
+  var t = type.value.split('/');
+  return (t[0] == other.type || '*' == other.type)
+    && (t[1] == other.subtype || '*' == other.subtype)
+    && paramsEqual(type.params, other.params);
+};
+
+/**
+ * Check if accept params are equal.
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Boolean}
+ * @api private
+ */
+
+function paramsEqual(a, b){
+  return !Object.keys(a).some(function(k) {
+    return a[k] != b[k];
+  });
+}
+
+/**
+ * Parse accept `str`, returning
+ * an array objects containing
+ * `.type` and `.subtype` along
+ * with the values provided by
+ * `parseQuality()`.
+ *
+ * @param {Type} name
+ * @return {Type}
+ * @api private
+ */
+
+exports.parseAccept = function(str){
+  return exports
+    .parseParams(str)
+    .map(function(obj){
+      var parts = obj.value.split('/');
+      obj.type = parts[0];
+      obj.subtype = parts[1];
+      return obj;
+    });
+};
+
+/**
+ * Parse quality `str`, returning an
+ * array of objects with `.value`,
+ * `.quality` and optional `.params`
+ *
+ * @param {String} str
+ * @return {Array}
+ * @api private
+ */
+
+exports.parseParams = function(str){
+  return str
+    .split(/ *, */)
+    .map(acceptParams)
+    .filter(function(obj){
+      return obj.quality;
+    })
+    .sort(function(a, b){
+      if (a.quality === b.quality) {
+        return a.originalIndex - b.originalIndex;
+      } else {
+        return b.quality - a.quality;
+      }
+    });
+};
+
+/**
+ * Parse accept params `str` returning an
+ * object with `.value`, `.quality` and `.params`.
+ * also includes `.originalIndex` for stable sorting
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api private
+ */
+
+function acceptParams(str, index) {
+  var parts = str.split(/ *; */);
+  var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };
+
+  for (var i = 1; i < parts.length; ++i) {
+    var pms = parts[i].split(/ *= */);
+    if ('q' == pms[0]) {
+      ret.quality = parseFloat(pms[1]);
+    } else {
+      ret.params[pms[0]] = pms[1];
+    }
+  }
+
+  return ret;
+}
+
+/**
+ * Escape special characters in the given string of html.
+ *
+ * @param  {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html) {
+  return String(html)
+    .replace(/&/g, '&amp;')
+    .replace(/"/g, '&quot;')
+    .replace(/</g, '&lt;')
+    .replace(/>/g, '&gt;');
+};
+
+/**
+ * Normalize the given path string,
+ * returning a regular expression.
+ *
+ * An empty array should be passed,
+ * which will contain the placeholder
+ * key names. For example "/user/:id" will
+ * then contain ["id"].
+ *
+ * @param  {String|RegExp|Array} path
+ * @param  {Array} keys
+ * @param  {Boolean} sensitive
+ * @param  {Boolean} strict
+ * @return {RegExp}
+ * @api private
+ */
+
+exports.pathRegexp = function(path, keys, sensitive, strict) {
+  if (toString.call(path) == '[object RegExp]') return path;
+  if (Array.isArray(path)) path = '(' + path.join('|') + ')';
+  path = path
+    .concat(strict ? '' : '/?')
+    .replace(/\/\(/g, '(?:/')
+    .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){
+      keys.push({ name: key, optional: !! optional });
+      slash = slash || '';
+      return ''
+        + (optional ? '' : slash)
+        + '(?:'
+        + (optional ? slash : '')
+        + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')'
+        + (optional || '')
+        + (star ? '(/*)?' : '');
+    })
+    .replace(/([\/.])/g, '\\$1')
+    .replace(/\*/g, '(.*)');
+  return new RegExp('^' + path + '$', sensitive ? '' : 'i');
+}

+ 77 - 0
node_modules/express/lib/view.js

@@ -0,0 +1,77 @@
+/**
+ * Module dependencies.
+ */
+
+var path = require('path')
+  , fs = require('fs')
+  , utils = require('./utils')
+  , dirname = path.dirname
+  , basename = path.basename
+  , extname = path.extname
+  , exists = fs.existsSync || path.existsSync
+  , join = path.join;
+
+/**
+ * Expose `View`.
+ */
+
+module.exports = View;
+
+/**
+ * Initialize a new `View` with the given `name`.
+ *
+ * Options:
+ *
+ *   - `defaultEngine` the default template engine name
+ *   - `engines` template engine require() cache
+ *   - `root` root path for view lookup
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @api private
+ */
+
+function View(name, options) {
+  options = options || {};
+  this.name = name;
+  this.root = options.root;
+  var engines = options.engines;
+  this.defaultEngine = options.defaultEngine;
+  var ext = this.ext = extname(name);
+  if (!ext && !this.defaultEngine) throw new Error('No default engine was specified and no extension was provided.');
+  if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine);
+  this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express);
+  this.path = this.lookup(name);
+}
+
+/**
+ * Lookup view by the given `path`
+ *
+ * @param {String} path
+ * @return {String}
+ * @api private
+ */
+
+View.prototype.lookup = function(path){
+  var ext = this.ext;
+
+  // <path>.<engine>
+  if (!utils.isAbsolute(path)) path = join(this.root, path);
+  if (exists(path)) return path;
+
+  // <path>/index.<engine>
+  path = join(dirname(path), basename(path, ext), 'index' + ext);
+  if (exists(path)) return path;
+};
+
+/**
+ * Render with the given `options` and callback `fn(err, str)`.
+ *
+ * @param {Object} options
+ * @param {Function} fn
+ * @api private
+ */
+
+View.prototype.render = function(options, fn){
+  this.engine(this.path, options, fn);
+};

+ 1 - 0
node_modules/express/node_modules/buffer-crc32/.npmignore

@@ -0,0 +1 @@
+node_modules

+ 8 - 0
node_modules/express/node_modules/buffer-crc32/.travis.yml

@@ -0,0 +1,8 @@
+language: node_js
+node_js:
+  - 0.6
+  - 0.8
+notifications:
+  email:
+    recipients:
+      - brianloveswords@gmail.com

+ 47 - 0
node_modules/express/node_modules/buffer-crc32/README.md

@@ -0,0 +1,47 @@
+# buffer-crc32
+
+[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)
+
+crc32 that works with binary data and fancy character sets, outputs
+buffer, signed or unsigned data and has tests.
+
+Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
+
+# install
+```
+npm install buffer-crc32
+```
+
+# example
+```js
+var crc32 = require('buffer-crc32');
+// works with buffers
+var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
+crc32(buf) // -> <Buffer 94 5a ab 4a>
+
+// has convenience methods for getting signed or unsigned ints
+crc32.signed(buf) // -> -1805997238
+crc32.unsigned(buf) // -> 2488970058
+
+// will cast to buffer if given a string, so you can
+// directly use foreign characters safely
+crc32('่‡ชๅ‹•่ฒฉๅฃฒๆฉŸ') // -> <Buffer cb 03 1a c5>
+
+// and works in append mode too
+var partialCrc = crc32('hey');
+var partialCrc = crc32(' ', partialCrc);
+var partialCrc = crc32('sup', partialCrc);
+var partialCrc = crc32(' ', partialCrc);
+var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
+```
+
+# tests
+This was tested against the output of zlib's crc32 method. You can run
+the tests with`npm test` (requires tap)
+
+# see also
+https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
+supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
+
+# license
+MIT/X11

+ 88 - 0
node_modules/express/node_modules/buffer-crc32/index.js

@@ -0,0 +1,88 @@
+var Buffer = require('buffer').Buffer;
+
+var CRC_TABLE = [
+  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+  0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+  0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+  0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+  0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+  0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+  0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+  0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+  0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+  0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+  0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+  0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+  0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+  0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+  0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+  0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+  0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+  0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+  0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+  0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+  0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+  0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+  0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+  0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+  0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+  0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+  0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+  0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+  0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+  0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+  0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+  0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+  0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+  0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+  0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+  0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+  0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+  0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+  0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+  0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+  0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+  0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+  0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+  0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+  0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+  0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+  0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+  0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+  0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+  0x2d02ef8d
+];
+
+function bufferizeInt(num) {
+  var tmp = Buffer(4);
+  tmp.writeInt32BE(num, 0);
+  return tmp;
+}
+
+function _crc32(buf, previous) {
+  if (!Buffer.isBuffer(buf)) {
+    buf = Buffer(buf);
+  }
+  if (Buffer.isBuffer(previous)) {
+    previous = previous.readUInt32BE(0);
+  }
+  var crc = ~~previous ^ -1;
+  for (var n = 0; n < buf.length; n++) {
+    crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
+  }
+  return (crc ^ -1);
+}
+
+function crc32() {
+  return bufferizeInt(_crc32.apply(null, arguments));
+}
+crc32.signed = function () {
+  return _crc32.apply(null, arguments);
+};
+crc32.unsigned = function () {
+  return _crc32.apply(null, arguments) >>> 0;
+};
+
+module.exports = crc32;

+ 36 - 0
node_modules/express/node_modules/buffer-crc32/package.json

@@ -0,0 +1,36 @@
+{
+  "author": {
+    "name": "Brian J. Brennan",
+    "email": "brianloveswords@gmail.com",
+    "url": "http://bjb.io"
+  },
+  "name": "buffer-crc32",
+  "description": "A pure javascript CRC32 algorithm that plays nice with binary data",
+  "version": "0.2.1",
+  "contributors": [
+    {
+      "name": "Vladimir Kuznetsov"
+    }
+  ],
+  "homepage": "https://github.com/brianloveswords/buffer-crc32",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/brianloveswords/buffer-crc32.git"
+  },
+  "main": "index.js",
+  "scripts": {
+    "test": "./node_modules/.bin/tap tests/*.test.js"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "tap": "~0.2.5"
+  },
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> <Buffer 94 5a ab 4a>\n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('่‡ชๅ‹•่ฒฉๅฃฒๆฉŸ') // -> <Buffer cb 03 1a c5>\n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>\n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n",
+  "readmeFilename": "README.md",
+  "_id": "buffer-crc32@0.2.1",
+  "_from": "buffer-crc32@0.2.1"
+}

+ 89 - 0
node_modules/express/node_modules/buffer-crc32/tests/crc.test.js

@@ -0,0 +1,89 @@
+var crc32 = require('..');
+var test = require('tap').test;
+
+test('simple crc32 is no problem', function (t) {
+  var input = Buffer('hey sup bros');
+  var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('another simple one', function (t) {
+  var input = Buffer('IEND');
+  var expected = Buffer([0xae, 0x42, 0x60, 0x82]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('slightly more complex', function (t) {
+  var input = Buffer([0x00, 0x00, 0x00]);
+  var expected = Buffer([0xff, 0x41, 0xd9, 0x12]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('complex crc32 gets calculated like a champ', function (t) {
+  var input = Buffer('เคถเฅ€เคฐเฅเคทเค•');
+  var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('casts to buffer if necessary', function (t) {
+  var input = 'เคถเฅ€เคฐเฅเคทเค•';
+  var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('can do signed', function (t) {
+  var input = 'ham sandwich';
+  var expected = -1891873021;
+  t.same(crc32.signed(input), expected);
+  t.end();
+});
+
+test('can do unsigned', function (t) {
+  var input = 'bear sandwich';
+  var expected = 3711466352;
+  t.same(crc32.unsigned(input), expected);
+  t.end();
+});
+
+
+test('simple crc32 in append mode', function (t) {
+  var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')];
+  var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+  for (var crc = 0, i = 0; i < input.length; i++) {
+    crc = crc32(input[i], crc);
+  }
+  t.same(crc, expected);
+  t.end();
+});
+
+
+test('can do signed in append mode', function (t) {
+  var input1 = 'ham';
+  var input2 = ' ';
+  var input3 = 'sandwich';
+  var expected = -1891873021;
+
+  var crc = crc32.signed(input1);
+  crc = crc32.signed(input2, crc);
+  crc = crc32.signed(input3, crc);
+
+  t.same(crc, expected);
+  t.end();
+});
+
+test('can do unsigned in append mode', function (t) {
+  var input1 = 'bear san';
+  var input2 = 'dwich';
+  var expected = 3711466352;
+
+  var crc = crc32.unsigned(input1);
+  crc = crc32.unsigned(input2, crc);
+  t.same(crc, expected);
+  t.end();
+});
+

+ 158 - 0
node_modules/express/node_modules/commander/History.md

@@ -0,0 +1,158 @@
+
+1.2.0 / 2013-06-13 
+==================
+
+ * allow "-" hyphen as an option argument
+ * support for RegExp coercion
+
+1.1.1 / 2012-11-20 
+==================
+
+  * add more sub-command padding
+  * fix .usage() when args are present. Closes #106
+
+1.1.0 / 2012-11-16 
+==================
+
+  * add git-style executable subcommand support. Closes #94
+
+1.0.5 / 2012-10-09 
+==================
+
+  * fix `--name` clobbering. Closes #92
+  * fix examples/help. Closes #89
+
+1.0.4 / 2012-09-03 
+==================
+
+  * add `outputHelp()` method.
+
+1.0.3 / 2012-08-30 
+==================
+
+  * remove invalid .version() defaulting
+
+1.0.2 / 2012-08-24 
+==================
+
+  * add `--foo=bar` support [arv]
+  * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
+
+1.0.1 / 2012-08-03 
+==================
+
+  * fix issue #56
+  * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
+
+1.0.0 / 2012-07-05 
+==================
+
+  * add support for optional option descriptions
+  * add defaulting of `.version()` to package.json's version
+
+0.6.1 / 2012-06-01 
+==================
+
+  * Added: append (yes or no) on confirmation
+  * Added: allow node.js v0.7.x
+
+0.6.0 / 2012-04-10 
+==================
+
+  * Added `.prompt(obj, callback)` support. Closes #49
+  * Added default support to .choose(). Closes #41
+  * Fixed the choice example
+
+0.5.1 / 2011-12-20 
+==================
+
+  * Fixed `password()` for recent nodes. Closes #36
+
+0.5.0 / 2011-12-04 
+==================
+
+  * Added sub-command option support [itay]
+
+0.4.3 / 2011-12-04 
+==================
+
+  * Fixed custom help ordering. Closes #32
+
+0.4.2 / 2011-11-24 
+==================
+
+  * Added travis support
+  * Fixed: line-buffered input automatically trimmed. Closes #31
+
+0.4.1 / 2011-11-18 
+==================
+
+  * Removed listening for "close" on --help
+
+0.4.0 / 2011-11-15 
+==================
+
+  * Added support for `--`. Closes #24
+
+0.3.3 / 2011-11-14 
+==================
+
+  * Fixed: wait for close event when writing help info [Jerry Hamlet]
+
+0.3.2 / 2011-11-01 
+==================
+
+  * Fixed long flag definitions with values [felixge]
+
+0.3.1 / 2011-10-31 
+==================
+
+  * Changed `--version` short flag to `-V` from `-v`
+  * Changed `.version()` so it's configurable [felixge]
+
+0.3.0 / 2011-10-31 
+==================
+
+  * Added support for long flags only. Closes #18
+
+0.2.1 / 2011-10-24 
+==================
+
+  * "node": ">= 0.4.x < 0.7.0". Closes #20
+
+0.2.0 / 2011-09-26 
+==================
+
+  * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
+
+0.1.0 / 2011-08-24 
+==================
+
+  * Added support for custom `--help` output
+
+0.0.5 / 2011-08-18 
+==================
+
+  * Changed: when the user enters nothing prompt for password again
+  * Fixed issue with passwords beginning with numbers [NuckChorris]
+
+0.0.4 / 2011-08-15 
+==================
+
+  * Fixed `Commander#args`
+
+0.0.3 / 2011-08-15 
+==================
+
+  * Added default option value support
+
+0.0.2 / 2011-08-15 
+==================
+
+  * Added mask support to `Command#password(str[, mask], fn)`
+  * Added `Command#password(str, fn)`
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release

+ 276 - 0
node_modules/express/node_modules/commander/Readme.md

@@ -0,0 +1,276 @@
+# Commander.js
+
+  The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+    $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+  .version('0.0.1')
+  .option('-p, --peppers', 'Add peppers')
+  .option('-P, --pineapple', 'Add pineapple')
+  .option('-b, --bbq', 'Add bbq sauce')
+  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+  .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log('  - peppers');
+if (program.pineapple) console.log('  - pineappe');
+if (program.bbq) console.log('  - bbq');
+console.log('  - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```  
+ $ ./examples/pizza --help
+
+   Usage: pizza [options]
+
+   Options:
+
+     -V, --version        output the version number
+     -p, --peppers        Add peppers
+     -P, --pineapple      Add pineappe
+     -b, --bbq            Add bbq sauce
+     -c, --cheese <type>  Add the specified type of cheese [marble]
+     -h, --help           output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+  return val.split('..').map(Number);
+}
+
+function list(val) {
+  return val.split(',');
+}
+
+program
+  .version('0.0.1')
+  .usage('[options] <file ...>')
+  .option('-i, --integer <n>', 'An integer argument', parseInt)
+  .option('-f, --float <n>', 'A float argument', parseFloat)
+  .option('-r, --range <a>..<b>', 'A range', range)
+  .option('-l, --list <items>', 'A list', list)
+  .option('-o, --optional [value]', 'An optional value')
+  .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+  return val.split(',').map(Number);
+}
+
+program
+  .version('0.0.1')
+  .option('-f, --foo', 'enable some foo')
+  .option('-b, --bar', 'enable some bar')
+  .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+  console.log('  Examples:');
+  console.log('');
+  console.log('    $ custom-help --help');
+  console.log('    $ custom-help -h');
+  console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+  -h, --help     output usage information
+  -V, --version  output the version number
+  -f, --foo      enable some foo
+  -b, --bar      enable some bar
+  -B, --baz      enable some baz
+
+Examples:
+
+  $ custom-help --help
+  $ custom-help -h
+
+```
+
+## .prompt(msg, fn)
+
+ Single-line prompt:
+
+```js
+program.prompt('name: ', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Multi-line prompt:
+
+```js
+program.prompt('description:', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Coercion:
+
+```js
+program.prompt('Age: ', Number, function(age){
+  console.log('age: %j', age);
+});
+```
+
+```js
+program.prompt('Birthdate: ', Date, function(date){
+  console.log('date: %s', date);
+});
+```
+
+```js
+program.prompt('Email: ', /^.+@.+\..+$/, function(email){
+  console.log('email: %j', email);
+});
+```
+
+## .password(msg[, mask], fn)
+
+Prompt for password without echoing:
+
+```js
+program.password('Password: ', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+Prompt for password with mask char "*":
+
+```js
+program.password('Password: ', '*', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+## .confirm(msg, fn)
+
+ Confirm with the given `msg`:
+
+```js
+program.confirm('continue? ', function(ok){
+  console.log(' got %j', ok);
+});
+```
+
+## .choose(list, fn)
+
+ Let the user choose from a `list`:
+
+```js
+var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+
+console.log('Choose the coolest pet:');
+program.choose(list, function(i){
+  console.log('you chose %d "%s"', i, list[i]);
+});
+```
+
+## .outputHelp()
+
+  Output help information without exiting.
+
+## .help()
+
+  Output help information and exit immediately.
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 1152 - 0
node_modules/express/node_modules/commander/index.js

@@ -0,0 +1,1152 @@
+/*!
+ * commander
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , spawn = require('child_process').spawn
+  , keypress = require('keypress')
+  , fs = require('fs')
+  , exists = fs.existsSync
+  , path = require('path')
+  , tty = require('tty')
+  , dirname = path.dirname
+  , basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+  this.flags = flags;
+  this.required = ~flags.indexOf('<');
+  this.optional = ~flags.indexOf('[');
+  this.bool = !~flags.indexOf('-no-');
+  flags = flags.split(/[ ,|]+/);
+  if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+  this.long = flags.shift();
+  this.description = description || '';
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+  return this.long
+    .replace('--', '')
+    .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+  return arg == this.short
+    || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+  this.commands = [];
+  this.options = [];
+  this._args = [];
+  this._name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ *      program
+ *        .version('0.0.1')
+ *        .option('-C, --chdir <path>', 'change the working directory')
+ *        .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ *        .option('-T, --no-tests', 'ignore test hook')
+ *     
+ *      program
+ *        .command('setup')
+ *        .description('run remote setup commands')
+ *        .action(function(){
+ *          console.log('setup');
+ *        });
+ *     
+ *      program
+ *        .command('exec <cmd>')
+ *        .description('run the given remote command')
+ *        .action(function(cmd){
+ *          console.log('exec "%s"', cmd);
+ *        });
+ *     
+ *      program
+ *        .command('*')
+ *        .description('deploy the given env')
+ *        .action(function(env){
+ *          console.log('deploying "%s"', env);
+ *        });
+ *     
+ *      program.parse(process.argv);
+  *
+ * @param {String} name
+ * @param {String} [desc]
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name, desc){
+  var args = name.split(/ +/);
+  var cmd = new Command(args.shift());
+  if (desc) cmd.description(desc);
+  if (desc) this.executables = true;
+  this.commands.push(cmd);
+  cmd.parseExpectedArgs(args);
+  cmd.parent = this;
+  if (desc) return this;
+  return cmd;
+};
+
+/**
+ * Add an implicit `help [cmd]` subcommand
+ * which invokes `--help` for the given command.
+ *
+ * @api private
+ */
+
+Command.prototype.addImplicitHelpCommand = function() {
+  this.command('help [cmd]', 'display help for [cmd]');
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+  if (!args.length) return;
+  var self = this;
+  args.forEach(function(arg){
+    switch (arg[0]) {
+      case '<':
+        self._args.push({ required: true, name: arg.slice(1, -1) });
+        break;
+      case '[':
+        self._args.push({ required: false, name: arg.slice(1, -1) });
+        break;
+    }
+  });
+  return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ *      program
+ *        .command('help')
+ *        .description('display verbose help')
+ *        .action(function(){
+ *           // output help here
+ *        });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+  var self = this;
+  this.parent.on(this._name, function(args, unknown){    
+    // Parse any so-far unknown options
+    unknown = unknown || [];
+    var parsed = self.parseOptions(unknown);
+    
+    // Output help if necessary
+    outputHelpIfNecessary(self, parsed.unknown);
+    
+    // If there are still any unknown options, then we simply 
+    // die, unless someone asked for help, in which case we give it
+    // to them, and then we die.
+    if (parsed.unknown.length > 0) {      
+      self.unknownOption(parsed.unknown[0]);
+    }
+    
+    // Leftover arguments need to be pushed back. Fixes issue #56
+    if (parsed.args.length) args = parsed.args.concat(args);
+    
+    self._args.forEach(function(arg, i){
+      if (arg.required && null == args[i]) {
+        self.missingArgument(arg.name);
+      }
+    });
+    
+    // Always append ourselves to the end of the arguments,
+    // to make sure we match the number of arguments the user
+    // expects
+    if (self._args.length) {
+      args[self._args.length] = self;
+    } else {
+      args.push(self);
+    }
+    
+    fn.apply(this, args);
+  });
+  return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`. 
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ *    "-p, --pepper"
+ *    "-p|--pepper"
+ *    "-p --pepper"
+ *
+ * Examples:
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-p, --pepper', 'add pepper');
+ *
+ *     --pepper
+ *     program.pepper
+ *     // => Boolean
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-C, --no-cheese', 'remove cheese');
+ *
+ *     program.cheese
+ *     // => true
+ *
+ *     --no-cheese
+ *     program.cheese
+ *     // => true
+ *
+ *     // required argument
+ *     program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ *     --chdir /tmp
+ *     program.chdir
+ *     // => "/tmp"
+ *
+ *     // optional argument
+ *     program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+  var self = this
+    , option = new Option(flags, description)
+    , oname = option.name()
+    , name = camelcase(oname);
+
+  // default as 3rd arg
+  if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+  // preassign default value only for --no-*, [optional], or <required>
+  if (false == option.bool || option.optional || option.required) {
+    // when --no-* we make sure default is true
+    if (false == option.bool) defaultValue = true;
+    // preassign only if we have a default
+    if (undefined !== defaultValue) self[name] = defaultValue;
+  }
+
+  // register the option
+  this.options.push(option);
+
+  // when it's passed assign the value
+  // and conditionally invoke the callback
+  this.on(oname, function(val){
+    // coercion
+    if (null != val && fn) val = fn(val);
+
+    // unassigned or bool
+    if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+      // if no value, bool true, and we have a default, then use it!
+      if (null == val) {
+        self[name] = option.bool
+          ? defaultValue || true
+          : false;
+      } else {
+        self[name] = val;
+      }
+    } else if (null !== val) {
+      // reassign
+      self[name] = val;
+    }
+  });
+
+  return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+  // implicit help
+  if (this.executables) this.addImplicitHelpCommand();
+
+  // store raw args
+  this.rawArgs = argv;
+
+  // guess name
+  this._name = this._name || basename(argv[1]);
+
+  // process argv
+  var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+  var args = this.args = parsed.args;
+ 
+  // executable sub-commands, skip .parseArgs()
+  if (this.executables) return this.executeSubCommand(argv, args, parsed.unknown);
+
+  return this.parseArgs(this.args, parsed.unknown);
+};
+
+/**
+ * Execute a sub-command executable.
+ *
+ * @param {Array} argv
+ * @param {Array} args
+ * @param {Array} unknown
+ * @api private
+ */
+
+Command.prototype.executeSubCommand = function(argv, args, unknown) {
+  args = args.concat(unknown);
+
+  if (!args.length) this.help();
+  if ('help' == args[0] && 1 == args.length) this.help();
+
+  // <cmd> --help
+  if ('help' == args[0]) {
+    args[0] = args[1];
+    args[1] = '--help';
+  }
+
+  // executable
+  var dir = dirname(argv[1]);
+  var bin = basename(argv[1]) + '-' + args[0];
+
+  // check for ./<bin> first
+  var local = path.join(dir, bin);
+  if (exists(local)) bin = local;
+
+  // run it
+  args = args.slice(1);
+  var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
+  proc.on('exit', function(code){
+    if (code == 127) {
+      console.error('\n  %s(1) does not exist\n', bin);
+    }
+  });
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ * This also normalizes equal sign and splits "--abc=def" into "--abc def".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+  var ret = []
+    , arg
+    , index;
+
+  for (var i = 0, len = args.length; i < len; ++i) {
+    arg = args[i];
+    if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+      arg.slice(1).split('').forEach(function(c){
+        ret.push('-' + c);
+      });
+    } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
+      ret.push(arg.slice(0, index), arg.slice(index + 1));
+    } else {
+      ret.push(arg);
+    }
+  }
+
+  return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+  var cmds = this.commands
+    , len = cmds.length
+    , name;
+
+  if (args.length) {
+    name = args[0];
+    if (this.listeners(name).length) {
+      this.emit(args.shift(), args, unknown);
+    } else {
+      this.emit('*', args);
+    }
+  } else {
+    outputHelpIfNecessary(this, unknown);
+    
+    // If there were no args and we have unknown options,
+    // then they are extraneous and we need to error.
+    if (unknown.length > 0) {      
+      this.unknownOption(unknown[0]);
+    }
+  }
+
+  return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+  for (var i = 0, len = this.options.length; i < len; ++i) {
+    if (this.options[i].is(arg)) {
+      return this.options[i];
+    }
+  }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+  var args = []
+    , len = argv.length
+    , literal
+    , option
+    , arg;
+
+  var unknownOptions = [];
+
+  // parse options
+  for (var i = 0; i < len; ++i) {
+    arg = argv[i];
+
+    // literal args after --
+    if ('--' == arg) {
+      literal = true;
+      continue;
+    }
+
+    if (literal) {
+      args.push(arg);
+      continue;
+    }
+
+    // find matching Option
+    option = this.optionFor(arg);
+
+    // option is defined
+    if (option) {
+      // requires arg
+      if (option.required) {
+        arg = argv[++i];
+        if (null == arg) return this.optionMissingArgument(option);
+        if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);
+        this.emit(option.name(), arg);
+      // optional arg
+      } else if (option.optional) {
+        arg = argv[i+1];
+        if (null == arg || ('-' == arg[0] && '-' != arg)) {
+          arg = null;
+        } else {
+          ++i;
+        }
+        this.emit(option.name(), arg);
+      // bool
+      } else {
+        this.emit(option.name());
+      }
+      continue;
+    }
+    
+    // looks like an option
+    if (arg.length > 1 && '-' == arg[0]) {
+      unknownOptions.push(arg);
+      
+      // If the next argument looks like it might be
+      // an argument for this option, we pass it on.
+      // If it isn't, then it'll simply be ignored
+      if (argv[i+1] && '-' != argv[i+1][0]) {
+        unknownOptions.push(argv[++i]);
+      }
+      continue;
+    }
+    
+    // arg
+    args.push(arg);
+  }
+  
+  return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+  console.error();
+  console.error("  error: missing required argument `%s'", name);
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+  console.error();
+  if (flag) {
+    console.error("  error: option `%s' argument missing, got `%s'", option.flags, flag);
+  } else {
+    console.error("  error: option `%s' argument missing", option.flags);
+  }
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+  console.error();
+  console.error("  error: unknown option `%s'", flag);
+  console.error();
+  process.exit(1);
+};
+
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+  if (0 == arguments.length) return this._version;
+  this._version = str;
+  flags = flags || '-V, --version';
+  this.option(flags, 'output the version number');
+  this.on('version', function(){
+    console.log(str);
+    process.exit(0);
+  });
+  return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+  if (0 == arguments.length) return this._description;
+  this._description = str;
+  return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+  var args = this._args.map(function(arg){
+    return arg.required
+      ? '<' + arg.name + '>'
+      : '[' + arg.name + ']';
+  });
+
+  var usage = '[options'
+    + (this.commands.length ? '] [command' : '')
+    + ']'
+    + (this._args.length ? ' ' + args : '');
+
+  if (0 == arguments.length) return this._usage || usage;
+  this._usage = str;
+
+  return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+  return this.options.reduce(function(max, option){
+    return Math.max(max, option.flags.length);
+  }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+  var width = this.largestOptionLength();
+  
+  // Prepend the help information
+  return [pad('-h, --help', width) + '  ' + 'output usage information']
+    .concat(this.options.map(function(option){
+      return pad(option.flags, width)
+        + '  ' + option.description;
+      }))
+    .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+  if (!this.commands.length) return '';
+  return [
+      ''
+    , '  Commands:'
+    , ''
+    , this.commands.map(function(cmd){
+      var args = cmd._args.map(function(arg){
+        return arg.required
+          ? '<' + arg.name + '>'
+          : '[' + arg.name + ']';
+      }).join(' ');
+
+      return pad(cmd._name
+        + (cmd.options.length 
+          ? ' [options]'
+          : '') + ' ' + args, 22)
+        + (cmd.description()
+          ? ' ' + cmd.description()
+          : '');
+    }).join('\n').replace(/^/gm, '    ')
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+  return [
+      ''
+    , '  Usage: ' + this._name + ' ' + this.usage()
+    , '' + this.commandHelp()
+    , '  Options:'
+    , ''
+    , '' + this.optionHelp().replace(/^/gm, '    ')
+    , ''
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Prompt for a `Number`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForNumber = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseNumber(val){
+    val = Number(val);
+    if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
+    fn(val);
+  });
+};
+
+/**
+ * Prompt for a `Date`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForDate = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseDate(val){
+    val = new Date(val);
+    if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
+    fn(val);
+  });
+};
+
+
+/**
+ * Prompt for a `Regular Expression`.
+ *
+ * @param {String} str
+ * @param {Object} pattern regular expression object to test
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForRegexp = function(str, pattern, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseRegexp(val){
+    if(!pattern.test(val)) return self.promptSingleLine(str + '(regular expression mismatch) ', parseRegexp);
+    fn(val);
+  });
+};
+
+
+/**
+ * Single-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptSingleLine = function(str, fn){
+  // determine if the 2nd argument is a regular expression
+  if (arguments[1].global !== undefined && arguments[1].multiline !== undefined) {
+    return this.promptForRegexp(str, arguments[1], arguments[2]);
+  } else if ('function' == typeof arguments[2]) {
+    return this['promptFor' + (fn.name || fn)](str, arguments[2]);
+  }
+
+  process.stdout.write(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.once('data', function(val){
+    fn(val.trim());
+  }).resume();
+};
+
+/**
+ * Multi-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptMultiLine = function(str, fn){
+  var buf = [];
+  console.log(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.on('data', function(val){
+    if ('\n' == val || '\r\n' == val) {
+      process.stdin.removeAllListeners('data');
+      fn(buf.join('\n'));
+    } else {
+      buf.push(val.trimRight());
+    }
+  }).resume();
+};
+
+/**
+ * Prompt `str` and callback `fn(val)`
+ *
+ * Commander supports single-line and multi-line prompts.
+ * To issue a single-line prompt simply add white-space
+ * to the end of `str`, something like "name: ", whereas
+ * for a multi-line prompt omit this "description:".
+ *
+ *
+ * Examples:
+ *
+ *     program.prompt('Username: ', function(name){
+ *       console.log('hi %s', name);
+ *     });
+ *     
+ *     program.prompt('Description:', function(desc){
+ *       console.log('description was "%s"', desc.trim());
+ *     });
+ *
+ * @param {String|Object} str
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.prompt = function(str, fn){
+  var self = this;
+  if ('string' == typeof str) {
+    if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
+    this.promptMultiLine(str, fn);
+  } else {
+    var keys = Object.keys(str)
+      , obj = {};
+
+    function next() {
+      var key = keys.shift()
+        , label = str[key];
+
+      if (!key) return fn(obj);
+      self.prompt(label, function(val){
+        obj[key] = val;
+        next();
+      });
+    }
+
+    next();
+  }
+};
+
+/**
+ * Prompt for password with `str`, `mask` char and callback `fn(val)`.
+ *
+ * The mask string defaults to '', aka no output is
+ * written while typing, you may want to use "*" etc.
+ *
+ * Examples:
+ *
+ *     program.password('Password: ', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ *     program.password('Password: ', '*', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ * @param {String} str
+ * @param {String} mask
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.password = function(str, mask, fn){
+  var self = this
+    , buf = '';
+
+  // default mask
+  if ('function' == typeof mask) {
+    fn = mask;
+    mask = '';
+  }
+
+  keypress(process.stdin);
+
+  function setRawMode(mode) {
+    if (process.stdin.setRawMode) {
+      process.stdin.setRawMode(mode);
+    } else {
+      tty.setRawMode(mode);
+    }
+  };
+  setRawMode(true);
+  process.stdout.write(str);
+
+  // keypress
+  process.stdin.on('keypress', function(c, key){
+    if (key && 'enter' == key.name) {
+      console.log();
+      process.stdin.pause();
+      process.stdin.removeAllListeners('keypress');
+      setRawMode(false);
+      if (!buf.trim().length) return self.password(str, mask, fn);
+      fn(buf);
+      return;
+    }
+
+    if (key && key.ctrl && 'c' == key.name) {
+      console.log('%s', buf);
+      process.exit();
+    }
+
+    process.stdout.write(mask);
+    buf += c;
+  }).resume();
+};
+
+/**
+ * Confirmation prompt with `str` and callback `fn(bool)`
+ *
+ * Examples:
+ *
+ *      program.confirm('continue? ', function(ok){
+ *        console.log(' got %j', ok);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api public
+ */
+
+
+Command.prototype.confirm = function(str, fn, verbose){
+  var self = this;
+  this.prompt(str, function(ok){
+    if (!ok.trim()) {
+      if (!verbose) str += '(yes or no) ';
+      return self.confirm(str, fn, true);
+    }
+    fn(parseBool(ok));
+  });
+};
+
+/**
+ * Choice prompt with `list` of items and callback `fn(index, item)`
+ *
+ * Examples:
+ *
+ *      var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+ *      
+ *      console.log('Choose the coolest pet:');
+ *      program.choose(list, function(i){
+ *        console.log('you chose %d "%s"', i, list[i]);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {Array} list
+ * @param {Number|Function} index or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.choose = function(list, index, fn){
+  var self = this
+    , hasDefault = 'number' == typeof index;
+
+  if (!hasDefault) {
+    fn = index;
+    index = null;
+  }
+
+  list.forEach(function(item, i){
+    if (hasDefault && i == index) {
+      console.log('* %d) %s', i + 1, item);
+    } else {
+      console.log('  %d) %s', i + 1, item);
+    }
+  });
+
+  function again() {
+    self.prompt('  : ', function(val){
+      val = parseInt(val, 10) - 1;
+      if (hasDefault && isNaN(val)) val = index;
+
+      if (null == list[val]) {
+        again();
+      } else {
+        fn(val, list[val]);
+      }
+    });
+  }
+
+  again();
+};
+
+
+/**
+ * Output help information for this command
+ *
+ * @api public
+ */
+
+Command.prototype.outputHelp = function(){
+  process.stdout.write(this.helpInformation());
+  this.emit('--help');
+};
+
+/**
+ * Output help information and exit.
+ *
+ * @api public
+ */
+
+Command.prototype.help = function(){
+  this.outputHelp();
+  process.exit();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+  return flag.split('-').reduce(function(str, word){
+    return str + word[0].toUpperCase() + word.slice(1);
+  });
+}
+
+/**
+ * Parse a boolean `str`.
+ *
+ * @param {String} str
+ * @return {Boolean}
+ * @api private
+ */
+
+function parseBool(str) {
+  return /^y|yes|ok|true$/i.test(str);
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+  var len = Math.max(0, width - str.length);
+  return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+  options = options || [];
+  for (var i = 0; i < options.length; i++) {
+    if (options[i] == '--help' || options[i] == '-h') {
+      cmd.outputHelp();
+      process.exit(0);
+    }
+  }
+}

+ 101 - 0
node_modules/express/node_modules/commander/node_modules/keypress/README.md

@@ -0,0 +1,101 @@
+keypress
+========
+### Make any Node ReadableStream emit "keypress" events
+
+
+Previous to Node `v0.8.x`, there was an undocumented `"keypress"` event that
+`process.stdin` would emit when it was a TTY. Some people discovered this hidden
+gem, and started using it in their own code.
+
+Now in Node `v0.8.x`, this `"keypress"` event does not get emitted by default,
+but rather only when it is being used in conjuction with the `readline` (or by
+extension, the `repl`) module.
+
+This module is the exact logic from the node `v0.8.x` releases ripped out into its
+own module.
+
+__Bonus:__ Now with mouse support!
+
+Installation
+------------
+
+Install with `npm`:
+
+``` bash
+$ npm install keypress
+```
+
+Or add it to the `"dependencies"` section of your _package.json_ file.
+
+
+Example
+-------
+
+#### Listening for "keypress" events
+
+``` js
+var keypress = require('keypress');
+
+// make `process.stdin` begin emitting "keypress" events
+keypress(process.stdin);
+
+// listen for the "keypress" event
+process.stdin.on('keypress', function (ch, key) {
+  console.log('got "keypress"', key);
+  if (key && key.ctrl && key.name == 'c') {
+    process.stdin.pause();
+  }
+});
+
+process.stdin.setRawMode(true);
+process.stdin.resume();
+```
+
+#### Listening for "mousepress" events
+
+``` js
+var keypress = require('keypress');
+
+// make `process.stdin` begin emitting "mousepress" (and "keypress") events
+keypress(process.stdin);
+
+// you must enable the mouse events before they will begin firing
+keypress.enableMouse(process.stdout);
+
+process.stdin.on('mousepress', function (info) {
+  console.log('got "mousepress" event at %d x %d', info.x, info.y);
+});
+
+process.on('exit', function () {
+  // disable mouse on exit, so that the state
+  // is back to normal for the terminal
+  keypress.disableMouse(process.stdout);
+});
+```
+
+
+License
+-------
+
+(The MIT License)
+
+Copyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 346 - 0
node_modules/express/node_modules/commander/node_modules/keypress/index.js

@@ -0,0 +1,346 @@
+
+/**
+ * This module offers the internal "keypress" functionality from node-core's
+ * `readline` module, for your own programs and modules to use.
+ *
+ * Usage:
+ *
+ *   require('keypress')(process.stdin);
+ *
+ *   process.stdin.on('keypress', function (ch, key) {
+ *     console.log(ch, key);
+ *     if (key.ctrl && key.name == 'c') {
+ *       process.stdin.pause();
+ *     }
+ *   });
+ *   proces.stdin.resume();
+ */
+var exports = module.exports = keypress;
+
+exports.enableMouse = function (stream) {
+  stream.write('\x1b' +'[?1000h')
+}
+
+exports.disableMouse = function (stream) {
+  stream.write('\x1b' +'[?1000l')
+}
+
+
+/**
+ * accepts a readable Stream instance and makes it emit "keypress" events
+ */
+
+function keypress(stream) {
+  if (isEmittingKeypress(stream)) return;
+  stream._emitKeypress = true;
+
+  function onData(b) {
+    if (stream.listeners('keypress').length > 0) {
+      emitKey(stream, b);
+    } else {
+      // Nobody's watching anyway
+      stream.removeListener('data', onData);
+      stream.on('newListener', onNewListener);
+    }
+  }
+
+  function onNewListener(event) {
+    if (event == 'keypress') {
+      stream.on('data', onData);
+      stream.removeListener('newListener', onNewListener);
+    }
+  }
+
+  if (stream.listeners('keypress').length > 0) {
+    stream.on('data', onData);
+  } else {
+    stream.on('newListener', onNewListener);
+  }
+}
+
+/**
+ * Returns `true` if the stream is already emitting "keypress" events.
+ * `false` otherwise.
+ */
+
+function isEmittingKeypress(stream) {
+  var rtn = stream._emitKeypress;
+  if (!rtn) {
+    // hack: check for the v0.6.x "data" event
+    stream.listeners('data').forEach(function (l) {
+      if (l.name == 'onData' && /emitKey/.test(l.toString())) {
+        rtn = true;
+        stream._emitKeypress = true;
+      }
+    });
+  }
+  if (!rtn) {
+    // hack: check for the v0.6.x "newListener" event
+    stream.listeners('newListener').forEach(function (l) {
+      if (l.name == 'onNewListener' && /keypress/.test(l.toString())) {
+        rtn = true;
+        stream._emitKeypress = true;
+      }
+    });
+  }
+  return rtn;
+}
+
+
+/*
+  Some patterns seen in terminal key escape codes, derived from combos seen
+  at http://www.midnight-commander.org/browser/lib/tty/key.c
+
+  ESC letter
+  ESC [ letter
+  ESC [ modifier letter
+  ESC [ 1 ; modifier letter
+  ESC [ num char
+  ESC [ num ; modifier char
+  ESC O letter
+  ESC O modifier letter
+  ESC O 1 ; modifier letter
+  ESC N letter
+  ESC [ [ num ; modifier char
+  ESC [ [ 1 ; modifier letter
+  ESC ESC [ num char
+  ESC ESC O letter
+
+  - char is usually ~ but $ and ^ also happen with rxvt
+  - modifier is 1 +
+                (shift     * 1) +
+                (left_alt  * 2) +
+                (ctrl      * 4) +
+                (right_alt * 8)
+  - two leading ESCs apparently mean the same as one leading ESC
+*/
+
+// Regexes used for ansi escape code splitting
+var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/;
+var functionKeyCodeRe =
+    /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/;
+
+function emitKey(stream, s) {
+  var ch,
+      key = {
+        name: undefined,
+        ctrl: false,
+        meta: false,
+        shift: false
+      },
+      parts;
+
+  if (Buffer.isBuffer(s)) {
+    if (s[0] > 127 && s[1] === undefined) {
+      s[0] -= 128;
+      s = '\x1b' + s.toString(stream.encoding || 'utf-8');
+    } else {
+      s = s.toString(stream.encoding || 'utf-8');
+    }
+  }
+
+  key.sequence = s;
+
+  if (s === '\r' || s === '\n') {
+    // enter
+    key.name = 'enter';
+
+  } else if (s === '\t') {
+    // tab
+    key.name = 'tab';
+
+  } else if (s === '\b' || s === '\x7f' ||
+             s === '\x1b\x7f' || s === '\x1b\b') {
+    // backspace or ctrl+h
+    key.name = 'backspace';
+    key.meta = (s.charAt(0) === '\x1b');
+
+  } else if (s === '\x1b' || s === '\x1b\x1b') {
+    // escape key
+    key.name = 'escape';
+    key.meta = (s.length === 2);
+
+  } else if (s === ' ' || s === '\x1b ') {
+    key.name = 'space';
+    key.meta = (s.length === 2);
+
+  } else if (s <= '\x1a') {
+    // ctrl+letter
+    key.name = String.fromCharCode(s.charCodeAt(0) + 'a'.charCodeAt(0) - 1);
+    key.ctrl = true;
+
+  } else if (s.length === 1 && s >= 'a' && s <= 'z') {
+    // lowercase letter
+    key.name = s;
+
+  } else if (s.length === 1 && s >= 'A' && s <= 'Z') {
+    // shift+letter
+    key.name = s.toLowerCase();
+    key.shift = true;
+
+  } else if (parts = metaKeyCodeRe.exec(s)) {
+    // meta+character key
+    key.name = parts[1].toLowerCase();
+    key.meta = true;
+    key.shift = /^[A-Z]$/.test(parts[1]);
+
+  } else if (parts = functionKeyCodeRe.exec(s)) {
+    // ansi escape sequence
+
+    // reassemble the key code leaving out leading \x1b's,
+    // the modifier key bitflag and any meaningless "1;" sequence
+    var code = (parts[1] || '') + (parts[2] || '') +
+               (parts[4] || '') + (parts[6] || ''),
+        modifier = (parts[3] || parts[5] || 1) - 1;
+
+    // Parse the key modifier
+    key.ctrl = !!(modifier & 4);
+    key.meta = !!(modifier & 10);
+    key.shift = !!(modifier & 1);
+    key.code = code;
+
+    // Parse the key itself
+    switch (code) {
+      /* xterm/gnome ESC O letter */
+      case 'OP': key.name = 'f1'; break;
+      case 'OQ': key.name = 'f2'; break;
+      case 'OR': key.name = 'f3'; break;
+      case 'OS': key.name = 'f4'; break;
+
+      /* xterm/rxvt ESC [ number ~ */
+      case '[11~': key.name = 'f1'; break;
+      case '[12~': key.name = 'f2'; break;
+      case '[13~': key.name = 'f3'; break;
+      case '[14~': key.name = 'f4'; break;
+
+      /* from Cygwin and used in libuv */
+      case '[[A': key.name = 'f1'; break;
+      case '[[B': key.name = 'f2'; break;
+      case '[[C': key.name = 'f3'; break;
+      case '[[D': key.name = 'f4'; break;
+      case '[[E': key.name = 'f5'; break;
+
+      /* common */
+      case '[15~': key.name = 'f5'; break;
+      case '[17~': key.name = 'f6'; break;
+      case '[18~': key.name = 'f7'; break;
+      case '[19~': key.name = 'f8'; break;
+      case '[20~': key.name = 'f9'; break;
+      case '[21~': key.name = 'f10'; break;
+      case '[23~': key.name = 'f11'; break;
+      case '[24~': key.name = 'f12'; break;
+
+      /* xterm ESC [ letter */
+      case '[A': key.name = 'up'; break;
+      case '[B': key.name = 'down'; break;
+      case '[C': key.name = 'right'; break;
+      case '[D': key.name = 'left'; break;
+      case '[E': key.name = 'clear'; break;
+      case '[F': key.name = 'end'; break;
+      case '[H': key.name = 'home'; break;
+
+      /* xterm/gnome ESC O letter */
+      case 'OA': key.name = 'up'; break;
+      case 'OB': key.name = 'down'; break;
+      case 'OC': key.name = 'right'; break;
+      case 'OD': key.name = 'left'; break;
+      case 'OE': key.name = 'clear'; break;
+      case 'OF': key.name = 'end'; break;
+      case 'OH': key.name = 'home'; break;
+
+      /* xterm/rxvt ESC [ number ~ */
+      case '[1~': key.name = 'home'; break;
+      case '[2~': key.name = 'insert'; break;
+      case '[3~': key.name = 'delete'; break;
+      case '[4~': key.name = 'end'; break;
+      case '[5~': key.name = 'pageup'; break;
+      case '[6~': key.name = 'pagedown'; break;
+
+      /* putty */
+      case '[[5~': key.name = 'pageup'; break;
+      case '[[6~': key.name = 'pagedown'; break;
+
+      /* rxvt */
+      case '[7~': key.name = 'home'; break;
+      case '[8~': key.name = 'end'; break;
+
+      /* rxvt keys with modifiers */
+      case '[a': key.name = 'up'; key.shift = true; break;
+      case '[b': key.name = 'down'; key.shift = true; break;
+      case '[c': key.name = 'right'; key.shift = true; break;
+      case '[d': key.name = 'left'; key.shift = true; break;
+      case '[e': key.name = 'clear'; key.shift = true; break;
+
+      case '[2$': key.name = 'insert'; key.shift = true; break;
+      case '[3$': key.name = 'delete'; key.shift = true; break;
+      case '[5$': key.name = 'pageup'; key.shift = true; break;
+      case '[6$': key.name = 'pagedown'; key.shift = true; break;
+      case '[7$': key.name = 'home'; key.shift = true; break;
+      case '[8$': key.name = 'end'; key.shift = true; break;
+
+      case 'Oa': key.name = 'up'; key.ctrl = true; break;
+      case 'Ob': key.name = 'down'; key.ctrl = true; break;
+      case 'Oc': key.name = 'right'; key.ctrl = true; break;
+      case 'Od': key.name = 'left'; key.ctrl = true; break;
+      case 'Oe': key.name = 'clear'; key.ctrl = true; break;
+
+      case '[2^': key.name = 'insert'; key.ctrl = true; break;
+      case '[3^': key.name = 'delete'; key.ctrl = true; break;
+      case '[5^': key.name = 'pageup'; key.ctrl = true; break;
+      case '[6^': key.name = 'pagedown'; key.ctrl = true; break;
+      case '[7^': key.name = 'home'; key.ctrl = true; break;
+      case '[8^': key.name = 'end'; key.ctrl = true; break;
+
+      /* misc. */
+      case '[Z': key.name = 'tab'; key.shift = true; break;
+      default: key.name = 'undefined'; break;
+
+    }
+  } else if (s.length > 1 && s[0] !== '\x1b') {
+    // Got a longer-than-one string of characters.
+    // Probably a paste, since it wasn't a control sequence.
+    Array.prototype.forEach.call(s, function(c) {
+      emitKey(stream, c);
+    });
+    return;
+  }
+
+  if (key.code == '[M') {
+    key.name = 'mouse';
+    var s = key.sequence;
+    var b = s.charCodeAt(3);
+    key.x = s.charCodeAt(4) - 040;
+    key.y = s.charCodeAt(5) - 040;
+
+    key.scroll = 0;
+
+    key.ctrl  = !!(1<<4 & b);
+    key.meta  = !!(1<<3 & b);
+    key.shift = !!(1<<2 & b);
+
+    key.release = (3 & b) === 3;
+
+    if (1<<6 & b) { //scroll
+      key.scroll = 1 & b ? 1 : -1;
+    }
+
+    if (!key.release && !key.scroll) {
+      key.button = b & 3;
+    }
+  }
+
+  // Don't emit a key if no name was found
+  if (key.name === undefined) {
+    key = undefined;
+  }
+
+  if (s.length === 1) {
+    ch = s;
+  }
+
+  if (key && key.name == 'mouse') {
+    stream.emit('mousepress', key)
+  } else if (key || ch) {
+    stream.emit('keypress', ch, key);
+  }
+}

File diff suppressed because it is too large
+ 23 - 0
node_modules/express/node_modules/commander/node_modules/keypress/package.json


+ 28 - 0
node_modules/express/node_modules/commander/node_modules/keypress/test.js

@@ -0,0 +1,28 @@
+
+var keypress = require('./')
+keypress(process.stdin)
+
+if (process.stdin.setRawMode)
+  process.stdin.setRawMode(true)
+else
+  require('tty').setRawMode(true)
+
+process.stdin.on('keypress', function (c, key) {
+  console.log(0, c, key)
+  if (key && key.ctrl && key.name == 'c') {
+    process.stdin.pause()
+  }
+})
+process.stdin.on('mousepress', function (mouse) {
+  console.log(mouse)
+})
+
+keypress.enableMouse(process.stdout)
+process.on('exit', function () {
+  //disable mouse on exit, so that the state is back to normal
+  //for the terminal.
+  keypress.disableMouse(process.stdout)
+})
+
+process.stdin.resume()
+

File diff suppressed because it is too large
+ 32 - 0
node_modules/express/node_modules/commander/package.json


+ 12 - 0
node_modules/express/node_modules/connect/.npmignore

@@ -0,0 +1,12 @@
+*.markdown
+*.md
+.git*
+Makefile
+benchmarks/
+docs/
+examples/
+install.sh
+support/
+test/
+.DS_Store
+coverage.html

+ 4 - 0
node_modules/express/node_modules/connect/.travis.yml

@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+  - "0.8"
+  - "0.10"

+ 24 - 0
node_modules/express/node_modules/connect/LICENSE

@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2010 Sencha Inc.
+Copyright (c) 2011 LearnBoost
+Copyright (c) 2011 TJ Holowaychuk
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 133 - 0
node_modules/express/node_modules/connect/Readme.md

@@ -0,0 +1,133 @@
+[![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect)
+# Connect
+
+  Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
+
+ Connect is bundled with over _20_ commonly used middleware, including
+ a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/).
+
+```js
+var connect = require('connect')
+  , http = require('http');
+
+var app = connect()
+  .use(connect.favicon())
+  .use(connect.logger('dev'))
+  .use(connect.static('public'))
+  .use(connect.directory('public'))
+  .use(connect.cookieParser())
+  .use(connect.session({ secret: 'my secret here' }))
+  .use(function(req, res){
+    res.end('Hello from Connect!\n');
+  });
+
+http.createServer(app).listen(3000);
+```
+
+## Middleware
+
+  - [csrf](http://www.senchalabs.org/connect/csrf.html)
+  - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
+  - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)
+  - [json](http://www.senchalabs.org/connect/json.html)
+  - [multipart](http://www.senchalabs.org/connect/multipart.html)
+  - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)
+  - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)
+  - [directory](http://www.senchalabs.org/connect/directory.html)
+  - [compress](http://www.senchalabs.org/connect/compress.html)
+  - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
+  - [favicon](http://www.senchalabs.org/connect/favicon.html)
+  - [limit](http://www.senchalabs.org/connect/limit.html)
+  - [logger](http://www.senchalabs.org/connect/logger.html)
+  - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)
+  - [query](http://www.senchalabs.org/connect/query.html)
+  - [responseTime](http://www.senchalabs.org/connect/responseTime.html)
+  - [session](http://www.senchalabs.org/connect/session.html)
+  - [static](http://www.senchalabs.org/connect/static.html)
+  - [staticCache](http://www.senchalabs.org/connect/staticCache.html)
+  - [vhost](http://www.senchalabs.org/connect/vhost.html)
+  - [subdomains](http://www.senchalabs.org/connect/subdomains.html)
+  - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
+
+## Running Tests
+
+first:
+
+    $ npm install -d
+
+then:
+
+    $ make test
+
+## Authors
+
+ Below is the output from [git-summary](http://github.com/visionmedia/git-extras).
+
+
+     project: connect
+     commits: 2033
+     active : 301 days
+     files  : 171
+     authors: 
+      1414	Tj Holowaychuk          69.6%
+       298	visionmedia             14.7%
+       191	Tim Caswell             9.4%
+        51	TJ Holowaychuk          2.5%
+        10	Ryan Olds               0.5%
+         8	Astro                   0.4%
+         5	Nathan Rajlich          0.2%
+         5	Jakub Neลกetล™il          0.2%
+         3	Daniel Dickison         0.1%
+         3	David Rio Deiros        0.1%
+         3	Alexander Simmerl       0.1%
+         3	Andreas Lind Petersen   0.1%
+         2	Aaron Heckmann          0.1%
+         2	Jacques Crocker         0.1%
+         2	Fabian Jakobs           0.1%
+         2	Brian J Brennan         0.1%
+         2	Adam Malcontenti-Wilson 0.1%
+         2	Glen Mailer             0.1%
+         2	James Campos            0.1%
+         1	Trent Mick              0.0%
+         1	Troy Kruthoff           0.0%
+         1	Wei Zhu                 0.0%
+         1	comerc                  0.0%
+         1	darobin                 0.0%
+         1	nateps                  0.0%
+         1	Marco Sanson            0.0%
+         1	Arthur Taylor           0.0%
+         1	Aseem Kishore           0.0%
+         1	Bart Teeuwisse          0.0%
+         1	Cameron Howey           0.0%
+         1	Chad Weider             0.0%
+         1	Craig Barnes            0.0%
+         1	Eran Hammer-Lahav       0.0%
+         1	Gregory McWhirter       0.0%
+         1	Guillermo Rauch         0.0%
+         1	Jae Kwon                0.0%
+         1	Jakub Nesetril          0.0%
+         1	Joshua Peek             0.0%
+         1	Jxck                    0.0%
+         1	AJ ONeal                0.0%
+         1	Michael Hemesath        0.0%
+         1	Morten Siebuhr          0.0%
+         1	Samori Gorse            0.0%
+         1	Tom Jensen              0.0%
+
+## Node Compatibility
+
+  Connect `< 1.x` is compatible with node 0.2.x
+
+
+  Connect `1.x` is compatible with node 0.4.x
+
+
+  Connect (_master_) `2.x` is compatible with node 0.6.x
+
+## CLA
+
+ [http://sencha.com/cla](http://sencha.com/cla)
+
+## License
+
+View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).

+ 4 - 0
node_modules/express/node_modules/connect/index.js

@@ -0,0 +1,4 @@
+
+module.exports = process.env.CONNECT_COV
+  ? require('./lib-cov/connect')
+  : require('./lib/connect');

+ 81 - 0
node_modules/express/node_modules/connect/lib/cache.js

@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - Cache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Expose `Cache`.
+ */
+
+module.exports = Cache;
+
+/**
+ * LRU cache store.
+ *
+ * @param {Number} limit
+ * @api private
+ */
+
+function Cache(limit) {
+  this.store = {};
+  this.keys = [];
+  this.limit = limit;
+}
+
+/**
+ * Touch `key`, promoting the object.
+ *
+ * @param {String} key
+ * @param {Number} i
+ * @api private
+ */
+
+Cache.prototype.touch = function(key, i){
+  this.keys.splice(i,1);
+  this.keys.push(key);
+};
+
+/**
+ * Remove `key`.
+ *
+ * @param {String} key
+ * @api private
+ */
+
+Cache.prototype.remove = function(key){
+  delete this.store[key];
+};
+
+/**
+ * Get the object stored for `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.get = function(key){
+  return this.store[key];
+};
+
+/**
+ * Add a cache `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.add = function(key){
+  // initialize store
+  var len = this.keys.push(key);
+
+  // limit reached, invalidate LRU
+  if (len > this.limit) this.remove(this.keys.shift());
+
+  var arr = this.store[key] = [];
+  arr.createdAt = new Date;
+  return arr;
+};

+ 92 - 0
node_modules/express/node_modules/connect/lib/connect.js

@@ -0,0 +1,92 @@
+/*!
+ * Connect
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , proto = require('./proto')
+  , utils = require('./utils')
+  , path = require('path')
+  , basename = path.basename
+  , fs = require('fs');
+
+// node patches
+
+require('./patch');
+
+// expose createServer() as the module
+
+exports = module.exports = createServer;
+
+/**
+ * Framework version.
+ */
+
+exports.version = '2.7.11';
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = require('./middleware/static').mime;
+
+/**
+ * Expose the prototype.
+ */
+
+exports.proto = proto;
+
+/**
+ * Auto-load middleware getters.
+ */
+
+exports.middleware = {};
+
+/**
+ * Expose utilities.
+ */
+
+exports.utils = utils;
+
+/**
+ * Create a new connect server.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createServer() {
+  function app(req, res, next){ app.handle(req, res, next); }
+  utils.merge(app, proto);
+  utils.merge(app, EventEmitter.prototype);
+  app.route = '/';
+  app.stack = [];
+  for (var i = 0; i < arguments.length; ++i) {
+    app.use(arguments[i]);
+  }
+  return app;
+};
+
+/**
+ * Support old `.createServer()` method.
+ */
+
+createServer.createServer = createServer;
+
+/**
+ * Auto-load bundled middleware with getters.
+ */
+
+fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
+  if (!/\.js$/.test(filename)) return;
+  var name = basename(filename, '.js');
+  function load(){ return require('./middleware/' + name); }
+  exports.middleware.__defineGetter__(name, load);
+  exports.__defineGetter__(name, load);
+});

+ 50 - 0
node_modules/express/node_modules/connect/lib/index.js

@@ -0,0 +1,50 @@
+
+/**
+ * Connect is a middleware framework for node,
+ * shipping with over 18 bundled middleware and a rich selection of
+ * 3rd-party middleware.
+ *
+ *     var app = connect()
+ *       .use(connect.logger('dev'))
+ *       .use(connect.static('public'))
+ *       .use(function(req, res){
+ *         res.end('hello world\n');
+ *       })
+ *      .listen(3000);
+ *     
+ * Installation:
+ * 
+ *     $ npm install connect
+ *
+ * Middleware:
+ *
+ *  - [logger](logger.html) request logger with custom format support
+ *  - [csrf](csrf.html) Cross-site request forgery protection
+ *  - [compress](compress.html) Gzip compression middleware
+ *  - [basicAuth](basicAuth.html) basic http authentication
+ *  - [bodyParser](bodyParser.html) extensible request body parser
+ *  - [json](json.html) application/json parser
+ *  - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser
+ *  - [multipart](multipart.html) multipart/form-data parser
+ *  - [timeout](timeout.html) request timeouts
+ *  - [cookieParser](cookieParser.html) cookie parser
+ *  - [session](session.html) session management support with bundled MemoryStore
+ *  - [cookieSession](cookieSession.html) cookie-based session support
+ *  - [methodOverride](methodOverride.html) faux HTTP method support
+ *  - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time
+ *  - [staticCache](staticCache.html) memory cache layer for the static() middleware
+ *  - [static](static.html) streaming static file server supporting `Range` and more
+ *  - [directory](directory.html) directory listing middleware
+ *  - [vhost](vhost.html) virtual host sub-domain mapping middleware
+ *  - [favicon](favicon.html) efficient favicon server (with default icon)
+ *  - [limit](limit.html) limit the bytesize of request bodies
+ *  - [query](query.html) automatic querystring parser, populating `req.query`
+ *  - [errorHandler](errorHandler.html) flexible error handler
+ *
+ * Links:
+ * 
+ *   - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware
+ *   - GitHub [repository](http://github.com/senchalabs/connect)
+ *   - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md)
+ * 
+ */

+ 103 - 0
node_modules/express/node_modules/connect/lib/middleware/basicAuth.js

@@ -0,0 +1,103 @@
+
+/*!
+ * Connect - basicAuth
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , unauthorized = utils.unauthorized;
+
+/**
+ * Basic Auth:
+ *
+ * Enfore basic authentication by providing a `callback(user, pass)`,
+ * which must return `true` in order to gain access. Alternatively an async
+ * method is provided as well, invoking `callback(user, pass, callback)`. Populates
+ * `req.user`. The final alternative is simply passing username / password
+ * strings.
+ *
+ *  Simple username and password
+ *
+ *     connect(connect.basicAuth('username', 'password'));
+ *
+ *  Callback verification
+ *
+ *     connect()
+ *       .use(connect.basicAuth(function(user, pass){
+ *         return 'tj' == user & 'wahoo' == pass;
+ *       }))
+ *
+ *  Async callback verification, accepting `fn(err, user)`.
+ *
+ *     connect()
+ *       .use(connect.basicAuth(function(user, pass, fn){
+ *         User.authenticate({ user: user, pass: pass }, fn);
+ *       }))
+ *
+ * @param {Function|String} callback or username
+ * @param {String} realm
+ * @api public
+ */
+
+module.exports = function basicAuth(callback, realm) {
+  var username, password;
+
+  // user / pass strings
+  if ('string' == typeof callback) {
+    username = callback;
+    password = realm;
+    if ('string' != typeof password) throw new Error('password argument required');
+    realm = arguments[2];
+    callback = function(user, pass){
+      return user == username && pass == password;
+    }
+  }
+
+  realm = realm || 'Authorization Required';
+
+  return function(req, res, next) {
+    var authorization = req.headers.authorization;
+
+    if (req.user) return next();
+    if (!authorization) return unauthorized(res, realm);
+
+    var parts = authorization.split(' ');
+
+    if (parts.length !== 2) return next(utils.error(400));
+
+    var scheme = parts[0]
+      , credentials = new Buffer(parts[1], 'base64').toString()
+      , index = credentials.indexOf(':');
+
+    if ('Basic' != scheme || index < 0) return next(utils.error(400));
+    
+    var user = credentials.slice(0, index)
+      , pass = credentials.slice(index + 1);
+
+    // async
+    if (callback.length >= 3) {
+      var pause = utils.pause(req);
+      callback(user, pass, function(err, user){
+        if (err || !user)  return unauthorized(res, realm);
+        req.user = req.remoteUser = user;
+        next();
+        pause.resume();
+      });
+    // sync
+    } else {
+      if (callback(user, pass)) {
+        req.user = req.remoteUser = user;
+        next();
+      } else {
+        unauthorized(res, realm);
+      }
+    }
+  }
+};
+

+ 61 - 0
node_modules/express/node_modules/connect/lib/middleware/bodyParser.js

@@ -0,0 +1,61 @@
+
+/*!
+ * Connect - bodyParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var multipart = require('./multipart')
+  , urlencoded = require('./urlencoded')
+  , json = require('./json');
+
+/**
+ * Body parser:
+ * 
+ *   Parse request bodies, supports _application/json_,
+ *   _application/x-www-form-urlencoded_, and _multipart/form-data_.
+ *
+ *   This is equivalent to: 
+ *
+ *     app.use(connect.json());
+ *     app.use(connect.urlencoded());
+ *     app.use(connect.multipart());
+ *
+ * Examples:
+ *
+ *      connect()
+ *        .use(connect.bodyParser())
+ *        .use(function(req, res) {
+ *          res.end('viewing user ' + req.body.user.name);
+ *        });
+ *
+ *      $ curl -d 'user[name]=tj' http://local/
+ *      $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
+ *
+ *  View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function bodyParser(options){
+  var _urlencoded = urlencoded(options)
+    , _multipart = multipart(options)
+    , _json = json(options);
+
+  return function bodyParser(req, res, next) {
+    _json(req, res, function(err){
+      if (err) return next(err);
+      _urlencoded(req, res, function(err){
+        if (err) return next(err);
+        _multipart(req, res, next);
+      });
+    });
+  }
+};

+ 189 - 0
node_modules/express/node_modules/connect/lib/middleware/compress.js

@@ -0,0 +1,189 @@
+/*!
+ * Connect - compress
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var zlib = require('zlib');
+var utils = require('../utils');
+
+/**
+ * Supported content-encoding methods.
+ */
+
+exports.methods = {
+    gzip: zlib.createGzip
+  , deflate: zlib.createDeflate
+};
+
+/**
+ * Default filter function.
+ */
+
+exports.filter = function(req, res){
+  return /json|text|javascript/.test(res.getHeader('Content-Type'));
+};
+
+/**
+ * Compress:
+ *
+ * Compress response data with gzip/deflate.
+ *
+ * Filter:
+ *
+ *  A `filter` callback function may be passed to
+ *  replace the default logic of:
+ *
+ *     exports.filter = function(req, res){
+ *       return /json|text|javascript/.test(res.getHeader('Content-Type'));
+ *     };
+ *
+ * Threshold:
+ *
+ *  Only compress the response if the byte size is at or above a threshold.
+ *  Always compress while streaming.
+ *
+ *   - `threshold` - string representation of size or bytes as an integer.
+ *
+ * Options:
+ *
+ *  All remaining options are passed to the gzip/deflate
+ *  creation functions. Consult node's docs for additional details.
+ *
+ *   - `chunkSize` (default: 16*1024)
+ *   - `windowBits`
+ *   - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression
+ *   - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more
+ *   - `strategy`: compression strategy
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function compress(options) {
+  options = options || {};
+  var names = Object.keys(exports.methods)
+    , filter = options.filter || exports.filter
+    , threshold;
+
+  if (false === options.threshold || 0 === options.threshold) {
+    threshold = 0
+  } else if ('string' === typeof options.threshold) {
+    threshold = utils.parseBytes(options.threshold)
+  } else {
+    threshold = options.threshold || 1024
+  }
+
+  return function compress(req, res, next){
+    var accept = req.headers['accept-encoding']
+      , vary = res.getHeader('Vary')
+      , write = res.write
+      , end = res.end
+      , compress = true
+      , stream
+      , method;
+
+    // vary
+    if (!vary) {
+      res.setHeader('Vary', 'Accept-Encoding');
+    } else if (!~vary.indexOf('Accept-Encoding')) {
+      res.setHeader('Vary', vary + ', Accept-Encoding');
+    }
+
+    // see #724
+    req.on('close', function(){
+      res.write = res.end = function(){};
+    });
+
+    // proxy
+
+    res.write = function(chunk, encoding){
+      if (!this.headerSent) this._implicitHeader();
+      return stream
+        ? stream.write(new Buffer(chunk, encoding))
+        : write.call(res, chunk, encoding);
+    };
+
+    res.end = function(chunk, encoding){
+      if (chunk) {
+        if (!this.headerSent && getSize(chunk) < threshold) compress = false;
+        this.write(chunk, encoding);
+      } else if (!this.headerSent) {
+        // response size === 0
+        compress = false;
+      }
+      return stream
+        ? stream.end()
+        : end.call(res);
+    };
+
+    res.on('header', function(){
+      if (!compress) return;
+
+      var encoding = res.getHeader('Content-Encoding') || 'identity';
+
+      // already encoded
+      if ('identity' != encoding) return;
+
+      // default request filter
+      if (!filter(req, res)) return;
+
+      // SHOULD use identity
+      if (!accept) return;
+
+      // head
+      if ('HEAD' == req.method) return;
+
+      // default to gzip
+      if ('*' == accept.trim()) method = 'gzip';
+
+      // compression method
+      if (!method) {
+        for (var i = 0, len = names.length; i < len; ++i) {
+          if (~accept.indexOf(names[i])) {
+            method = names[i];
+            break;
+          }
+        }
+      }
+
+      // compression method
+      if (!method) return;
+
+      // compression stream
+      stream = exports.methods[method](options);
+
+      // header fields
+      res.setHeader('Content-Encoding', method);
+      res.removeHeader('Content-Length');
+
+      // compression
+
+      stream.on('data', function(chunk){
+        write.call(res, chunk);
+      });
+
+      stream.on('end', function(){
+        end.call(res);
+      });
+
+      stream.on('drain', function() {
+        res.emit('drain');
+      });
+    });
+
+    next();
+  };
+};
+
+function getSize(chunk) {
+  return Buffer.isBuffer(chunk)
+    ? chunk.length
+    : Buffer.byteLength(chunk);
+}

+ 62 - 0
node_modules/express/node_modules/connect/lib/middleware/cookieParser.js

@@ -0,0 +1,62 @@
+
+/*!
+ * Connect - cookieParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+  , cookie = require('cookie');
+
+/**
+ * Cookie parser:
+ *
+ * Parse _Cookie_ header and populate `req.cookies`
+ * with an object keyed by the cookie names. Optionally
+ * you may enabled signed cookie support by passing
+ * a `secret` string, which assigns `req.secret` so
+ * it may be used by other middleware.
+ *
+ * Examples:
+ *
+ *     connect()
+ *       .use(connect.cookieParser('optional secret string'))
+ *       .use(function(req, res, next){
+ *         res.end(JSON.stringify(req.cookies));
+ *       })
+ *
+ * @param {String} secret
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieParser(secret){
+  return function cookieParser(req, res, next) {
+    if (req.cookies) return next();
+    var cookies = req.headers.cookie;
+
+    req.secret = secret;
+    req.cookies = {};
+    req.signedCookies = {};
+
+    if (cookies) {
+      try {
+        req.cookies = cookie.parse(cookies);
+        if (secret) {
+          req.signedCookies = utils.parseSignedCookies(req.cookies, secret);
+          req.signedCookies = utils.parseJSONCookies(req.signedCookies);
+        }
+        req.cookies = utils.parseJSONCookies(req.cookies);
+      } catch (err) {
+        err.status = 400;
+        return next(err);
+      }
+    }
+    next();
+  };
+};

+ 115 - 0
node_modules/express/node_modules/connect/lib/middleware/cookieSession.js

@@ -0,0 +1,115 @@
+/*!
+ * Connect - cookieSession
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+  , Cookie = require('./session/cookie')
+  , debug = require('debug')('connect:cookieSession')
+  , signature = require('cookie-signature')
+  , crc32 = require('buffer-crc32');
+
+/**
+ * Cookie Session:
+ *
+ *   Cookie session middleware.
+ *
+ *      var app = connect();
+ *      app.use(connect.cookieParser());
+ *      app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));
+ *
+ * Options:
+ *
+ *   - `key` cookie name defaulting to `connect.sess`
+ *   - `secret` prevents cookie tampering
+ *   - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ *   - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Clearing sessions:
+ *
+ *  To clear the session simply set its value to `null`,
+ *  `cookieSession()` will then respond with a 1970 Set-Cookie.
+ *
+ *     req.session = null;
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieSession(options){
+  // TODO: utilize Session/Cookie to unify API
+  options = options || {};
+  var key = options.key || 'connect.sess'
+    , trustProxy = options.proxy;
+
+  return function cookieSession(req, res, next) {
+
+    // req.secret is for backwards compatibility
+    var secret = options.secret || req.secret;
+    if (!secret) throw new Error('`secret` option required for cookie sessions');
+
+    // default session
+    req.session = {};
+    var cookie = req.session.cookie = new Cookie(options.cookie);
+
+    // pathname mismatch
+    if (0 != req.originalUrl.indexOf(cookie.path)) return next();
+
+    // cookieParser secret
+    if (!options.secret && req.secret) {
+      req.session = req.signedCookies[key] || {};
+      req.session.cookie = cookie;
+    } else {
+      // TODO: refactor
+      var rawCookie = req.cookies[key];
+      if (rawCookie) {
+        var unsigned = utils.parseSignedCookie(rawCookie, secret);
+        if (unsigned) {
+          var originalHash = crc32.signed(unsigned);
+          req.session = utils.parseJSONCookie(unsigned) || {};
+          req.session.cookie = cookie;
+        }
+      }
+    }
+
+    res.on('header', function(){
+      // removed
+      if (!req.session) {
+        debug('clear session');
+        cookie.expires = new Date(0);
+        res.setHeader('Set-Cookie', cookie.serialize(key, ''));
+        return;
+      }
+
+      delete req.session.cookie;
+
+      // check security
+      var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
+        , tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0]);
+
+      // only send secure cookies via https
+      if (cookie.secure && !tls) return debug('not secured');
+
+      // serialize
+      debug('serializing %j', req.session);
+      var val = 'j:' + JSON.stringify(req.session);
+
+      // compare hashes, no need to set-cookie if unchanged
+      if (originalHash == crc32.signed(val)) return debug('unmodified session');
+
+      // set-cookie
+      val = 's:' + signature.sign(val, secret);
+      val = cookie.serialize(key, val);
+      debug('set-cookie %j', cookie);
+      res.setHeader('Set-Cookie', val);
+    });
+
+    next();
+  };
+};

+ 74 - 0
node_modules/express/node_modules/connect/lib/middleware/csrf.js

@@ -0,0 +1,74 @@
+/*!
+ * Connect - csrf
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+var uid = require('uid2');
+
+/**
+ * Anti CSRF:
+ *
+ * CRSF protection middleware.
+ *
+ * By default this middleware generates a token named "_csrf"
+ * which should be added to requests which mutate
+ * state, within a hidden form field, query-string etc. This
+ * token is validated against the visitor's `req.session._csrf`
+ * property.
+ *
+ * The default `value` function checks `req.body` generated
+ * by the `bodyParser()` middleware, `req.query` generated
+ * by `query()`, and the "X-CSRF-Token" header field.
+ *
+ * This middleware requires session support, thus should be added
+ * somewhere _below_ `session()` and `cookieParser()`.
+ *
+ * Options:
+ *
+ *    - `value` a function accepting the request, returning the token
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+module.exports = function csrf(options) {
+  options = options || {};
+  var value = options.value || defaultValue;
+
+  return function(req, res, next){
+    // generate CSRF token
+    var token = req.session._csrf || (req.session._csrf = uid(24));
+
+    // ignore these methods
+    if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();
+
+    // determine value
+    var val = value(req);
+
+    // check
+    if (val != token) return next(utils.error(403));
+
+    next();
+  }
+};
+
+/**
+ * Default value function, checking the `req.body`
+ * and `req.query` for the CSRF token.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+function defaultValue(req) {
+  return (req.body && req.body._csrf)
+    || (req.query && req.query._csrf)
+    || (req.headers['x-csrf-token']);
+}

+ 229 - 0
node_modules/express/node_modules/connect/lib/middleware/directory.js

@@ -0,0 +1,229 @@
+
+/*!
+ * Connect - directory
+ * Copyright(c) 2011 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+// TODO: icon / style for directories
+// TODO: arrow key navigation
+// TODO: make icons extensible
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+  , parse = require('url').parse
+  , utils = require('../utils')
+  , path = require('path')
+  , normalize = path.normalize
+  , extname = path.extname
+  , join = path.join;
+
+/*!
+ * Icon cache.
+ */
+
+var cache = {};
+
+/**
+ * Directory:
+ *
+ * Serve directory listings with the given `root` path.
+ *
+ * Options:
+ *
+ *  - `hidden` display hidden (dot) files. Defaults to false.
+ *  - `icons`  display icons. Defaults to false.
+ *  - `filter` Apply this filter function to files. Defaults to false.
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function directory(root, options){
+  options = options || {};
+
+  // root required
+  if (!root) throw new Error('directory() root path required');
+  var hidden = options.hidden
+    , icons = options.icons
+    , filter = options.filter
+    , root = normalize(root);
+
+  return function directory(req, res, next) {
+    if ('GET' != req.method && 'HEAD' != req.method) return next();
+
+    var accept = req.headers.accept || 'text/plain'
+      , url = parse(req.url)
+      , dir = decodeURIComponent(url.pathname)
+      , path = normalize(join(root, dir))
+      , originalUrl = parse(req.originalUrl)
+      , originalDir = decodeURIComponent(originalUrl.pathname)
+      , showUp = path != root && path != root + '/';
+
+    // null byte(s), bad request
+    if (~path.indexOf('\0')) return next(utils.error(400));
+
+    // malicious path, forbidden
+    if (0 != path.indexOf(root)) return next(utils.error(403));
+
+    // check if we have a directory
+    fs.stat(path, function(err, stat){
+      if (err) return 'ENOENT' == err.code
+        ? next()
+        : next(err);
+
+      if (!stat.isDirectory()) return next();
+
+      // fetch files
+      fs.readdir(path, function(err, files){
+        if (err) return next(err);
+        if (!hidden) files = removeHidden(files);
+        if (filter) files = files.filter(filter);
+        files.sort();
+
+        // content-negotiation
+        for (var key in exports) {
+          if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {
+            exports[key](req, res, files, next, originalDir, showUp, icons);
+            return;
+          }
+        }
+
+        // not acceptable
+        next(utils.error(406));
+      });
+    });
+  };
+};
+
+/**
+ * Respond with text/html.
+ */
+
+exports.html = function(req, res, files, next, dir, showUp, icons){
+  fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){
+    if (err) return next(err);
+    fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){
+      if (err) return next(err);
+      if (showUp) files.unshift('..');
+      str = str
+        .replace('{style}', style)
+        .replace('{files}', html(files, dir, icons))
+        .replace('{directory}', dir)
+        .replace('{linked-path}', htmlPath(dir));
+      res.setHeader('Content-Type', 'text/html');
+      res.setHeader('Content-Length', str.length);
+      res.end(str);
+    });
+  });
+};
+
+/**
+ * Respond with application/json.
+ */
+
+exports.json = function(req, res, files){
+  files = JSON.stringify(files);
+  res.setHeader('Content-Type', 'application/json');
+  res.setHeader('Content-Length', files.length);
+  res.end(files);
+};
+
+/**
+ * Respond with text/plain.
+ */
+
+exports.plain = function(req, res, files){
+  files = files.join('\n') + '\n';
+  res.setHeader('Content-Type', 'text/plain');
+  res.setHeader('Content-Length', files.length);
+  res.end(files);
+};
+
+/**
+ * Map html `dir`, returning a linked path.
+ */
+
+function htmlPath(dir) {
+  var curr = [];
+  return dir.split('/').map(function(part){
+    curr.push(part);
+    return '<a href="' + curr.join('/') + '">' + part + '</a>';
+  }).join(' / ');
+}
+
+/**
+ * Map html `files`, returning an html unordered list.
+ */
+
+function html(files, dir, useIcons) {
+  return '<ul id="files">' + files.map(function(file){
+    var icon = ''
+      , classes = [];
+
+    if (useIcons && '..' != file) {
+      icon = icons[extname(file)] || icons.default;
+      icon = '<img src="data:image/png;base64,' + load(icon) + '" />';
+      classes.push('icon');
+    }
+
+    return '<li><a href="'
+      + join(dir, file)
+      + '" class="'
+      + classes.join(' ') + '"'
+      + ' title="' + file + '">'
+      + icon + file + '</a></li>';
+
+  }).join('\n') + '</ul>';
+}
+
+/**
+ * Load and cache the given `icon`.
+ *
+ * @param {String} icon
+ * @return {String}
+ * @api private
+ */
+
+function load(icon) {
+  if (cache[icon]) return cache[icon];
+  return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
+}
+
+/**
+ * Filter "hidden" `files`, aka files
+ * beginning with a `.`.
+ *
+ * @param {Array} files
+ * @return {Array}
+ * @api private
+ */
+
+function removeHidden(files) {
+  return files.filter(function(file){
+    return '.' != file[0];
+  });
+}
+
+/**
+ * Icon map.
+ */
+
+var icons = {
+    '.js': 'page_white_code_red.png'
+  , '.c': 'page_white_c.png'
+  , '.h': 'page_white_h.png'
+  , '.cc': 'page_white_cplusplus.png'
+  , '.php': 'page_white_php.png'
+  , '.rb': 'page_white_ruby.png'
+  , '.cpp': 'page_white_cplusplus.png'
+  , '.swf': 'page_white_flash.png'
+  , '.pdf': 'page_white_acrobat.png'
+  , 'default': 'page_white.png'
+};

+ 86 - 0
node_modules/express/node_modules/connect/lib/middleware/errorHandler.js

@@ -0,0 +1,86 @@
+/*!
+ * Connect - errorHandler
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , fs = require('fs');
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Error handler:
+ *
+ * Development error handler, providing stack traces
+ * and error message responses for requests accepting text, html,
+ * or json.
+ *
+ * Text:
+ *
+ *   By default, and when _text/plain_ is accepted a simple stack trace
+ *   or error message will be returned.
+ *
+ * JSON:
+ *
+ *   When _application/json_ is accepted, connect will respond with
+ *   an object in the form of `{ "error": error }`.
+ *
+ * HTML:
+ *
+ *   When accepted connect will output a nice html stack trace.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function errorHandler(){
+  return function errorHandler(err, req, res, next){
+    if (err.status) res.statusCode = err.status;
+    if (res.statusCode < 400) res.statusCode = 500;
+    if ('test' != env) console.error(err.stack);
+    var accept = req.headers.accept || '';
+    // html
+    if (~accept.indexOf('html')) {
+      fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
+        fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
+          var stack = (err.stack || '')
+            .split('\n').slice(1)
+            .map(function(v){ return '<li>' + v + '</li>'; }).join('');
+            html = html
+              .replace('{style}', style)
+              .replace('{stack}', stack)
+              .replace('{title}', exports.title)
+              .replace('{statusCode}', res.statusCode)
+              .replace(/\{error\}/g, utils.escape(err.toString()));
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(html);
+        });
+      });
+    // json
+    } else if (~accept.indexOf('json')) {
+      var error = { message: err.message, stack: err.stack };
+      for (var prop in err) error[prop] = err[prop];
+      var json = JSON.stringify({ error: error });
+      res.setHeader('Content-Type', 'application/json');
+      res.end(json);
+    // plain text
+    } else {
+      res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
+      res.end(err.stack);
+    }
+  };
+};
+
+/**
+ * Template title, framework authors may override this value.
+ */
+
+exports.title = 'Connect';

+ 80 - 0
node_modules/express/node_modules/connect/lib/middleware/favicon.js

@@ -0,0 +1,80 @@
+/*!
+ * Connect - favicon
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+  , utils = require('../utils');
+
+/**
+ * Favicon:
+ *
+ * By default serves the connect favicon, or the favicon
+ * located by the given `path`.
+ *
+ * Options:
+ *
+ *   - `maxAge`  cache-control max-age directive, defaulting to 1 day
+ *
+ * Examples:
+ *
+ *   Serve default favicon:
+ *
+ *     connect()
+ *       .use(connect.favicon())
+ *
+ *   Serve favicon before logging for brevity:
+ *
+ *     connect()
+ *       .use(connect.favicon())
+ *       .use(connect.logger('dev'))
+ *
+ *   Serve custom favicon:
+ *
+ *     connect()
+ *       .use(connect.favicon('public/favicon.ico'))
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function favicon(path, options){
+  var options = options || {}
+    , path = path || __dirname + '/../public/favicon.ico'
+    , maxAge = options.maxAge || 86400000
+    , icon; // favicon cache
+
+  return function favicon(req, res, next){
+    if ('/favicon.ico' == req.url) {
+      if (icon) {
+        res.writeHead(200, icon.headers);
+        res.end(icon.body);
+      } else {
+        fs.readFile(path, function(err, buf){
+          if (err) return next(err);
+          icon = {
+            headers: {
+                'Content-Type': 'image/x-icon'
+              , 'Content-Length': buf.length
+              , 'ETag': '"' + utils.md5(buf) + '"'
+              , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)
+            },
+            body: buf
+          };
+          res.writeHead(200, icon.headers);
+          res.end(icon.body);
+        });
+      }
+    } else {
+      next();
+    }
+  };
+};

+ 89 - 0
node_modules/express/node_modules/connect/lib/middleware/json.js

@@ -0,0 +1,89 @@
+
+/*!
+ * Connect - json
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , _limit = require('./limit');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+  next();
+}
+
+/**
+ * JSON:
+ *
+ * Parse JSON request bodies, providing the
+ * parsed object as `req.body`.
+ *
+ * Options:
+ *
+ *   - `strict`  when `false` anything `JSON.parse()` accepts will be parsed
+ *   - `reviver`  used as the second "reviver" argument for JSON.parse
+ *   - `limit`  byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+  var options = options || {}
+    , strict = options.strict !== false;
+
+  var limit = options.limit
+    ? _limit(options.limit)
+    : noop;
+
+  return function json(req, res, next) {
+    if (req._body) return next();
+    req.body = req.body || {};
+
+    if (!utils.hasBody(req)) return next();
+
+    // check Content-Type
+    if (!exports.regexp.test(utils.mime(req))) return next();
+
+    // flag as parsed
+    req._body = true;
+
+    // parse
+    limit(req, res, function(err){
+      if (err) return next(err);
+      var buf = '';
+      req.setEncoding('utf8');
+      req.on('data', function(chunk){ buf += chunk });
+      req.on('end', function(){
+        var first = buf.trim()[0];
+
+        if (0 == buf.length) {
+          return next(utils.error(400, 'invalid json, empty body'));
+        }
+        
+        if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json'));
+        try {
+          req.body = JSON.parse(buf, options.reviver);
+        } catch (err){
+          err.body = buf;
+          err.status = 400;
+          return next(err);
+        }
+        next();
+      });
+    });
+  };
+};
+
+exports.regexp = /^application\/([\w!#\$%&\*`\-\.\^~]*\+)?json$/i;
+

+ 78 - 0
node_modules/express/node_modules/connect/lib/middleware/limit.js

@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - limit
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils'),
+  brokenPause = utils.brokenPause;
+
+/**
+ * Limit:
+ *
+ *   Limit request bodies to the given size in `bytes`.
+ *
+ *   A string representation of the bytesize may also be passed,
+ *   for example "5mb", "200kb", "1gb", etc.
+ *
+ *     connect()
+ *       .use(connect.limit('5.5mb'))
+ *       .use(handleImageUpload)
+ *
+ * @param {Number|String} bytes
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function limit(bytes){
+  if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);
+  if ('number' != typeof bytes) throw new Error('limit() bytes required');
+  return function limit(req, res, next){
+    var received = 0
+      , len = req.headers['content-length']
+        ? parseInt(req.headers['content-length'], 10)
+        : null;
+
+    // self-awareness
+    if (req._limit) return next();
+    req._limit = true;
+
+    // limit by content-length
+    if (len && len > bytes) return next(utils.error(413));
+
+    // limit
+    if (brokenPause) {
+      listen();
+    } else {
+      req.on('newListener', function handler(event) {
+        if (event !== 'data') return;
+
+        req.removeListener('newListener', handler);
+        // Start listening at the end of the current loop
+        // otherwise the request will be consumed too early.
+        // Sideaffect is `limit` will miss the first chunk,
+        // but that's not a big deal.
+        // Unfortunately, the tests don't have large enough
+        // request bodies to test this.
+        process.nextTick(listen);
+      });
+    };
+
+    next();
+
+    function listen() {
+      req.on('data', function(chunk) {
+        received += Buffer.isBuffer(chunk)
+          ? chunk.length :
+          Buffer.byteLength(chunk);
+
+        if (received > bytes) req.destroy();
+      });
+    };
+  };
+};

+ 339 - 0
node_modules/express/node_modules/connect/lib/middleware/logger.js

@@ -0,0 +1,339 @@
+/*!
+ * Connect - logger
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var bytes = require('bytes');
+
+/*!
+ * Log buffer.
+ */
+
+var buf = [];
+
+/*!
+ * Default log buffer duration.
+ */
+
+var defaultBufferDuration = 1000;
+
+/**
+ * Logger:
+ *
+ * Log requests with the given `options` or a `format` string.
+ *
+ * Options:
+ *
+ *   - `format`  Format string, see below for tokens
+ *   - `stream`  Output stream, defaults to _stdout_
+ *   - `buffer`  Buffer duration, defaults to 1000ms when _true_
+ *   - `immediate`  Write log line on request instead of response (for response times)
+ *
+ * Tokens:
+ *
+ *   - `:req[header]` ex: `:req[Accept]`
+ *   - `:res[header]` ex: `:res[Content-Length]`
+ *   - `:http-version`
+ *   - `:response-time`
+ *   - `:remote-addr`
+ *   - `:date`
+ *   - `:method`
+ *   - `:url`
+ *   - `:referrer`
+ *   - `:user-agent`
+ *   - `:status`
+ *
+ * Formats:
+ *
+ *   Pre-defined formats that ship with connect:
+ *
+ *    - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
+ *    - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
+ *    - `tiny`  ':method :url :status :res[content-length] - :response-time ms'
+ *    - `dev` concise output colored by response status for development use
+ *
+ * Examples:
+ *
+ *      connect.logger() // default
+ *      connect.logger('short')
+ *      connect.logger('tiny')
+ *      connect.logger({ immediate: true, format: 'dev' })
+ *      connect.logger(':method :url - :referrer')
+ *      connect.logger(':req[content-type] -> :res[content-type]')
+ *      connect.logger(function(tokens, req, res){ return 'some format string' })
+ *
+ * Defining Tokens:
+ *
+ *   To define a token, simply invoke `connect.logger.token()` with the
+ *   name and a callback function. The value returned is then available
+ *   as ":type" in this case.
+ *
+ *      connect.logger.token('type', function(req, res){ return req.headers['content-type']; })
+ *
+ * Defining Formats:
+ *
+ *   All default formats are defined this way, however it's public API as well:
+ *
+ *       connect.logger.format('name', 'string or function')
+ *
+ * @param {String|Function|Object} format or options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function logger(options) {
+  if ('object' == typeof options) {
+    options = options || {};
+  } else if (options) {
+    options = { format: options };
+  } else {
+    options = {};
+  }
+
+  // output on request instead of response
+  var immediate = options.immediate;
+
+  // format name
+  var fmt = exports[options.format] || options.format || exports.default;
+
+  // compile format
+  if ('function' != typeof fmt) fmt = compile(fmt);
+
+  // options
+  var stream = options.stream || process.stdout
+    , buffer = options.buffer;
+
+  // buffering support
+  if (buffer) {
+    var realStream = stream
+      , interval = 'number' == typeof buffer
+        ? buffer
+        : defaultBufferDuration;
+
+    // flush interval
+    setInterval(function(){
+      if (buf.length) {
+        realStream.write(buf.join(''));
+        buf.length = 0;
+      }
+    }, interval); 
+
+    // swap the stream
+    stream = {
+      write: function(str){
+        buf.push(str);
+      }
+    };
+  }
+
+  return function logger(req, res, next) {
+    req._startTime = new Date;
+
+    // immediate
+    if (immediate) {
+      var line = fmt(exports, req, res);
+      if (null == line) return;
+      stream.write(line + '\n');
+    // proxy end to output logging
+    } else {
+      var end = res.end;
+      res.end = function(chunk, encoding){
+        res.end = end;
+        res.end(chunk, encoding);
+        var line = fmt(exports, req, res);
+        if (null == line) return;
+        stream.write(line + '\n');
+      };
+    }
+
+
+    next();
+  };
+};
+
+/**
+ * Compile `fmt` into a function.
+ *
+ * @param {String} fmt
+ * @return {Function}
+ * @api private
+ */
+
+function compile(fmt) {
+  fmt = fmt.replace(/"/g, '\\"');
+  var js = '  return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
+    return '"\n    + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "';
+  }) + '";'
+  return new Function('tokens, req, res', js);
+};
+
+/**
+ * Define a token function with the given `name`,
+ * and callback `fn(req, res)`.
+ *
+ * @param {String} name
+ * @param {Function} fn
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.token = function(name, fn) {
+  exports[name] = fn;
+  return this;
+};
+
+/**
+ * Define a `fmt` with the given `name`.
+ *
+ * @param {String} name
+ * @param {String|Function} fmt
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.format = function(name, str){
+  exports[name] = str;
+  return this;
+};
+
+/**
+ * Default format.
+ */
+
+exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
+
+/**
+ * Short format.
+ */
+
+exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
+
+/**
+ * Tiny format.
+ */
+
+exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
+
+/**
+ * dev (colored)
+ */
+
+exports.format('dev', function(tokens, req, res){
+  var status = res.statusCode
+    , len = parseInt(res.getHeader('Content-Length'), 10)
+    , color = 32;
+
+  if (status >= 500) color = 31
+  else if (status >= 400) color = 33
+  else if (status >= 300) color = 36;
+
+  len = isNaN(len)
+    ? ''
+    : len = ' - ' + bytes(len);
+
+  return '\x1b[90m' + req.method
+    + ' ' + req.originalUrl + ' '
+    + '\x1b[' + color + 'm' + res.statusCode
+    + ' \x1b[90m'
+    + (new Date - req._startTime)
+    + 'ms' + len
+    + '\x1b[0m';
+});
+
+/**
+ * request url
+ */
+
+exports.token('url', function(req){
+  return req.originalUrl || req.url;
+});
+
+/**
+ * request method
+ */
+
+exports.token('method', function(req){
+  return req.method;
+});
+
+/**
+ * response time in milliseconds
+ */
+
+exports.token('response-time', function(req){
+  return new Date - req._startTime;
+});
+
+/**
+ * UTC date
+ */
+
+exports.token('date', function(){
+  return new Date().toUTCString();
+});
+
+/**
+ * response status code
+ */
+
+exports.token('status', function(req, res){
+  return res.statusCode;
+});
+
+/**
+ * normalized referrer
+ */
+
+exports.token('referrer', function(req){
+  return req.headers['referer'] || req.headers['referrer'];
+});
+
+/**
+ * remote address
+ */
+
+exports.token('remote-addr', function(req){
+  if (req.ip) return req.ip;
+  var sock = req.socket;
+  if (sock.socket) return sock.socket.remoteAddress;
+  return sock.remoteAddress;
+});
+
+/**
+ * HTTP version
+ */
+
+exports.token('http-version', function(req){
+  return req.httpVersionMajor + '.' + req.httpVersionMinor;
+});
+
+/**
+ * UA string
+ */
+
+exports.token('user-agent', function(req){
+  return req.headers['user-agent'];
+});
+
+/**
+ * request header
+ */
+
+exports.token('req', function(req, res, field){
+  return req.headers[field.toLowerCase()];
+});
+
+/**
+ * response header
+ */
+
+exports.token('res', function(req, res, field){
+  return (res._headers || {})[field.toLowerCase()];
+});
+

+ 59 - 0
node_modules/express/node_modules/connect/lib/middleware/methodOverride.js

@@ -0,0 +1,59 @@
+
+/*!
+ * Connect - methodOverride
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var methods = require('methods');
+
+/**
+ * Method Override:
+ *
+ * Provides faux HTTP method support.
+ *
+ * Pass an optional `key` to use when checking for
+ * a method override, othewise defaults to _\_method_.
+ * The original method is available via `req.originalMethod`.
+ *
+ * @param {String} key
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function methodOverride(key){
+  key = key || "_method";
+  return function methodOverride(req, res, next) {
+    var method;
+    req.originalMethod = req.originalMethod || req.method;
+
+    // req.body
+    if (req.body && key in req.body) {
+      method = req.body[key].toLowerCase();
+      delete req.body[key];
+    }
+
+    // check X-HTTP-Method-Override
+    if (req.headers['x-http-method-override']) {
+      method = req.headers['x-http-method-override'].toLowerCase();
+    }
+
+    // replace
+    if (supports(method)) req.method = method.toUpperCase();
+
+    next();
+  };
+};
+
+/**
+ * Check if node supports `method`.
+ */
+
+function supports(method) {
+  return ~methods.indexOf(method);
+}

+ 133 - 0
node_modules/express/node_modules/connect/lib/middleware/multipart.js

@@ -0,0 +1,133 @@
+/*!
+ * Connect - multipart
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var formidable = require('formidable')
+  , _limit = require('./limit')
+  , utils = require('../utils')
+  , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+  next();
+}
+
+/**
+ * Multipart:
+ * 
+ * Parse multipart/form-data request bodies,
+ * providing the parsed object as `req.body`
+ * and `req.files`.
+ *
+ * Configuration:
+ *
+ *  The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s
+ *  `IncomingForm` object, allowing you to configure the upload directory,
+ *  size limits, etc. For example if you wish to change the upload dir do the following.
+ *
+ *     app.use(connect.multipart({ uploadDir: path }));
+ *
+ * Options:
+ *
+ *   - `limit`  byte limit defaulting to none
+ *   - `defer`  defers processing and exposes the Formidable form object as `req.form`.
+ *              `next()` is called without waiting for the form's "end" event.
+ *              This option is useful if you need to bind to the "progress" event, for example.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+  options = options || {};
+
+  var limit = options.limit
+    ? _limit(options.limit)
+    : noop;
+
+  return function multipart(req, res, next) {
+    if (req._body) return next();
+    req.body = req.body || {};
+    req.files = req.files || {};
+
+    if (!utils.hasBody(req)) return next();
+
+    // ignore GET
+    if ('GET' == req.method || 'HEAD' == req.method) return next();
+
+    // check Content-Type
+    if ('multipart/form-data' != utils.mime(req)) return next();
+
+    // flag as parsed
+    req._body = true;
+
+    // parse
+    limit(req, res, function(err){
+      if (err) return next(err);
+
+      var form = new formidable.IncomingForm
+        , data = {}
+        , files = {}
+        , done;
+
+      Object.keys(options).forEach(function(key){
+        form[key] = options[key];
+      });
+
+      function ondata(name, val, data){
+        if (Array.isArray(data[name])) {
+          data[name].push(val);
+        } else if (data[name]) {
+          data[name] = [data[name], val];
+        } else {
+          data[name] = val;
+        }
+      }
+
+      form.on('field', function(name, val){
+        ondata(name, val, data);
+      });
+
+      form.on('file', function(name, val){
+        ondata(name, val, files);
+      });
+
+      form.on('error', function(err){
+        if (!options.defer) {
+          err.status = 400;
+          next(err);
+        }
+        done = true;
+      });
+
+      form.on('end', function(){
+        if (done) return;
+        try {
+          req.body = qs.parse(data);
+          req.files = qs.parse(files);
+          if (!options.defer) next();
+        } catch (err) {
+          form.emit('error', err);
+        }
+      });
+
+      form.parse(req);
+
+      if (options.defer) {
+        req.form = form;
+        next();
+      }
+    });
+  }
+};

+ 46 - 0
node_modules/express/node_modules/connect/lib/middleware/query.js

@@ -0,0 +1,46 @@
+/*!
+ * Connect - query
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var qs = require('qs')
+  , parse = require('../utils').parseUrl;
+
+/**
+ * Query:
+ *
+ * Automatically parse the query-string when available,
+ * populating the `req.query` object.
+ *
+ * Examples:
+ *
+ *     connect()
+ *       .use(connect.query())
+ *       .use(function(req, res){
+ *         res.end(JSON.stringify(req.query));
+ *       });
+ *
+ *  The `options` passed are provided to qs.parse function.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function query(options){
+  return function query(req, res, next){
+    if (!req.query) {
+      req.query = ~req.url.indexOf('?')
+        ? qs.parse(parse(req).query, options)
+        : {};
+    }
+
+    next();
+  };
+};

+ 32 - 0
node_modules/express/node_modules/connect/lib/middleware/responseTime.js

@@ -0,0 +1,32 @@
+
+/*!
+ * Connect - responseTime
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Reponse time:
+ *
+ * Adds the `X-Response-Time` header displaying the response
+ * duration in milliseconds.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function responseTime(){
+  return function(req, res, next){
+    var start = new Date;
+
+    if (res._responseTime) return next();
+    res._responseTime = true;
+
+    res.on('header', function(){
+      var duration = new Date - start;
+      res.setHeader('X-Response-Time', duration + 'ms');
+    });
+
+    next();
+  };
+};

+ 355 - 0
node_modules/express/node_modules/connect/lib/middleware/session.js

@@ -0,0 +1,355 @@
+/*!
+ * Connect - session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Session = require('./session/session')
+  , debug = require('debug')('connect:session')
+  , MemoryStore = require('./session/memory')
+  , signature = require('cookie-signature')
+  , Cookie = require('./session/cookie')
+  , Store = require('./session/store')
+  , utils = require('./../utils')
+  , uid = require('uid2')
+  , parse = utils.parseUrl
+  , crc32 = require('buffer-crc32');
+
+// environment
+
+var env = process.env.NODE_ENV;
+
+/**
+ * Expose the middleware.
+ */
+
+exports = module.exports = session;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Store = Store;
+exports.Cookie = Cookie;
+exports.Session = Session;
+exports.MemoryStore = MemoryStore;
+
+/**
+ * Warning message for `MemoryStore` usage in production.
+ */
+
+var warning = 'Warning: connection.session() MemoryStore is not\n'
+  + 'designed for a production environment, as it will leak\n'
+  + 'memory, and will not scale past a single process.';
+
+/**
+ * Session:
+ *
+ *   Setup session store with the given `options`.
+ *
+ *   Session data is _not_ saved in the cookie itself, however
+ *   cookies are used, so we must use the [cookieParser()](cookieParser.html)
+ *   middleware _before_ `session()`.
+ *
+ * Examples:
+ *
+ *     connect()
+ *       .use(connect.cookieParser())
+ *       .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
+ *
+ * Options:
+ *
+ *   - `key` cookie name defaulting to `connect.sid`
+ *   - `store` session store instance
+ *   - `secret` session cookie is signed with this secret to prevent tampering
+ *   - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ *   - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Cookie option:
+ *
+ *  By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set
+ *  so the cookie becomes a browser-session cookie. When the user closes the
+ *  browser the cookie (and session) will be removed.
+ *
+ * ## req.session
+ *
+ *  To store or access session data, simply use the request property `req.session`,
+ *  which is (generally) serialized as JSON by the store, so nested objects
+ *  are typically fine. For example below is a user-specific view counter:
+ *
+ *       connect()
+ *         .use(connect.favicon())
+ *         .use(connect.cookieParser())
+ *         .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
+ *         .use(function(req, res, next){
+ *           var sess = req.session;
+ *           if (sess.views) {
+ *             res.setHeader('Content-Type', 'text/html');
+ *             res.write('<p>views: ' + sess.views + '</p>');
+ *             res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
+ *             res.end();
+ *             sess.views++;
+ *           } else {
+ *             sess.views = 1;
+ *             res.end('welcome to the session demo. refresh!');
+ *           }
+ *         }
+ *       )).listen(3000);
+ *
+ * ## Session#regenerate()
+ *
+ *  To regenerate the session simply invoke the method, once complete
+ *  a new SID and `Session` instance will be initialized at `req.session`.
+ *
+ *      req.session.regenerate(function(err){
+ *        // will have a new session here
+ *      });
+ *
+ * ## Session#destroy()
+ *
+ *  Destroys the session, removing `req.session`, will be re-generated next request.
+ *
+ *      req.session.destroy(function(err){
+ *        // cannot access session here
+ *      });
+ *
+ * ## Session#reload()
+ *
+ *  Reloads the session data.
+ *
+ *      req.session.reload(function(err){
+ *        // session updated
+ *      });
+ *
+ * ## Session#save()
+ *
+ *  Save the session.
+ *
+ *      req.session.save(function(err){
+ *        // session saved
+ *      });
+ *
+ * ## Session#touch()
+ *
+ *   Updates the `.maxAge` property. Typically this is
+ *   not necessary to call, as the session middleware does this for you.
+ *
+ * ## Session#cookie
+ *
+ *  Each session has a unique cookie object accompany it. This allows
+ *  you to alter the session cookie per visitor. For example we can
+ *  set `req.session.cookie.expires` to `false` to enable the cookie
+ *  to remain for only the duration of the user-agent.
+ *
+ * ## Session#maxAge
+ *
+ *  Alternatively `req.session.cookie.maxAge` will return the time
+ *  remaining in milliseconds, which we may also re-assign a new value
+ *  to adjust the `.expires` property appropriately. The following
+ *  are essentially equivalent
+ *
+ *     var hour = 3600000;
+ *     req.session.cookie.expires = new Date(Date.now() + hour);
+ *     req.session.cookie.maxAge = hour;
+ *
+ * For example when `maxAge` is set to `60000` (one minute), and 30 seconds
+ * has elapsed it will return `30000` until the current request has completed,
+ * at which time `req.session.touch()` is called to reset `req.session.maxAge`
+ * to its original value.
+ *
+ *     req.session.cookie.maxAge;
+ *     // => 30000
+ *
+ * Session Store Implementation:
+ *
+ * Every session store _must_ implement the following methods
+ *
+ *    - `.get(sid, callback)`
+ *    - `.set(sid, session, callback)`
+ *    - `.destroy(sid, callback)`
+ *
+ * Recommended methods include, but are not limited to:
+ *
+ *    - `.length(callback)`
+ *    - `.clear(callback)`
+ *
+ * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+function session(options){
+  var options = options || {}
+    , key = options.key || 'connect.sid'
+    , store = options.store || new MemoryStore
+    , cookie = options.cookie || {}
+    , trustProxy = options.proxy
+    , storeReady = true;
+
+  // notify user that this store is not
+  // meant for a production environment
+  if ('production' == env && store instanceof MemoryStore) {
+    console.warn(warning);
+  }
+
+  // generates the new session
+  store.generate = function(req){
+    req.sessionID = uid(24);
+    req.session = new Session(req);
+    req.session.cookie = new Cookie(cookie);
+  };
+
+  store.on('disconnect', function(){ storeReady = false; });
+  store.on('connect', function(){ storeReady = true; });
+
+  return function session(req, res, next) {
+    // self-awareness
+    if (req.session) return next();
+
+    // Handle connection as if there is no session if
+    // the store has temporarily disconnected etc
+    if (!storeReady) return debug('store is disconnected'), next();
+
+    // pathname mismatch
+    if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next();
+
+    // backwards compatibility for signed cookies
+    // req.secret is passed from the cookie parser middleware
+    var secret = options.secret || req.secret;
+
+    // ensure secret is available or bail
+    if (!secret) throw new Error('`secret` option required for sessions');
+
+    // parse url
+    var originalHash
+      , originalId;
+
+    // expose store
+    req.sessionStore = store;
+
+    // grab the session cookie value and check the signature
+    var rawCookie = req.cookies[key];
+
+    // get signedCookies for backwards compat with signed cookies
+    var unsignedCookie = req.signedCookies[key];
+
+    if (!unsignedCookie && rawCookie) {
+      unsignedCookie = utils.parseSignedCookie(rawCookie, secret);
+    }
+
+    // set-cookie
+    res.on('header', function(){
+      if (!req.session) return;
+      var cookie = req.session.cookie
+        , proto = (req.headers['x-forwarded-proto'] || '').split(',')[0].toLowerCase().trim()
+        , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
+        , isNew = unsignedCookie != req.sessionID;
+
+      // only send secure cookies via https
+      if (cookie.secure && !tls) return debug('not secured');
+
+      // long expires, handle expiry server-side
+      if (!isNew && cookie.hasLongExpires) return debug('already set cookie');
+
+      // browser-session length cookie
+      if (null == cookie.expires) {
+        if (!isNew) return debug('already set browser-session cookie');
+      // compare hashes and ids
+      } else if (originalHash == hash(req.session) && originalId == req.session.id) {
+        return debug('unmodified session');
+      }
+
+      var val = 's:' + signature.sign(req.sessionID, secret);
+      val = cookie.serialize(key, val);
+      debug('set-cookie %s', val);
+      res.setHeader('Set-Cookie', val);
+    });
+
+    // proxy end() to commit the session
+    var end = res.end;
+    res.end = function(data, encoding){
+      res.end = end;
+      if (!req.session) return res.end(data, encoding);
+      debug('saving');
+      req.session.resetMaxAge();
+      req.session.save(function(err){
+        if (err) console.error(err.stack);
+        debug('saved');
+        res.end(data, encoding);
+      });
+    };
+
+    // generate the session
+    function generate() {
+      store.generate(req);
+    }
+
+    // get the sessionID from the cookie
+    req.sessionID = unsignedCookie;
+
+    // generate a session if the browser doesn't send a sessionID
+    if (!req.sessionID) {
+      debug('no SID sent, generating session');
+      generate();
+      next();
+      return;
+    }
+
+    // generate the session object
+    var pause = utils.pause(req);
+    debug('fetching %s', req.sessionID);
+    store.get(req.sessionID, function(err, sess){
+      // proxy to resume() events
+      var _next = next;
+      next = function(err){
+        _next(err);
+        pause.resume();
+      };
+
+      // error handling
+      if (err) {
+        debug('error %j', err);
+        if ('ENOENT' == err.code) {
+          generate();
+          next();
+        } else {
+          next(err);
+        }
+      // no session
+      } else if (!sess) {
+        debug('no session found');
+        generate();
+        next();
+      // populate req.session
+      } else {
+        debug('session found');
+        store.createSession(req, sess);
+        originalId = req.sessionID;
+        originalHash = hash(sess);
+        next();
+      }
+    });
+  };
+};
+
+/**
+ * Hash the given `sess` object omitting changes
+ * to `.cookie`.
+ *
+ * @param {Object} sess
+ * @return {String}
+ * @api private
+ */
+
+function hash(sess) {
+  return crc32.signed(JSON.stringify(sess, function(key, val){
+    if ('cookie' != key) return val;
+  }));
+}

+ 140 - 0
node_modules/express/node_modules/connect/lib/middleware/session/cookie.js

@@ -0,0 +1,140 @@
+
+/*!
+ * Connect - session - Cookie
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils')
+  , cookie = require('cookie');
+
+/**
+ * Initialize a new `Cookie` with the given `options`.
+ *
+ * @param {IncomingMessage} req
+ * @param {Object} options
+ * @api private
+ */
+
+var Cookie = module.exports = function Cookie(options) {
+  this.path = '/';
+  this.maxAge = null;
+  this.httpOnly = true;
+  if (options) utils.merge(this, options);
+  this.originalMaxAge = undefined == this.originalMaxAge
+    ? this.maxAge
+    : this.originalMaxAge;
+};
+
+/*!
+ * Prototype.
+ */
+
+Cookie.prototype = {
+
+  /**
+   * Set expires `date`.
+   *
+   * @param {Date} date
+   * @api public
+   */
+
+  set expires(date) {
+    this._expires = date;
+    this.originalMaxAge = this.maxAge;
+  },
+
+  /**
+   * Get expires `date`.
+   *
+   * @return {Date}
+   * @api public
+   */
+
+  get expires() {
+    return this._expires;
+  },
+
+  /**
+   * Set expires via max-age in `ms`.
+   *
+   * @param {Number} ms
+   * @api public
+   */
+
+  set maxAge(ms) {
+    this.expires = 'number' == typeof ms
+      ? new Date(Date.now() + ms)
+      : ms;
+  },
+
+  /**
+   * Get expires max-age in `ms`.
+   *
+   * @return {Number}
+   * @api public
+   */
+
+  get maxAge() {
+    return this.expires instanceof Date
+      ? this.expires.valueOf() - Date.now()
+      : this.expires;
+  },
+
+  /**
+   * Return cookie data object.
+   *
+   * @return {Object}
+   * @api private
+   */
+
+  get data() {
+    return {
+        originalMaxAge: this.originalMaxAge
+      , expires: this._expires
+      , secure: this.secure
+      , httpOnly: this.httpOnly
+      , domain: this.domain
+      , path: this.path
+    }
+  },
+
+  /**
+   * Check if the cookie has a reasonably large max-age.
+   *
+   * @return {Boolean}
+   * @api private
+   */
+
+  get hasLongExpires() {
+    var week = 604800000;
+    return this.maxAge > (4 * week);
+  },
+
+  /**
+   * Return a serialized cookie string.
+   *
+   * @return {String}
+   * @api public
+   */
+
+  serialize: function(name, val){
+    return cookie.serialize(name, val, this.data);
+  },
+
+  /**
+   * Return JSON representation of this cookie.
+   *
+   * @return {Object}
+   * @api private
+   */
+
+  toJSON: function(){
+    return this.data;
+  }
+};

+ 129 - 0
node_modules/express/node_modules/connect/lib/middleware/session/memory.js

@@ -0,0 +1,129 @@
+
+/*!
+ * Connect - session - MemoryStore
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Store = require('./store');
+
+/**
+ * Initialize a new `MemoryStore`.
+ *
+ * @api public
+ */
+
+var MemoryStore = module.exports = function MemoryStore() {
+  this.sessions = {};
+};
+
+/**
+ * Inherit from `Store.prototype`.
+ */
+
+MemoryStore.prototype.__proto__ = Store.prototype;
+
+/**
+ * Attempt to fetch session by the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.get = function(sid, fn){
+  var self = this;
+  process.nextTick(function(){
+    var expires
+      , sess = self.sessions[sid];
+    if (sess) {
+      sess = JSON.parse(sess);
+      expires = 'string' == typeof sess.cookie.expires
+        ? new Date(sess.cookie.expires)
+        : sess.cookie.expires;
+      if (!expires || new Date < expires) {
+        fn(null, sess);
+      } else {
+        self.destroy(sid, fn);
+      }
+    } else {
+      fn();
+    }
+  });
+};
+
+/**
+ * Commit the given `sess` object associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Session} sess
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.set = function(sid, sess, fn){
+  var self = this;
+  process.nextTick(function(){
+    self.sessions[sid] = JSON.stringify(sess);
+    fn && fn();
+  });
+};
+
+/**
+ * Destroy the session associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @api public
+ */
+
+MemoryStore.prototype.destroy = function(sid, fn){
+  var self = this;
+  process.nextTick(function(){
+    delete self.sessions[sid];
+    fn && fn();
+  });
+};
+
+/**
+ * Invoke the given callback `fn` with all active sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.all = function(fn){
+  var arr = []
+    , keys = Object.keys(this.sessions);
+  for (var i = 0, len = keys.length; i < len; ++i) {
+    arr.push(this.sessions[keys[i]]);
+  }
+  fn(null, arr);
+};
+
+/**
+ * Clear all sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.clear = function(fn){
+  this.sessions = {};
+  fn && fn();
+};
+
+/**
+ * Fetch number of sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.length = function(fn){
+  fn(null, Object.keys(this.sessions).length);
+};

+ 116 - 0
node_modules/express/node_modules/connect/lib/middleware/session/session.js

@@ -0,0 +1,116 @@
+
+/*!
+ * Connect - session - Session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils');
+
+/**
+ * Create a new `Session` with the given request and `data`.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} data
+ * @api private
+ */
+
+var Session = module.exports = function Session(req, data) {
+  Object.defineProperty(this, 'req', { value: req });
+  Object.defineProperty(this, 'id', { value: req.sessionID });
+  if ('object' == typeof data) utils.merge(this, data);
+};
+
+/**
+ * Update reset `.cookie.maxAge` to prevent
+ * the cookie from expiring when the
+ * session is still active.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.touch = function(){
+  return this.resetMaxAge();
+};
+
+/**
+ * Reset `.maxAge` to `.originalMaxAge`.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.resetMaxAge = function(){
+  this.cookie.maxAge = this.cookie.originalMaxAge;
+  return this;
+};
+
+/**
+ * Save the session data with optional callback `fn(err)`.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.save = function(fn){
+  this.req.sessionStore.set(this.id, this, fn || function(){});
+  return this;
+};
+
+/**
+ * Re-loads the session data _without_ altering
+ * the maxAge properties. Invokes the callback `fn(err)`,
+ * after which time if no exception has occurred the
+ * `req.session` property will be a new `Session` object,
+ * although representing the same session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.reload = function(fn){
+  var req = this.req
+    , store = this.req.sessionStore;
+  store.get(this.id, function(err, sess){
+    if (err) return fn(err);
+    if (!sess) return fn(new Error('failed to load session'));
+    store.createSession(req, sess);
+    fn();
+  });
+  return this;
+};
+
+/**
+ * Destroy `this` session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.destroy = function(fn){
+  delete this.req.session;
+  this.req.sessionStore.destroy(this.id, fn);
+  return this;
+};
+
+/**
+ * Regenerate this request's session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.regenerate = function(fn){
+  this.req.sessionStore.regenerate(this.req, fn);
+  return this;
+};

+ 84 - 0
node_modules/express/node_modules/connect/lib/middleware/session/store.js

@@ -0,0 +1,84 @@
+
+/*!
+ * Connect - session - Store
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , Session = require('./session')
+  , Cookie = require('./cookie');
+
+/**
+ * Initialize abstract `Store`.
+ *
+ * @api private
+ */
+
+var Store = module.exports = function Store(options){};
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Store.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Re-generate the given requests's session.
+ *
+ * @param {IncomingRequest} req
+ * @return {Function} fn
+ * @api public
+ */
+
+Store.prototype.regenerate = function(req, fn){
+  var self = this;
+  this.destroy(req.sessionID, function(err){
+    self.generate(req);
+    fn(err);
+  });
+};
+
+/**
+ * Load a `Session` instance via the given `sid`
+ * and invoke the callback `fn(err, sess)`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+Store.prototype.load = function(sid, fn){
+  var self = this;
+  this.get(sid, function(err, sess){
+    if (err) return fn(err);
+    if (!sess) return fn();
+    var req = { sessionID: sid, sessionStore: self };
+    sess = self.createSession(req, sess);
+    fn(null, sess);
+  });
+};
+
+/**
+ * Create session from JSON `sess` data.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} sess
+ * @return {Session}
+ * @api private
+ */
+
+Store.prototype.createSession = function(req, sess){
+  var expires = sess.cookie.expires
+    , orig = sess.cookie.originalMaxAge;
+  sess.cookie = new Cookie(sess.cookie);
+  if ('string' == typeof expires) sess.cookie.expires = new Date(expires);
+  sess.cookie.originalMaxAge = orig;
+  req.session = new Session(req, sess);
+  return req.session;
+};

+ 95 - 0
node_modules/express/node_modules/connect/lib/middleware/static.js

@@ -0,0 +1,95 @@
+/*!
+ * Connect - static
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var send = require('send')
+  , utils = require('../utils')
+  , parse = utils.parseUrl
+  , url = require('url');
+
+/**
+ * Static:
+ *
+ *   Static file server with the given `root` path.
+ *
+ * Examples:
+ *
+ *     var oneDay = 86400000;
+ *
+ *     connect()
+ *       .use(connect.static(__dirname + '/public'))
+ *
+ *     connect()
+ *       .use(connect.static(__dirname + '/public', { maxAge: oneDay }))
+ *
+ * Options:
+ *
+ *    - `maxAge`     Browser cache maxAge in milliseconds. defaults to 0
+ *    - `hidden`     Allow transfer of hidden files. defaults to false
+ *    - `redirect`   Redirect to trailing "/" when the pathname is a dir. defaults to true
+ *    - `index`      Default file name, defaults to 'index.html'
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(root, options){
+  options = options || {};
+
+  // root required
+  if (!root) throw new Error('static() root path required');
+
+  // default redirect
+  var redirect = false !== options.redirect;
+
+  return function staticMiddleware(req, res, next) {
+    if ('GET' != req.method && 'HEAD' != req.method) return next();
+    var path = parse(req).pathname;
+    var pause = utils.pause(req);
+
+    function resume() {
+      next();
+      pause.resume();
+    }
+
+    function directory() {
+      if (!redirect) return resume();
+      var pathname = url.parse(req.originalUrl).pathname;
+      res.statusCode = 303;
+      res.setHeader('Location', pathname + '/');
+      res.end('Redirecting to ' + utils.escape(pathname) + '/');
+    }
+
+    function error(err) {
+      if (404 == err.status) return resume();
+      next(err);
+    }
+
+    send(req, path)
+      .maxage(options.maxAge || 0)
+      .root(root)
+      .index(options.index || 'index.html')
+      .hidden(options.hidden)
+      .on('error', error)
+      .on('directory', directory)
+      .pipe(res);
+  };
+};
+
+/**
+ * Expose mime module.
+ *
+ * If you wish to extend the mime table use this
+ * reference to the "mime" module in the npm registry.
+ */
+
+exports.mime = send.mime;

+ 231 - 0
node_modules/express/node_modules/connect/lib/middleware/staticCache.js

@@ -0,0 +1,231 @@
+
+/*!
+ * Connect - staticCache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , Cache = require('../cache')
+  , fresh = require('fresh');
+
+/**
+ * Static cache:
+ *
+ * Enables a memory cache layer on top of
+ * the `static()` middleware, serving popular
+ * static files.
+ *
+ * By default a maximum of 128 objects are
+ * held in cache, with a max of 256k each,
+ * totalling ~32mb.
+ *
+ * A Least-Recently-Used (LRU) cache algo
+ * is implemented through the `Cache` object,
+ * simply rotating cache objects as they are
+ * hit. This means that increasingly popular
+ * objects maintain their positions while
+ * others get shoved out of the stack and
+ * garbage collected.
+ *
+ * Benchmarks:
+ *
+ *     static(): 2700 rps
+ *     node-static: 5300 rps
+ *     static() + staticCache(): 7500 rps
+ *
+ * Options:
+ *
+ *   - `maxObjects`  max cache objects [128]
+ *   - `maxLength`  max cache object length 256kb
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function staticCache(options){
+  var options = options || {}
+    , cache = new Cache(options.maxObjects || 128)
+    , maxlen = options.maxLength || 1024 * 256;
+
+  console.warn('connect.staticCache() is deprecated and will be removed in 3.0');
+  console.warn('use varnish or similar reverse proxy caches.');
+
+  return function staticCache(req, res, next){
+    var key = cacheKey(req)
+      , ranges = req.headers.range
+      , hasCookies = req.headers.cookie
+      , hit = cache.get(key);
+
+    // cache static
+    // TODO: change from staticCache() -> cache()
+    // and make this work for any request
+    req.on('static', function(stream){
+      var headers = res._headers
+        , cc = utils.parseCacheControl(headers['cache-control'] || '')
+        , contentLength = headers['content-length']
+        , hit;
+
+      // dont cache set-cookie responses
+      if (headers['set-cookie']) return hasCookies = true;
+
+      // dont cache when cookies are present
+      if (hasCookies) return;
+
+      // ignore larger files
+      if (!contentLength || contentLength > maxlen) return;
+
+      // don't cache partial files
+      if (headers['content-range']) return;
+
+      // dont cache items we shouldn't be
+      // TODO: real support for must-revalidate / no-cache
+      if ( cc['no-cache']
+        || cc['no-store']
+        || cc['private']
+        || cc['must-revalidate']) return;
+
+      // if already in cache then validate
+      if (hit = cache.get(key)){
+        if (headers.etag == hit[0].etag) {
+          hit[0].date = new Date;
+          return;
+        } else {
+          cache.remove(key);
+        }
+      }
+
+      // validation notifiactions don't contain a steam
+      if (null == stream) return;
+
+      // add the cache object
+      var arr = [];
+
+      // store the chunks
+      stream.on('data', function(chunk){
+        arr.push(chunk);
+      });
+
+      // flag it as complete
+      stream.on('end', function(){
+        var cacheEntry = cache.add(key);
+        delete headers['x-cache']; // Clean up (TODO: others)
+        cacheEntry.push(200);
+        cacheEntry.push(headers);
+        cacheEntry.push.apply(cacheEntry, arr);
+      });
+    });
+
+    if (req.method == 'GET' || req.method == 'HEAD') {
+      if (ranges) {
+        next();
+      } else if (!hasCookies && hit && !mustRevalidate(req, hit)) {
+        res.setHeader('X-Cache', 'HIT');
+        respondFromCache(req, res, hit);
+      } else {
+        res.setHeader('X-Cache', 'MISS');
+        next();
+      }
+    } else {
+      next();
+    }
+  }
+};
+
+/**
+ * Respond with the provided cached value.
+ * TODO: Assume 200 code, that's iffy.
+ *
+ * @param {Object} req
+ * @param {Object} res
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function respondFromCache(req, res, cacheEntry) {
+  var status = cacheEntry[0]
+    , headers = utils.merge({}, cacheEntry[1])
+    , content = cacheEntry.slice(2);
+
+  headers.age = (new Date - new Date(headers.date)) / 1000 || 0;
+
+  switch (req.method) {
+    case 'HEAD':
+      res.writeHead(status, headers);
+      res.end();
+      break;
+    case 'GET':
+      if (utils.conditionalGET(req) && fresh(req.headers, headers)) {
+        headers['content-length'] = 0;
+        res.writeHead(304, headers);
+        res.end();
+      } else {
+        res.writeHead(status, headers);
+
+        function write() {
+          while (content.length) {
+            if (false === res.write(content.shift())) {
+              res.once('drain', write);
+              return;
+            }
+          }
+          res.end();
+        }
+
+        write();
+      }
+      break;
+    default:
+      // This should never happen.
+      res.writeHead(500, '');
+      res.end();
+  }
+}
+
+/**
+ * Determine whether or not a cached value must be revalidated.
+ *
+ * @param {Object} req
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function mustRevalidate(req, cacheEntry) {
+  var cacheHeaders = cacheEntry[1]
+    , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '')
+    , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '')
+    , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0;
+
+  if ( cacheCC['no-cache']
+    || cacheCC['must-revalidate']
+    || cacheCC['proxy-revalidate']) return true;
+
+  if (reqCC['no-cache']) return true;
+
+  if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge;
+
+  if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge;
+
+  return false;
+}
+
+/**
+ * The key to use in the cache. For now, this is the URL path and query.
+ *
+ * 'http://example.com?key=value' -> '/?key=value'
+ *
+ * @param {Object} req
+ * @return {String}
+ * @api private
+ */
+
+function cacheKey(req) {
+  return utils.parseUrl(req).path;
+}

+ 55 - 0
node_modules/express/node_modules/connect/lib/middleware/timeout.js

@@ -0,0 +1,55 @@
+/*!
+ * Connect - timeout
+ * Ported from https://github.com/LearnBoost/connect-timeout
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var debug = require('debug')('connect:timeout');
+
+/**
+ * Timeout:
+ *
+ * Times out the request in `ms`, defaulting to `5000`. The
+ * method `req.clearTimeout()` is added to revert this behaviour
+ * programmatically within your application's middleware, routes, etc.
+ *
+ * The timeout error is passed to `next()` so that you may customize
+ * the response behaviour. This error has the `.timeout` property as
+ * well as `.status == 503`.
+ *
+ * @param {Number} ms
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function timeout(ms) {
+  ms = ms || 5000;
+
+  return function(req, res, next) {
+    var id = setTimeout(function(){
+      req.emit('timeout', ms);
+    }, ms);
+
+    req.on('timeout', function(){
+      if (res.headerSent) return debug('response started, cannot timeout');
+      var err = new Error('Response timeout');
+      err.timeout = ms;
+      err.status = 503;
+      next(err);
+    });
+
+    req.clearTimeout = function(){
+      clearTimeout(id);
+    };
+
+    res.on('header', function(){
+      clearTimeout(id);
+    });
+
+    next();
+  };
+};

+ 78 - 0
node_modules/express/node_modules/connect/lib/middleware/urlencoded.js

@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - urlencoded
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , _limit = require('./limit')
+  , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+  next();
+}
+
+/**
+ * Urlencoded:
+ * 
+ *  Parse x-ww-form-urlencoded request bodies,
+ *  providing the parsed object as `req.body`.
+ *
+ * Options:
+ *
+ *    - `limit`  byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+  options = options || {};
+
+  var limit = options.limit
+    ? _limit(options.limit)
+    : noop;
+
+  return function urlencoded(req, res, next) {
+    if (req._body) return next();
+    req.body = req.body || {};
+
+    if (!utils.hasBody(req)) return next();
+
+    // check Content-Type
+    if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();
+
+    // flag as parsed
+    req._body = true;
+
+    // parse
+    limit(req, res, function(err){
+      if (err) return next(err);
+      var buf = '';
+      req.setEncoding('utf8');
+      req.on('data', function(chunk){ buf += chunk });
+      req.on('end', function(){
+        try {
+          req.body = buf.length
+            ? qs.parse(buf, options)
+            : {};
+          next();
+        } catch (err){
+          err.body = buf;
+          next(err);
+        }
+      });
+    });
+  }
+};

+ 40 - 0
node_modules/express/node_modules/connect/lib/middleware/vhost.js

@@ -0,0 +1,40 @@
+
+/*!
+ * Connect - vhost
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Vhost:
+ *
+ *   Setup vhost for the given `hostname` and `server`.
+ *
+ *     connect()
+ *       .use(connect.vhost('foo.com', fooApp))
+ *       .use(connect.vhost('bar.com', barApp))
+ *       .use(connect.vhost('*.com', mainApp))
+ *
+ *  The `server` may be a Connect server or
+ *  a regular Node `http.Server`.
+ *
+ * @param {String} hostname
+ * @param {Server} server
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function vhost(hostname, server){
+  if (!hostname) throw new Error('vhost hostname required');
+  if (!server) throw new Error('vhost server required');
+  var regexp = new RegExp('^' + hostname.replace(/[^*\w]/g, '\\$&').replace(/[*]/g, '(?:.*?)')  + '$', 'i');
+  if (server.onvhost) server.onvhost(hostname);
+  return function vhost(req, res, next){
+    if (!req.headers.host) return next();
+    var host = req.headers.host.split(':')[0];
+    if (!regexp.test(host)) return next();
+    if ('function' == typeof server) return server(req, res, next);
+    server.emit('request', req, res);
+  };
+};

+ 79 - 0
node_modules/express/node_modules/connect/lib/patch.js

@@ -0,0 +1,79 @@
+
+/*!
+ * Connect
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , res = http.ServerResponse.prototype
+  , setHeader = res.setHeader
+  , _renderHeaders = res._renderHeaders
+  , writeHead = res.writeHead;
+
+// apply only once
+
+if (!res._hasConnectPatch) {
+
+  /**
+   * Provide a public "header sent" flag
+   * until node does.
+   *
+   * @return {Boolean}
+   * @api public
+   */
+
+  res.__defineGetter__('headerSent', function(){
+    return this._header;
+  });
+
+  /**
+   * Set header `field` to `val`, special-casing
+   * the `Set-Cookie` field for multiple support.
+   *
+   * @param {String} field
+   * @param {String} val
+   * @api public
+   */
+
+  res.setHeader = function(field, val){
+    var key = field.toLowerCase()
+      , prev;
+
+    // special-case Set-Cookie
+    if (this._headers && 'set-cookie' == key) {
+      if (prev = this.getHeader(field)) {
+        val = Array.isArray(prev)
+          ? prev.concat(val)
+          : [prev, val];
+      }
+    // charset
+    } else if ('content-type' == key && this.charset) {
+      val += '; charset=' + this.charset;
+    }
+
+    return setHeader.call(this, field, val);
+  };
+
+  /**
+   * Proxy to emit "header" event.
+   */
+
+  res._renderHeaders = function(){
+    if (!this._emittedHeader) this.emit('header');
+    this._emittedHeader = true;
+    return _renderHeaders.call(this);
+  };
+
+  res.writeHead = function(){
+    if (!this._emittedHeader) this.emit('header');
+    this._emittedHeader = true;
+    return writeHead.apply(this, arguments);
+  };
+
+  res._hasConnectPatch = true;
+}

+ 230 - 0
node_modules/express/node_modules/connect/lib/proto.js

@@ -0,0 +1,230 @@
+
+/*!
+ * Connect - HTTPServer
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , utils = require('./utils')
+  , debug = require('debug')('connect:dispatcher');
+
+// prototype
+
+var app = module.exports = {};
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Utilize the given middleware `handle` to the given `route`,
+ * defaulting to _/_. This "route" is the mount-point for the
+ * middleware, when given a value other than _/_ the middleware
+ * is only effective when that segment is present in the request's
+ * pathname.
+ *
+ * For example if we were to mount a function at _/admin_, it would
+ * be invoked on _/admin_, and _/admin/settings_, however it would
+ * not be invoked for _/_, or _/posts_.
+ *
+ * Examples:
+ *
+ *      var app = connect();
+ *      app.use(connect.favicon());
+ *      app.use(connect.logger());
+ *      app.use(connect.static(__dirname + '/public'));
+ *
+ * If we wanted to prefix static files with _/public_, we could
+ * "mount" the `static()` middleware:
+ *
+ *      app.use('/public', connect.static(__dirname + '/public'));
+ *
+ * This api is chainable, so the following is valid:
+ *
+ *      connect()
+ *        .use(connect.favicon())
+ *        .use(connect.logger())
+ *        .use(connect.static(__dirname + '/public'))
+ *        .listen(3000);
+ *
+ * @param {String|Function|Server} route, callback or server
+ * @param {Function|Server} callback or server
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+  // default route to '/'
+  if ('string' != typeof route) {
+    fn = route;
+    route = '/';
+  }
+
+  // wrap sub-apps
+  if ('function' == typeof fn.handle) {
+    var server = fn;
+    fn.route = route;
+    fn = function(req, res, next){
+      server.handle(req, res, next);
+    };
+  }
+
+  // wrap vanilla http.Servers
+  if (fn instanceof http.Server) {
+    fn = fn.listeners('request')[0];
+  }
+
+  // strip trailing slash
+  if ('/' == route[route.length - 1]) {
+    route = route.slice(0, -1);
+  }
+
+  // add the middleware
+  debug('use %s %s', route || '/', fn.name || 'anonymous');
+  this.stack.push({ route: route, handle: fn });
+
+  return this;
+};
+
+/**
+ * Handle server requests, punting them down
+ * the middleware stack.
+ *
+ * @api private
+ */
+
+app.handle = function(req, res, out) {
+  var stack = this.stack
+    , fqdn = ~req.url.indexOf('://')
+    , removed = ''
+    , slashAdded = false
+    , index = 0;
+
+  function next(err) {
+    var layer, path, status, c;
+
+    if (slashAdded) {
+      req.url = req.url.substr(1);
+      slashAdded = false;
+    }
+
+    req.url = removed + req.url;
+    req.originalUrl = req.originalUrl || req.url;
+    removed = '';
+
+    // next callback
+    layer = stack[index++];
+
+    // all done
+    if (!layer || res.headerSent) {
+      // delegate to parent
+      if (out) return out(err);
+
+      // unhandled error
+      if (err) {
+        // default to 500
+        if (res.statusCode < 400) res.statusCode = 500;
+        debug('default %s', res.statusCode);
+
+        // respect err.status
+        if (err.status) res.statusCode = err.status;
+
+        // production gets a basic error message
+        var msg = 'production' == env
+          ? http.STATUS_CODES[res.statusCode]
+          : err.stack || err.toString();
+
+        // log to stderr in a non-test env
+        if ('test' != env) console.error(err.stack || err.toString());
+        if (res.headerSent) return req.socket.destroy();
+        res.setHeader('Content-Type', 'text/plain');
+        res.setHeader('Content-Length', Buffer.byteLength(msg));
+        if ('HEAD' == req.method) return res.end();
+        res.end(msg);
+      } else {
+        debug('default 404');
+        res.statusCode = 404;
+        res.setHeader('Content-Type', 'text/plain');
+        if ('HEAD' == req.method) return res.end();
+        res.end('Cannot ' + utils.escape(req.method) + ' ' + utils.escape(req.originalUrl));
+      }
+      return;
+    }
+
+    try {
+      path = utils.parseUrl(req).pathname;
+      if (undefined == path) path = '/';
+
+      // skip this layer if the route doesn't match.
+      if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);
+
+      c = path[layer.route.length];
+      if (c && '/' != c && '.' != c) return next(err);
+
+      // Call the layer handler
+      // Trim off the part of the url that matches the route
+      removed = layer.route;
+      req.url = req.url.substr(removed.length);
+
+      // Ensure leading slash
+      if (!fqdn && '/' != req.url[0]) {
+        req.url = '/' + req.url;
+        slashAdded = true;
+      }
+
+      debug('%s %s : %s', layer.handle.name || 'anonymous', layer.route, req.originalUrl);
+      var arity = layer.handle.length;
+      if (err) {
+        if (arity === 4) {
+          layer.handle(err, req, res, next);
+        } else {
+          next(err);
+        }
+      } else if (arity < 4) {
+        layer.handle(req, res, next);
+      } else {
+        next();
+      }
+    } catch (e) {
+      next(e);
+    }
+  }
+  next();
+};
+
+/**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * HTTP and HTTPS:
+ *
+ * If you run your application both as HTTP
+ * and HTTPS you may wrap them individually,
+ * since your Connect "server" is really just
+ * a JavaScript `Function`.
+ *
+ *      var connect = require('connect')
+ *        , http = require('http')
+ *        , https = require('https');
+ *
+ *      var app = connect();
+ *
+ *      http.createServer(app).listen(80);
+ *      https.createServer(options, app).listen(443);
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+  var server = http.createServer(this);
+  return server.listen.apply(server, arguments);
+};

+ 81 - 0
node_modules/express/node_modules/connect/lib/public/directory.html

@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset='utf-8'> 
+    <title>listing directory {directory}</title>
+    <style>{style}</style>
+    <script>
+      function $(id){
+        var el = 'string' == typeof id
+          ? document.getElementById(id)
+          : id;
+
+        el.on = function(event, fn){
+          if ('content loaded' == event) {
+            event = window.attachEvent ? "load" : "DOMContentLoaded";
+          }
+          el.addEventListener
+            ? el.addEventListener(event, fn, false)
+            : el.attachEvent("on" + event, fn);
+        };
+
+        el.all = function(selector){
+          return $(el.querySelectorAll(selector));
+        };
+
+        el.each = function(fn){
+          for (var i = 0, len = el.length; i < len; ++i) {
+            fn($(el[i]), i);
+          }
+        };
+
+        el.getClasses = function(){
+          return this.getAttribute('class').split(/\s+/);
+        };
+
+        el.addClass = function(name){
+          var classes = this.getAttribute('class');
+          el.setAttribute('class', classes
+            ? classes + ' ' + name
+            : name);
+        };
+
+        el.removeClass = function(name){
+          var classes = this.getClasses().filter(function(curr){
+            return curr != name;
+          });
+          this.setAttribute('class', classes);
+        };
+
+        return el;
+      }
+
+      function search() {
+        var str = $('search').value
+          , links = $('files').all('a');
+
+        links.each(function(link){
+          var text = link.textContent;
+
+          if ('..' == text) return;
+          if (str.length && ~text.indexOf(str)) {
+            link.addClass('highlight');
+          } else {
+            link.removeClass('highlight');
+          }
+        });
+      }
+
+      $(window).on('content loaded', function(){
+        $('search').on('keyup', search);
+      });
+    </script>
+  </head>
+  <body class="directory">
+    <input id="search" type="text" placeholder="Search" autocomplete="off" />
+    <div id="wrapper">
+      <h1>{linked-path}</h1>
+      {files}
+    </div>
+  </body>
+</html>

+ 14 - 0
node_modules/express/node_modules/connect/lib/public/error.html

@@ -0,0 +1,14 @@
+<html>
+  <head>
+    <meta charset='utf-8'> 
+    <title>{error}</title>
+    <style>{style}</style>
+  </head>
+  <body>
+    <div id="wrapper">
+      <h1>{title}</h1>
+      <h2><em>{statusCode}</em> {error}</h2>
+      <ul id="stacktrace">{stack}</ul>
+    </div>
+  </body>
+</html>

BIN
node_modules/express/node_modules/connect/lib/public/favicon.ico


BIN
node_modules/express/node_modules/connect/lib/public/icons/page.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_add.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_attach.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_code.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_copy.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_delete.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_edit.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_error.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_excel.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_find.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_gear.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_go.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_green.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_key.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_link.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_paste.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_red.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_save.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_white.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png


BIN
node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png


Some files were not shown because too many files changed in this diff