├── README ├── index.js ├── models └── tictactoe.js ├── node_modules ├── express │ ├── .npmignore │ ├── History.md │ ├── LICENSE │ ├── Makefile │ ├── Readme.md │ ├── bin │ │ └── express │ ├── index.js │ ├── lib │ │ ├── express.js │ │ ├── http.js │ │ ├── https.js │ │ ├── request.js │ │ ├── response.js │ │ ├── router │ │ │ ├── collection.js │ │ │ ├── index.js │ │ │ ├── methods.js │ │ │ └── route.js │ │ ├── utils.js │ │ ├── view.js │ │ └── view │ │ │ ├── partial.js │ │ │ └── view.js │ ├── node_modules │ │ ├── connect │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── cache.js │ │ │ │ ├── connect.js │ │ │ │ ├── http.js │ │ │ │ ├── https.js │ │ │ │ ├── index.js │ │ │ │ ├── middleware │ │ │ │ │ ├── basicAuth.js │ │ │ │ │ ├── bodyParser.js │ │ │ │ │ ├── compiler.js │ │ │ │ │ ├── cookieParser.js │ │ │ │ │ ├── csrf.js │ │ │ │ │ ├── directory.js │ │ │ │ │ ├── errorHandler.js │ │ │ │ │ ├── favicon.js │ │ │ │ │ ├── limit.js │ │ │ │ │ ├── logger.js │ │ │ │ │ ├── methodOverride.js │ │ │ │ │ ├── profiler.js │ │ │ │ │ ├── query.js │ │ │ │ │ ├── responseTime.js │ │ │ │ │ ├── router.js │ │ │ │ │ ├── session.js │ │ │ │ │ ├── session │ │ │ │ │ │ ├── cookie.js │ │ │ │ │ │ ├── memory.js │ │ │ │ │ │ ├── session.js │ │ │ │ │ │ └── store.js │ │ │ │ │ ├── static.js │ │ │ │ │ ├── staticCache.js │ │ │ │ │ └── vhost.js │ │ │ │ ├── patch.js │ │ │ │ ├── public │ │ │ │ │ ├── directory.html │ │ │ │ │ ├── error.html │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── icons │ │ │ │ │ │ ├── page.png │ │ │ │ │ │ ├── page_add.png │ │ │ │ │ │ ├── page_attach.png │ │ │ │ │ │ ├── page_code.png │ │ │ │ │ │ ├── page_copy.png │ │ │ │ │ │ ├── page_delete.png │ │ │ │ │ │ ├── page_edit.png │ │ │ │ │ │ ├── page_error.png │ │ │ │ │ │ ├── page_excel.png │ │ │ │ │ │ ├── page_find.png │ │ │ │ │ │ ├── page_gear.png │ │ │ │ │ │ ├── page_go.png │ │ │ │ │ │ ├── page_green.png │ │ │ │ │ │ ├── page_key.png │ │ │ │ │ │ ├── page_lightning.png │ │ │ │ │ │ ├── page_link.png │ │ │ │ │ │ ├── page_paintbrush.png │ │ │ │ │ │ ├── page_paste.png │ │ │ │ │ │ ├── page_red.png │ │ │ │ │ │ ├── page_refresh.png │ │ │ │ │ │ ├── page_save.png │ │ │ │ │ │ ├── page_white.png │ │ │ │ │ │ ├── page_white_acrobat.png │ │ │ │ │ │ ├── page_white_actionscript.png │ │ │ │ │ │ ├── page_white_add.png │ │ │ │ │ │ ├── page_white_c.png │ │ │ │ │ │ ├── page_white_camera.png │ │ │ │ │ │ ├── page_white_cd.png │ │ │ │ │ │ ├── page_white_code.png │ │ │ │ │ │ ├── page_white_code_red.png │ │ │ │ │ │ ├── page_white_coldfusion.png │ │ │ │ │ │ ├── page_white_compressed.png │ │ │ │ │ │ ├── page_white_copy.png │ │ │ │ │ │ ├── page_white_cplusplus.png │ │ │ │ │ │ ├── page_white_csharp.png │ │ │ │ │ │ ├── page_white_cup.png │ │ │ │ │ │ ├── page_white_database.png │ │ │ │ │ │ ├── page_white_delete.png │ │ │ │ │ │ ├── page_white_dvd.png │ │ │ │ │ │ ├── page_white_edit.png │ │ │ │ │ │ ├── page_white_error.png │ │ │ │ │ │ ├── page_white_excel.png │ │ │ │ │ │ ├── page_white_find.png │ │ │ │ │ │ ├── page_white_flash.png │ │ │ │ │ │ ├── page_white_freehand.png │ │ │ │ │ │ ├── page_white_gear.png │ │ │ │ │ │ ├── page_white_get.png │ │ │ │ │ │ ├── page_white_go.png │ │ │ │ │ │ ├── page_white_h.png │ │ │ │ │ │ ├── page_white_horizontal.png │ │ │ │ │ │ ├── page_white_key.png │ │ │ │ │ │ ├── page_white_lightning.png │ │ │ │ │ │ ├── page_white_link.png │ │ │ │ │ │ ├── page_white_magnify.png │ │ │ │ │ │ ├── page_white_medal.png │ │ │ │ │ │ ├── page_white_office.png │ │ │ │ │ │ ├── page_white_paint.png │ │ │ │ │ │ ├── page_white_paintbrush.png │ │ │ │ │ │ ├── page_white_paste.png │ │ │ │ │ │ ├── page_white_php.png │ │ │ │ │ │ ├── page_white_picture.png │ │ │ │ │ │ ├── page_white_powerpoint.png │ │ │ │ │ │ ├── page_white_put.png │ │ │ │ │ │ ├── page_white_ruby.png │ │ │ │ │ │ ├── page_white_stack.png │ │ │ │ │ │ ├── page_white_star.png │ │ │ │ │ │ ├── page_white_swoosh.png │ │ │ │ │ │ ├── page_white_text.png │ │ │ │ │ │ ├── page_white_text_width.png │ │ │ │ │ │ ├── page_white_tux.png │ │ │ │ │ │ ├── page_white_vector.png │ │ │ │ │ │ ├── page_white_visualstudio.png │ │ │ │ │ │ ├── page_white_width.png │ │ │ │ │ │ ├── page_white_word.png │ │ │ │ │ │ ├── page_white_world.png │ │ │ │ │ │ ├── page_white_wrench.png │ │ │ │ │ │ ├── page_white_zip.png │ │ │ │ │ │ ├── page_word.png │ │ │ │ │ │ └── page_world.png │ │ │ │ │ └── style.css │ │ │ │ └── utils.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── mime │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── mime.js │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ └── types │ │ │ │ ├── mime.types │ │ │ │ └── node.types │ │ ├── mkdirp │ │ │ ├── .gitignore │ │ │ ├── .gitignore.orig │ │ │ ├── .gitignore.rej │ │ │ ├── LICENSE │ │ │ ├── README.markdown │ │ │ ├── examples │ │ │ │ ├── pow.js │ │ │ │ ├── pow.js.orig │ │ │ │ └── pow.js.rej │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test │ │ │ │ ├── mkdirp.js │ │ │ │ ├── race.js │ │ │ │ └── rel.js │ │ └── qs │ │ │ ├── .gitignore │ │ │ ├── .gitmodules │ │ │ ├── History.md │ │ │ ├── Makefile │ │ │ ├── Readme.md │ │ │ ├── benchmark.js │ │ │ ├── examples.js │ │ │ ├── index.js │ │ │ ├── lib │ │ │ └── querystring.js │ │ │ ├── package.json │ │ │ └── test │ │ │ ├── parse.test.js │ │ │ └── stringify.test.js │ ├── package.json │ └── testing │ │ ├── index.js │ │ ├── public │ │ └── test.txt │ │ └── views │ │ ├── page.html │ │ ├── page.jade │ │ ├── test.md │ │ └── user │ │ ├── index.jade │ │ └── list.jade └── socket.io │ ├── .gitignore │ ├── .npmignore │ ├── History.md │ ├── Makefile │ ├── Readme.md │ ├── benchmarks │ ├── decode.bench.js │ ├── encode.bench.js │ └── runner.js │ ├── examples │ ├── chat │ │ ├── app.js │ │ ├── index.jade │ │ ├── package.json │ │ └── public │ │ │ └── stylesheets │ │ │ ├── mixins.styl │ │ │ ├── style.css │ │ │ └── style.styl │ └── irc-output │ │ ├── app.js │ │ ├── index.jade │ │ ├── irc.js │ │ ├── package.json │ │ └── public │ │ └── stylesheets │ │ └── style.styl │ ├── index.js │ ├── lib │ ├── logger.js │ ├── manager.js │ ├── namespace.js │ ├── parser.js │ ├── socket.io.js │ ├── socket.js │ ├── static.js │ ├── store.js │ ├── stores │ │ ├── memory.js │ │ └── redis.js │ ├── transport.js │ ├── transports │ │ ├── flashsocket.js │ │ ├── htmlfile.js │ │ ├── http-polling.js │ │ ├── http.js │ │ ├── index.js │ │ ├── jsonp-polling.js │ │ ├── websocket.js │ │ ├── websocket │ │ │ ├── default.js │ │ │ ├── hybi-07-12.js │ │ │ ├── hybi-16.js │ │ │ ├── hybi-17.js │ │ │ └── index.js │ │ └── xhr-polling.js │ └── util.js │ ├── package.json │ ├── support │ └── node-websocket-client │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── examples │ │ ├── client-unix.js │ │ ├── client.js │ │ └── server-unix.js │ │ ├── lib │ │ └── websocket.js │ │ ├── package.json │ │ └── test │ │ ├── test-basic.js │ │ ├── test-client-close.js │ │ ├── test-readonly-attrs.js │ │ ├── test-ready-state.js │ │ ├── test-server-close.js │ │ ├── test-unix-send-fd.js │ │ └── test-unix-sockets.js │ └── test │ ├── common.js │ ├── fixtures │ ├── cert.crt │ └── key.key │ ├── hybi-common.js │ ├── io.test.js │ ├── leaks │ └── socket.leaktest.js │ ├── manager.test.js │ ├── namespace.test.js │ ├── parser.test.js │ ├── static.test.js │ ├── stores.memory.test.js │ ├── stores.redis.test.js │ ├── transports.flashsocket.test.js │ ├── transports.htmlfile.test.js │ ├── transports.jsonp-polling.test.js │ ├── transports.websocket.hybi07-12.parser.test.js │ ├── transports.websocket.hybi16.parser.test.js │ ├── transports.websocket.test.js │ └── transports.xhr-polling.test.js ├── preview.png └── public ├── ga.js ├── index.html ├── tictactoe.css └── tictactoe.js /README: -------------------------------------------------------------------------------- 1 | 2 | TicTacToe - игра крестики нолики 3 | Серверная часть написанная на nodejs с использованием socket.io и express. 4 | Клиентская часть на jQuery, UI сделан на jQuery UI. 5 | 6 | == Habrahabr Статья 7 | {Часть 1}[http://habrahabr.ru/blogs/nodejs/132544/] 8 | {Часть 2}[http://habrahabr.ru/blogs/nodejs/132676/] 9 | 10 | 11 | License MIT 12 | http://www.opensource.org/licenses/mit-license.php 13 | 14 | Copyright (c) 2011 Журавлёв Иван 15 | https://github.com/intech/TicTacToe 16 | 17 | Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), 18 | безвозмездно использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, 19 | распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий: 20 | 21 | Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения. 22 | 23 | ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, 24 | СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ 25 | ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ 26 | ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'), app = express.createServer(), 2 | io = require('socket.io').listen(app), TicTacToe = require('./models/tictactoe'); 3 | 4 | app.use(express.static(__dirname + '/public')); 5 | app.listen(1337); 6 | io.set('log level', 1); 7 | io.set('resource', '/api'); 8 | var countGames = 0, countPlayers = [], Game = new TicTacToe(); 9 | // Размеры поля 10 | Game.x = Game.y = 6; // Default: 6 11 | // Необходимое кол-во занятых подряд клеток для победы 12 | Game.stepsToWin = 4; // Default: 4 13 | 14 | setInterval(function() { 15 | io.sockets.emit('stats', [ 16 | 'Всего игр: ' + countGames, 17 | 'Уникальных игроков: ' + Object.keys(countPlayers).length, 18 | 'Сейчас игр: ' + Object.keys(Game.games).length, 19 | 'Сейчас игроков: ' + Object.keys(Game.users).length 20 | ]); 21 | }, 5000); 22 | 23 | io.sockets.on('connection', function (socket) { 24 | console.log('%s: %s - connected', socket.id.toString(), socket.handshake.address.address); 25 | if(countPlayers[socket.handshake.address.address] == undefined) countPlayers[socket.handshake.address.address] = true; 26 | 27 | io.sockets.emit('stats', [ 28 | 'Всего игр: ' + countGames, 29 | 'Уникальных игроков: ' + Object.keys(countPlayers).length, 30 | 'Сейчас игр: ' + Object.keys(Game.games).length, 31 | 'Сейчас игроков: ' + Object.keys(Game.users).length 32 | ]); 33 | 34 | function closeRoom(gameId, opponent) { 35 | socket.leave(gameId); 36 | io.sockets.socket(opponent).leave(gameId); 37 | countGames--; 38 | } 39 | 40 | socket.on('start', function () { 41 | if(Game.users[socket.id] !== undefined) return; 42 | Game.start(socket.id.toString(), function(start, gameId, opponent, x, y){ 43 | if(start) { 44 | Game.games[gameId].on('timeout', function(user) { 45 | Game.end(user, function(gameId, opponent, turn) { 46 | io.sockets.in(gameId).emit('timeout', turn); 47 | closeRoom(gameId, opponent); 48 | }); 49 | }); 50 | 51 | // Подключем к игре соперников в отдельную комнату 52 | socket.join(gameId); 53 | io.sockets.socket(opponent).join(gameId); 54 | socket.emit('ready', gameId, 'X', x, y); 55 | io.sockets.socket(opponent).emit('ready', gameId, 'O', x, y); 56 | countGames++; 57 | } else { 58 | // ожидает аппонента 59 | io.sockets.socket(socket.id).emit('wait'); 60 | } 61 | }); 62 | }); 63 | 64 | socket.on('step', function (gameId, id) { 65 | if(Game.games[gameId] === undefined) return; 66 | // Парсим из ID элемента координаты XxY 67 | var coordinates = id.split('x'); 68 | Game.step(gameId, parseInt(coordinates[0]), parseInt(coordinates[1]), socket.id.toString(), function(win, turn) { 69 | io.sockets.in(gameId).emit('step', id, turn, win); 70 | if(win) { 71 | Game.end(socket.id.toString(), function(gameId, opponent){ 72 | closeRoom(gameId, opponent); 73 | }); 74 | } 75 | }); 76 | }); 77 | 78 | socket.on('disconnect', function () { 79 | // Если один из игроков отключился, посылаем об этом сообщение второму 80 | // Отключаем обоих от игры и удаляем её, освобождаем память 81 | Game.end(socket.id.toString(), function(gameId, opponent) { 82 | io.sockets.socket(opponent).emit('exit'); 83 | closeRoom(gameId, opponent); 84 | }); 85 | console.log('%s: %s - disconnected', socket.id.toString(), socket.handshake.address.address); 86 | }); 87 | 88 | }); -------------------------------------------------------------------------------- /node_modules/express/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | docs/ 3 | examples/ 4 | support/ 5 | test/ 6 | testing.js 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /node_modules/express/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2009-2011 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /node_modules/express/Makefile: -------------------------------------------------------------------------------- 1 | 2 | DOCS = $(shell find docs/*.md) 3 | HTMLDOCS = $(DOCS:.md=.html) 4 | TESTS = $(shell find test/*.test.js) 5 | 6 | test: 7 | @NODE_ENV=test ./node_modules/.bin/expresso $(TESTS) 8 | 9 | docs: $(HTMLDOCS) 10 | @ echo "... generating TOC" 11 | @./support/toc.js docs/guide.html 12 | 13 | %.html: %.md 14 | @echo "... $< -> $@" 15 | @markdown $< \ 16 | | cat docs/layout/head.html - docs/layout/foot.html \ 17 | > $@ 18 | 19 | site: 20 | rm -fr /tmp/docs \ 21 | && cp -fr docs /tmp/docs \ 22 | && git checkout gh-pages \ 23 | && cp -fr /tmp/docs/* . \ 24 | && echo "done" 25 | 26 | docclean: 27 | rm -f docs/*.{1,html} 28 | 29 | .PHONY: site test docs docclean -------------------------------------------------------------------------------- /node_modules/express/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = require('./lib/express'); -------------------------------------------------------------------------------- /node_modules/express/lib/express.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var connect = require('connect') 13 | , HTTPSServer = require('./https') 14 | , HTTPServer = require('./http') 15 | , Route = require('./router/route') 16 | 17 | /** 18 | * Re-export connect auto-loaders. 19 | * 20 | * This prevents the need to `require('connect')` in order 21 | * to access core middleware, so for example `express.logger()` instead 22 | * of `require('connect').logger()`. 23 | */ 24 | 25 | var exports = module.exports = connect.middleware; 26 | 27 | /** 28 | * Framework version. 29 | */ 30 | 31 | exports.version = '2.5.0'; 32 | 33 | /** 34 | * Shortcut for `new Server(...)`. 35 | * 36 | * @param {Function} ... 37 | * @return {Server} 38 | * @api public 39 | */ 40 | 41 | exports.createServer = function(options){ 42 | if ('object' == typeof options) { 43 | return new HTTPSServer(options, Array.prototype.slice.call(arguments, 1)); 44 | } else { 45 | return new HTTPServer(Array.prototype.slice.call(arguments)); 46 | } 47 | }; 48 | 49 | /** 50 | * Expose constructors. 51 | */ 52 | 53 | exports.HTTPServer = HTTPServer; 54 | exports.HTTPSServer = HTTPSServer; 55 | exports.Route = Route; 56 | 57 | /** 58 | * View extensions. 59 | */ 60 | 61 | exports.View = 62 | exports.view = require('./view'); 63 | 64 | /** 65 | * Response extensions. 66 | */ 67 | 68 | require('./response'); 69 | 70 | /** 71 | * Request extensions. 72 | */ 73 | 74 | require('./request'); 75 | 76 | // Error handler title 77 | 78 | exports.errorHandler.title = 'Express'; 79 | 80 | -------------------------------------------------------------------------------- /node_modules/express/lib/https.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - HTTPSServer 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var connect = require('connect') 13 | , HTTPServer = require('./http') 14 | , https = require('https'); 15 | 16 | /** 17 | * Expose `HTTPSServer`. 18 | */ 19 | 20 | exports = module.exports = HTTPSServer; 21 | 22 | /** 23 | * Server proto. 24 | */ 25 | 26 | var app = HTTPSServer.prototype; 27 | 28 | /** 29 | * Initialize a new `HTTPSServer` with the 30 | * given `options`, and optional `middleware`. 31 | * 32 | * @param {Object} options 33 | * @param {Array} middleware 34 | * @api public 35 | */ 36 | 37 | function HTTPSServer(options, middleware){ 38 | connect.HTTPSServer.call(this, options, []); 39 | this.init(middleware); 40 | }; 41 | 42 | /** 43 | * Inherit from `connect.HTTPSServer`. 44 | */ 45 | 46 | app.__proto__ = connect.HTTPSServer.prototype; 47 | 48 | // mixin HTTPServer methods 49 | 50 | Object.keys(HTTPServer.prototype).forEach(function(method){ 51 | app[method] = HTTPServer.prototype[method]; 52 | }); 53 | -------------------------------------------------------------------------------- /node_modules/express/lib/router/collection.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - router - Collection 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Expose `Collection`. 10 | */ 11 | 12 | module.exports = Collection; 13 | 14 | /** 15 | * Initialize a new route `Collection` 16 | * with the given `router`. 17 | * 18 | * @param {Router} router 19 | * @api private 20 | */ 21 | 22 | function Collection(router) { 23 | Array.apply(this, arguments); 24 | this.router = router; 25 | } 26 | 27 | /** 28 | * Inherit from `Array.prototype`. 29 | */ 30 | 31 | Collection.prototype.__proto__ = Array.prototype; 32 | 33 | /** 34 | * Remove the routes in this collection. 35 | * 36 | * @return {Collection} of routes removed 37 | * @api public 38 | */ 39 | 40 | Collection.prototype.remove = function(){ 41 | var router = this.router 42 | , len = this.length 43 | , ret = new Collection(this.router); 44 | 45 | for (var i = 0; i < len; ++i) { 46 | if (router.remove(this[i])) { 47 | ret.push(this[i]); 48 | } 49 | } 50 | 51 | return ret; 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /node_modules/express/lib/router/methods.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - router - methods 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Hypertext Transfer Protocol -- HTTP/1.1 10 | * http://www.ietf.org/rfc/rfc2616.txt 11 | */ 12 | 13 | var RFC2616 = ['OPTIONS', 'GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'CONNECT']; 14 | 15 | /** 16 | * HTTP Extensions for Distributed Authoring -- WEBDAV 17 | * http://www.ietf.org/rfc/rfc2518.txt 18 | */ 19 | 20 | var RFC2518 = ['PROPFIND', 'PROPPATCH', 'MKCOL', 'COPY', 'MOVE', 'LOCK', 'UNLOCK']; 21 | 22 | /** 23 | * Versioning Extensions to WebDAV 24 | * http://www.ietf.org/rfc/rfc3253.txt 25 | */ 26 | 27 | var RFC3253 = ['VERSION-CONTROL', 'REPORT', 'CHECKOUT', 'CHECKIN', 'UNCHECKOUT', 'MKWORKSPACE', 'UPDATE', 'LABEL', 'MERGE', 'BASELINE-CONTROL', 'MKACTIVITY']; 28 | 29 | /** 30 | * Ordered Collections Protocol (WebDAV) 31 | * http://www.ietf.org/rfc/rfc3648.txt 32 | */ 33 | 34 | var RFC3648 = ['ORDERPATCH']; 35 | 36 | /** 37 | * Web Distributed Authoring and Versioning (WebDAV) Access Control Protocol 38 | * http://www.ietf.org/rfc/rfc3744.txt 39 | */ 40 | 41 | var RFC3744 = ['ACL']; 42 | 43 | /** 44 | * Web Distributed Authoring and Versioning (WebDAV) SEARCH 45 | * http://www.ietf.org/rfc/rfc5323.txt 46 | */ 47 | 48 | var RFC5323 = ['SEARCH']; 49 | 50 | /** 51 | * PATCH Method for HTTP 52 | * http://www.ietf.org/rfc/rfc5789.txt 53 | */ 54 | 55 | var RFC5789 = ['PATCH']; 56 | 57 | /** 58 | * Expose the methods. 59 | */ 60 | 61 | module.exports = [].concat( 62 | RFC2616 63 | , RFC2518 64 | , RFC3253 65 | , RFC3648 66 | , RFC3744 67 | , RFC5323 68 | , RFC5789).map(function(method){ 69 | return method.toLowerCase(); 70 | }); 71 | -------------------------------------------------------------------------------- /node_modules/express/lib/router/route.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - router - Route 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Expose `Route`. 10 | */ 11 | 12 | module.exports = Route; 13 | 14 | /** 15 | * Initialize `Route` with the given HTTP `method`, `path`, 16 | * and an array of `callbacks` and `options`. 17 | * 18 | * Options: 19 | * 20 | * - `sensitive` enable case-sensitive routes 21 | * - `strict` enable strict matching for trailing slashes 22 | * 23 | * @param {String} method 24 | * @param {String} path 25 | * @param {Array} callbacks 26 | * @param {Object} options. 27 | * @api private 28 | */ 29 | 30 | function Route(method, path, callbacks, options) { 31 | options = options || {}; 32 | this.path = path; 33 | this.method = method; 34 | this.callbacks = callbacks; 35 | this.regexp = normalize(path 36 | , this.keys = [] 37 | , options.sensitive 38 | , options.strict); 39 | } 40 | 41 | /** 42 | * Check if this route matches `path` and return captures made. 43 | * 44 | * @param {String} path 45 | * @return {Array} 46 | * @api private 47 | */ 48 | 49 | Route.prototype.match = function(path){ 50 | return this.regexp.exec(path); 51 | }; 52 | 53 | /** 54 | * Normalize the given path string, 55 | * returning a regular expression. 56 | * 57 | * An empty array should be passed, 58 | * which will contain the placeholder 59 | * key names. For example "/user/:id" will 60 | * then contain ["id"]. 61 | * 62 | * @param {String|RegExp} path 63 | * @param {Array} keys 64 | * @param {Boolean} sensitive 65 | * @param {Boolean} strict 66 | * @return {RegExp} 67 | * @api private 68 | */ 69 | 70 | function normalize(path, keys, sensitive, strict) { 71 | if (path instanceof RegExp) return path; 72 | path = path 73 | .concat(strict ? '' : '/?') 74 | .replace(/\/\(/g, '(?:/') 75 | .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional){ 76 | keys.push({ name: key, optional: !! optional }); 77 | slash = slash || ''; 78 | return '' 79 | + (optional ? '' : slash) 80 | + '(?:' 81 | + (optional ? slash : '') 82 | + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' 83 | + (optional || ''); 84 | }) 85 | .replace(/([\/.])/g, '\\$1') 86 | .replace(/\*/g, '(.*)'); 87 | return new RegExp('^' + path + '$', sensitive ? '' : 'i'); 88 | } 89 | -------------------------------------------------------------------------------- /node_modules/express/lib/utils.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - Utils 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Check if `path` looks absolute. 10 | * 11 | * @param {String} path 12 | * @return {Boolean} 13 | * @api private 14 | */ 15 | 16 | exports.isAbsolute = function(path){ 17 | if ('/' == path[0]) return true; 18 | if (':' == path[1] && '\\' == path[2]) return true; 19 | }; 20 | 21 | /** 22 | * Merge object `b` with `a` giving precedence to 23 | * values in object `a`. 24 | * 25 | * @param {Object} a 26 | * @param {Object} b 27 | * @return {Object} a 28 | * @api private 29 | */ 30 | 31 | exports.union = function(a, b){ 32 | if (a && b) { 33 | var keys = Object.keys(b) 34 | , len = keys.length 35 | , key; 36 | for (var i = 0; i < len; ++i) { 37 | key = keys[i]; 38 | if (!a.hasOwnProperty(key)) { 39 | a[key] = b[key]; 40 | } 41 | } 42 | } 43 | return a; 44 | }; 45 | 46 | /** 47 | * Flatten the given `arr`. 48 | * 49 | * @param {Array} arr 50 | * @return {Array} 51 | * @api private 52 | */ 53 | 54 | exports.flatten = function(arr, ret){ 55 | var ret = ret || [] 56 | , len = arr.length; 57 | for (var i = 0; i < len; ++i) { 58 | if (Array.isArray(arr[i])) { 59 | exports.flatten(arr[i], ret); 60 | } else { 61 | ret.push(arr[i]); 62 | } 63 | } 64 | return ret; 65 | }; 66 | 67 | /** 68 | * Parse mini markdown implementation. 69 | * The following conversions are supported, 70 | * primarily for the "flash" middleware: 71 | * 72 | * _foo_ or *foo* become foo 73 | * __foo__ or **foo** become foo 74 | * [A](B) becomes A 75 | * 76 | * @param {String} str 77 | * @return {String} 78 | * @api private 79 | */ 80 | 81 | exports.miniMarkdown = function(str){ 82 | return String(str) 83 | .replace(/(__|\*\*)(.*?)\1/g, '$2') 84 | .replace(/(_|\*)(.*?)\1/g, '$2') 85 | .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1'); 86 | }; 87 | 88 | /** 89 | * Escape special characters in the given string of html. 90 | * 91 | * @param {String} html 92 | * @return {String} 93 | * @api private 94 | */ 95 | 96 | exports.escape = function(html) { 97 | return String(html) 98 | .replace(/&/g, '&') 99 | .replace(/"/g, '"') 100 | .replace(//g, '>'); 102 | }; 103 | 104 | /** 105 | * Parse "Range" header `str` relative to the given file `size`. 106 | * 107 | * @param {Number} size 108 | * @param {String} str 109 | * @return {Array} 110 | * @api private 111 | */ 112 | 113 | exports.parseRange = function(size, str){ 114 | var valid = true; 115 | var arr = str.substr(6).split(',').map(function(range){ 116 | var range = range.split('-') 117 | , start = parseInt(range[0], 10) 118 | , end = parseInt(range[1], 10); 119 | 120 | // -500 121 | if (isNaN(start)) { 122 | start = size - end; 123 | end = size - 1; 124 | // 500- 125 | } else if (isNaN(end)) { 126 | end = size - 1; 127 | } 128 | 129 | // Invalid 130 | if (isNaN(start) || isNaN(end) || start > end) valid = false; 131 | 132 | return { start: start, end: end }; 133 | }); 134 | return valid ? arr : undefined; 135 | }; 136 | 137 | /** 138 | * Fast alternative to `Array.prototype.slice.call()`. 139 | * 140 | * @param {Arguments} args 141 | * @param {Number} n 142 | * @return {Array} 143 | * @api public 144 | */ 145 | 146 | exports.toArray = function(args, i){ 147 | var arr = [] 148 | , len = args.length 149 | , i = i || 0; 150 | for (; i < len; ++i) arr.push(args[i]); 151 | return arr; 152 | }; 153 | -------------------------------------------------------------------------------- /node_modules/express/lib/view/partial.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Express - view - Partial 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Memory cache. 10 | */ 11 | 12 | var cache = {}; 13 | 14 | /** 15 | * Resolve partial object name from the view path. 16 | * 17 | * Examples: 18 | * 19 | * "user.ejs" becomes "user" 20 | * "forum thread.ejs" becomes "forumThread" 21 | * "forum/thread/post.ejs" becomes "post" 22 | * "blog-post.ejs" becomes "blogPost" 23 | * 24 | * @return {String} 25 | * @api private 26 | */ 27 | 28 | exports.resolveObjectName = function(view){ 29 | return cache[view] || (cache[view] = view 30 | .split('/') 31 | .slice(-1)[0] 32 | .split('.')[0] 33 | .replace(/^_/, '') 34 | .replace(/[^a-zA-Z0-9 ]+/g, ' ') 35 | .split(/ +/).map(function(word, i){ 36 | return i 37 | ? word[0].toUpperCase() + word.substr(1) 38 | : word; 39 | }).join('')); 40 | }; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/.npmignore: -------------------------------------------------------------------------------- 1 | *.markdown 2 | *.md 3 | .git* 4 | Makefile 5 | benchmarks/ 6 | docs/ 7 | examples/ 8 | install.sh 9 | support/ 10 | test/ 11 | .DS_Store 12 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2010 Sencha Inc. 4 | Copyright (c) 2011 LearnBoost 5 | Copyright (c) 2011 TJ Holowaychuk 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = require('./lib/connect'); -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/cache.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - Cache 4 | * Copyright(c) 2011 Sencha Inc. 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Expose `Cache`. 10 | */ 11 | 12 | module.exports = Cache; 13 | 14 | /** 15 | * LRU cache store. 16 | * 17 | * @param {Number} limit 18 | * @api private 19 | */ 20 | 21 | function Cache(limit) { 22 | this.store = {}; 23 | this.keys = []; 24 | this.limit = limit; 25 | } 26 | 27 | /** 28 | * Touch `key`, promoting the object. 29 | * 30 | * @param {String} key 31 | * @param {Number} i 32 | * @api private 33 | */ 34 | 35 | Cache.prototype.touch = function(key, i){ 36 | this.keys.splice(i,1); 37 | this.keys.push(key); 38 | }; 39 | 40 | /** 41 | * Remove `key`. 42 | * 43 | * @param {String} key 44 | * @api private 45 | */ 46 | 47 | Cache.prototype.remove = function(key){ 48 | delete this.store[key]; 49 | }; 50 | 51 | /** 52 | * Get the object stored for `key`. 53 | * 54 | * @param {String} key 55 | * @return {Array} 56 | * @api private 57 | */ 58 | 59 | Cache.prototype.get = function(key){ 60 | return this.store[key]; 61 | }; 62 | 63 | /** 64 | * Add a cache `key`. 65 | * 66 | * @param {String} key 67 | * @return {Array} 68 | * @api private 69 | */ 70 | 71 | Cache.prototype.add = function(key){ 72 | // initialize store 73 | var len = this.keys.push(key); 74 | 75 | // limit reached, invalid LRU 76 | if (len > this.limit) this.remove(this.keys.shift()); 77 | 78 | var arr = this.store[key] = []; 79 | arr.createdAt = new Date; 80 | return arr; 81 | }; 82 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/connect.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var HTTPServer = require('./http').Server 14 | , HTTPSServer = require('./https').Server 15 | , fs = require('fs'); 16 | 17 | // node patches 18 | 19 | require('./patch'); 20 | 21 | // expose createServer() as the module 22 | 23 | exports = module.exports = createServer; 24 | 25 | /** 26 | * Framework version. 27 | */ 28 | 29 | exports.version = '1.7.2'; 30 | 31 | /** 32 | * Initialize a new `connect.HTTPServer` with the middleware 33 | * passed to this function. When an object is passed _first_, 34 | * we assume these are the tls options, and return a `connect.HTTPSServer`. 35 | * 36 | * Examples: 37 | * 38 | * An example HTTP server, accepting several middleware. 39 | * 40 | * var server = connect.createServer( 41 | * connect.logger() 42 | * , connect.static(__dirname + '/public') 43 | * ); 44 | * 45 | * An HTTPS server, utilizing the same middleware as above. 46 | * 47 | * var server = connect.createServer( 48 | * { key: key, cert: cert } 49 | * , connect.logger() 50 | * , connect.static(__dirname + '/public') 51 | * ); 52 | * 53 | * Alternatively with connect 1.0 we may omit `createServer()`. 54 | * 55 | * connect( 56 | * connect.logger() 57 | * , connect.static(__dirname + '/public') 58 | * ).listen(3000); 59 | * 60 | * @param {Object|Function} ... 61 | * @return {Server} 62 | * @api public 63 | */ 64 | 65 | function createServer() { 66 | if ('object' == typeof arguments[0]) { 67 | return new HTTPSServer(arguments[0], Array.prototype.slice.call(arguments, 1)); 68 | } else { 69 | return new HTTPServer(Array.prototype.slice.call(arguments)); 70 | } 71 | }; 72 | 73 | // support connect.createServer() 74 | 75 | exports.createServer = createServer; 76 | 77 | // auto-load getters 78 | 79 | exports.middleware = {}; 80 | 81 | /** 82 | * Auto-load bundled middleware with getters. 83 | */ 84 | 85 | fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ 86 | if (/\.js$/.test(filename)) { 87 | var name = filename.substr(0, filename.lastIndexOf('.')); 88 | exports.middleware.__defineGetter__(name, function(){ 89 | return require('./middleware/' + name); 90 | }); 91 | } 92 | }); 93 | 94 | // expose utils 95 | 96 | exports.utils = require('./utils'); 97 | 98 | // expose getters as first-class exports 99 | 100 | exports.utils.merge(exports, exports.middleware); 101 | 102 | // expose constructors 103 | 104 | exports.HTTPServer = HTTPServer; 105 | exports.HTTPSServer = HTTPSServer; 106 | 107 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/https.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - HTTPServer 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var HTTPServer = require('./http').Server 14 | , https = require('https'); 15 | 16 | /** 17 | * Initialize a new `Server` with the given 18 | *`options` and `middleware`. The HTTPS api 19 | * is identical to the [HTTP](http.html) server, 20 | * however TLS `options` must be provided before 21 | * passing in the optional middleware. 22 | * 23 | * @params {Object} options 24 | * @params {Array} middleawre 25 | * @return {Server} 26 | * @api public 27 | */ 28 | 29 | var Server = exports.Server = function HTTPSServer(options, middleware) { 30 | this.stack = []; 31 | middleware.forEach(function(fn){ 32 | this.use(fn); 33 | }, this); 34 | https.Server.call(this, options, this.handle); 35 | }; 36 | 37 | /** 38 | * Inherit from `http.Server.prototype`. 39 | */ 40 | 41 | Server.prototype.__proto__ = https.Server.prototype; 42 | 43 | // mixin HTTPServer methods 44 | 45 | Object.keys(HTTPServer.prototype).forEach(function(method){ 46 | Server.prototype[method] = HTTPServer.prototype[method]; 47 | }); -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * # Connect 4 | * 5 | * Connect is a middleware framework for node, 6 | * shipping with over 11 bundled middleware and a rich choice of 7 | * [3rd-party middleware](https://github.com/senchalabs/connect/wiki). 8 | * 9 | * Installation: 10 | * 11 | * $ npm install connect 12 | * 13 | * API: 14 | * 15 | * - [connect](connect.html) general 16 | * - [http](http.html) http server 17 | * - [https](https.html) https server 18 | * 19 | * Middleware: 20 | * 21 | * - [logger](middleware-logger.html) request logger with custom format support 22 | * - [csrf](middleware-csrf.html) Cross-site request forgery protection 23 | * - [basicAuth](middleware-basicAuth.html) basic http authentication 24 | * - [bodyParser](middleware-bodyParser.html) extensible request body parser 25 | * - [cookieParser](middleware-cookieParser.html) cookie parser 26 | * - [session](middleware-session.html) session management support with bundled [MemoryStore](middleware-session-memory.html) 27 | * - [compiler](middleware-compiler.html) static asset compiler (sass, less, coffee-script, etc) 28 | * - [methodOverride](middleware-methodOverride.html) faux HTTP method support 29 | * - [responseTime](middleware-responseTime.html) calculates response-time and exposes via X-Response-Time 30 | * - [router](middleware-router.html) provides rich Sinatra / Express-like routing 31 | * - [staticCache](middleware-staticCache.html) memory cache layer for the static() middleware 32 | * - [static](middleware-static.html) streaming static file server supporting `Range` and more 33 | * - [directory](middleware-directory.html) directory listing middleware 34 | * - [vhost](middleware-vhost.html) virtual host sub-domain mapping middleware 35 | * - [favicon](middleware-favicon.html) efficient favicon server (with default icon) 36 | * - [limit](middleware-limit.html) limit the bytesize of request bodies 37 | * - [profiler](middleware-profiler.html) request profiler reporting response-time, memory usage, etc 38 | * - [query](middleware-query.html) automatic querystring parser, populating `req.query` 39 | * - [errorHandler](middleware-errorHandler.html) flexible error handler 40 | * 41 | * Internals: 42 | * 43 | * - connect [utilities](utils.html) 44 | * - node monkey [patches](patch.html) 45 | * 46 | */ -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/basicAuth.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - basicAuth 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var utils = require('../utils') 14 | , unauthorized = utils.unauthorized 15 | , badRequest = utils.badRequest; 16 | 17 | /** 18 | * Enfore basic authentication by providing a `callback(user, pass)`, 19 | * which must return `true` in order to gain access. Alternatively an async 20 | * method is provided as well, invoking `callback(user, pass, callback)`. Populates 21 | * `req.remoteUser`. The final alternative is simply passing username / password 22 | * strings. 23 | * 24 | * Examples: 25 | * 26 | * connect(connect.basicAuth('username', 'password')); 27 | * 28 | * connect( 29 | * connect.basicAuth(function(user, pass){ 30 | * return 'tj' == user & 'wahoo' == pass; 31 | * }) 32 | * ); 33 | * 34 | * connect( 35 | * connect.basicAuth(function(user, pass, fn){ 36 | * User.authenticate({ user: user, pass: pass }, fn); 37 | * }) 38 | * ); 39 | * 40 | * @param {Function|String} callback or username 41 | * @param {String} realm 42 | * @api public 43 | */ 44 | 45 | module.exports = function basicAuth(callback, realm) { 46 | var username, password; 47 | 48 | // user / pass strings 49 | if ('string' == typeof callback) { 50 | username = callback; 51 | password = realm; 52 | if ('string' != typeof password) throw new Error('password argument required'); 53 | realm = arguments[2]; 54 | callback = function(user, pass){ 55 | return user == username && pass == password; 56 | } 57 | } 58 | 59 | realm = realm || 'Authorization Required'; 60 | 61 | return function(req, res, next) { 62 | var authorization = req.headers.authorization; 63 | 64 | if (req.remoteUser) return next(); 65 | if (!authorization) return unauthorized(res, realm); 66 | 67 | var parts = authorization.split(' ') 68 | , scheme = parts[0] 69 | , credentials = new Buffer(parts[1], 'base64').toString().split(':'); 70 | 71 | if ('Basic' != scheme) return badRequest(res); 72 | 73 | // async 74 | if (callback.length >= 3) { 75 | var pause = utils.pause(req); 76 | callback(credentials[0], credentials[1], function(err, user){ 77 | if (err || !user) return unauthorized(res, realm); 78 | req.remoteUser = user; 79 | next(); 80 | pause.resume(); 81 | }); 82 | // sync 83 | } else { 84 | if (callback(credentials[0], credentials[1])) { 85 | req.remoteUser = credentials[0]; 86 | next(); 87 | } else { 88 | unauthorized(res, realm); 89 | } 90 | } 91 | } 92 | }; 93 | 94 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/bodyParser.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - bodyParser 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var qs = require('qs'); 14 | 15 | /** 16 | * Extract the mime type from the given request's 17 | * _Content-Type_ header. 18 | * 19 | * @param {IncomingMessage} req 20 | * @return {String} 21 | * @api private 22 | */ 23 | 24 | function mime(req) { 25 | var str = req.headers['content-type'] || ''; 26 | return str.split(';')[0]; 27 | } 28 | 29 | /** 30 | * Parse request bodies. 31 | * 32 | * By default _application/json_ and _application/x-www-form-urlencoded_ 33 | * are supported, however you may map `connect.bodyParser.parse[contentType]` 34 | * to a function of your choice to replace existing parsers, or implement 35 | * one for other content-types. 36 | * 37 | * Examples: 38 | * 39 | * connect.createServer( 40 | * connect.bodyParser() 41 | * , function(req, res) { 42 | * res.end('viewing user ' + req.body.user.name); 43 | * } 44 | * ); 45 | * 46 | * Since both _json_ and _x-www-form-urlencoded_ are supported by 47 | * default, either of the following requests would result in the response 48 | * of "viewing user tj". 49 | * 50 | * $ curl -d 'user[name]=tj' http://localhost/ 51 | * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://localhost/ 52 | * 53 | * @return {Function} 54 | * @api public 55 | */ 56 | 57 | exports = module.exports = function bodyParser(){ 58 | return function bodyParser(req, res, next) { 59 | if ('GET' == req.method || 'HEAD' == req.method) return next(); 60 | var parser = exports.parse[mime(req)]; 61 | if (parser && !req.body) { 62 | var data = ''; 63 | req.setEncoding('utf8'); 64 | req.on('data', function(chunk) { data += chunk; }); 65 | req.on('end', function(){ 66 | req.rawBody = data; 67 | try { 68 | req.body = data 69 | ? parser(data) 70 | : {}; 71 | } catch (err) { 72 | return next(err); 73 | } 74 | next(); 75 | }); 76 | } else { 77 | next(); 78 | } 79 | } 80 | }; 81 | 82 | /** 83 | * Supported decoders. 84 | * 85 | * - application/x-www-form-urlencoded 86 | * - application/json 87 | */ 88 | 89 | exports.parse = { 90 | 'application/x-www-form-urlencoded': qs.parse 91 | , 'application/json': JSON.parse 92 | }; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/cookieParser.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - cookieParser 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var utils = require('./../utils'); 14 | 15 | /** 16 | * Parse _Cookie_ header and populate `req.cookies` 17 | * with an object keyed by the cookie names. 18 | * 19 | * Examples: 20 | * 21 | * connect.createServer( 22 | * connect.cookieParser() 23 | * , function(req, res, next){ 24 | * res.end(JSON.stringify(req.cookies)); 25 | * } 26 | * ); 27 | * 28 | * @return {Function} 29 | * @api public 30 | */ 31 | 32 | module.exports = function cookieParser(){ 33 | return function cookieParser(req, res, next) { 34 | var cookie = req.headers.cookie; 35 | if (req.cookies) return next(); 36 | req.cookies = {}; 37 | if (cookie) { 38 | try { 39 | req.cookies = utils.parseCookie(cookie); 40 | } catch (err) { 41 | return next(err); 42 | } 43 | } 44 | next(); 45 | }; 46 | }; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/csrf.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - csrf 4 | * Copyright(c) 2011 Sencha Inc. 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var utils = require('../utils') 13 | , crypto = require('crypto'); 14 | 15 | /** 16 | * CRSF protection middleware. 17 | * 18 | * By default this middleware generates a token named "_csrf" 19 | * which should be added to requests which mutate 20 | * state, within a hidden form field, query-string etc. This 21 | * token is validated against the visitor's `req.session._csrf` 22 | * property which is re-generated per request. 23 | * 24 | * The default `value` function checks `req.body` generated 25 | * by the `bodyParser()` middleware, `req.query` generated 26 | * by `query()`, and the "X-CSRF-Token" header field. 27 | * 28 | * This middleware requires session support, thus should be added 29 | * somewhere _below_ `session()` and `cookieParser()`. 30 | * 31 | * Examples: 32 | * 33 | * var form = '\n\ 34 | *
\n\ 35 | * \n\ 36 | * \n\ 37 | * \n\ 38 | * \n\ 39 | *
\n\ 40 | * '; 41 | * 42 | * connect( 43 | * connect.cookieParser() 44 | * , connect.session({ secret: 'keyboard cat' }) 45 | * , connect.bodyParser() 46 | * , connect.csrf() 47 | * 48 | * , function(req, res, next){ 49 | * if ('POST' != req.method) return next(); 50 | * req.session.user = req.body.user; 51 | * next(); 52 | * } 53 | * 54 | * , function(req, res){ 55 | * res.setHeader('Content-Type', 'text/html'); 56 | * var body = form 57 | * .replace('{token}', req.session._csrf) 58 | * .replace('{user}', req.session.user && req.session.user.name || ''); 59 | * res.end(body); 60 | * } 61 | * ).listen(3000); 62 | * 63 | * Options: 64 | * 65 | * - `value` a function accepting the request, returning the token 66 | * 67 | * @param {Object} options 68 | * @api public 69 | */ 70 | 71 | module.exports = function csrf(options) { 72 | var options = options || {} 73 | , value = options.value || defaultValue; 74 | 75 | return function(req, res, next){ 76 | // generate CSRF token 77 | var token = req.session._csrf || (req.session._csrf = utils.uid(24)); 78 | 79 | // ignore GET (for now) 80 | if ('GET' == req.method) return next(); 81 | 82 | // determine value 83 | var val = value(req); 84 | 85 | // check 86 | if (val != token) return utils.forbidden(res); 87 | 88 | next(); 89 | } 90 | }; 91 | 92 | /** 93 | * Default value function, checking the `req.body` 94 | * and `req.query` for the CSRF token. 95 | * 96 | * @param {IncomingMessage} req 97 | * @return {String} 98 | * @api private 99 | */ 100 | 101 | function defaultValue(req) { 102 | return (req.body && req.body._csrf) 103 | || (req.query && req.query._csrf) 104 | || (req.headers['x-csrf-token']); 105 | } -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/errorHandler.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Connect - errorHandler 3 | * Copyright(c) 2010 Sencha Inc. 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var utils = require('../utils') 13 | , url = require('url') 14 | , fs = require('fs'); 15 | 16 | /** 17 | * Flexible error handler, providing (_optional_) stack traces 18 | * and error message responses for requests accepting text, html, 19 | * or json. 20 | * 21 | * Options: 22 | * 23 | * - `showStack`, `stack` respond with both the error message and stack trace. Defaults to `false` 24 | * - `showMessage`, `message`, respond with the exception message only. Defaults to `false` 25 | * - `dumpExceptions`, `dump`, dump exceptions to stderr (without terminating the process). Defaults to `false` 26 | * 27 | * Text: 28 | * 29 | * By default, and when _text/plain_ is accepted a simple stack trace 30 | * or error message will be returned. 31 | * 32 | * JSON: 33 | * 34 | * When _application/json_ is accepted, connect will respond with 35 | * an object in the form of `{ "error": error }`. 36 | * 37 | * HTML: 38 | * 39 | * When accepted connect will output a nice html stack trace. 40 | * 41 | * @param {Object} options 42 | * @return {Function} 43 | * @api public 44 | */ 45 | 46 | exports = module.exports = function errorHandler(options){ 47 | options = options || {}; 48 | 49 | // defaults 50 | var showStack = options.showStack || options.stack 51 | , showMessage = options.showMessage || options.message 52 | , dumpExceptions = options.dumpExceptions || options.dump 53 | , formatUrl = options.formatUrl; 54 | 55 | return function errorHandler(err, req, res, next){ 56 | res.statusCode = 500; 57 | if (dumpExceptions) console.error(err.stack); 58 | if (showStack) { 59 | var accept = req.headers.accept || ''; 60 | // html 61 | if (~accept.indexOf('html')) { 62 | fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ 63 | fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ 64 | var stack = (err.stack || '') 65 | .split('\n').slice(1) 66 | .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); 67 | html = html 68 | .replace('{style}', style) 69 | .replace('{stack}', stack) 70 | .replace('{title}', exports.title) 71 | .replace(/\{error\}/g, utils.escape(err.toString())); 72 | res.setHeader('Content-Type', 'text/html'); 73 | res.end(html); 74 | }); 75 | }); 76 | // json 77 | } else if (~accept.indexOf('json')) { 78 | var json = JSON.stringify({ error: err }); 79 | res.setHeader('Content-Type', 'application/json'); 80 | res.end(json); 81 | // plain text 82 | } else { 83 | res.writeHead(500, { 'Content-Type': 'text/plain' }); 84 | res.end(err.stack); 85 | } 86 | } else { 87 | var body = showMessage 88 | ? err.toString() 89 | : 'Internal Server Error'; 90 | res.setHeader('Content-Type', 'text/plain'); 91 | res.end(body); 92 | } 93 | }; 94 | }; 95 | 96 | /** 97 | * Template title. 98 | */ 99 | 100 | exports.title = 'Connect'; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/favicon.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - favicon 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var fs = require('fs') 14 | , utils = require('../utils'); 15 | 16 | /** 17 | * Favicon cache. 18 | */ 19 | 20 | var icon; 21 | 22 | /** 23 | * By default serves the connect favicon, or the favicon 24 | * located by the given `path`. 25 | * 26 | * Options: 27 | * 28 | * - `maxAge` cache-control max-age directive, defaulting to 1 day 29 | * 30 | * Examples: 31 | * 32 | * connect.createServer( 33 | * connect.favicon() 34 | * ); 35 | * 36 | * connect.createServer( 37 | * connect.favicon(__dirname + '/public/favicon.ico') 38 | * ); 39 | * 40 | * @param {String} path 41 | * @param {Object} options 42 | * @return {Function} 43 | * @api public 44 | */ 45 | 46 | module.exports = function favicon(path, options){ 47 | var options = options || {} 48 | , path = path || __dirname + '/../public/favicon.ico' 49 | , maxAge = options.maxAge || 86400000; 50 | 51 | return function favicon(req, res, next){ 52 | if ('/favicon.ico' == req.url) { 53 | if (icon) { 54 | res.writeHead(200, icon.headers); 55 | res.end(icon.body); 56 | } else { 57 | fs.readFile(path, function(err, buf){ 58 | if (err) return next(err); 59 | icon = { 60 | headers: { 61 | 'Content-Type': 'image/x-icon' 62 | , 'Content-Length': buf.length 63 | , 'ETag': '"' + utils.md5(buf) + '"' 64 | , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) 65 | }, 66 | body: buf 67 | }; 68 | res.writeHead(200, icon.headers); 69 | res.end(icon.body); 70 | }); 71 | } 72 | } else { 73 | next(); 74 | } 75 | }; 76 | }; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/limit.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - limit 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Limit request bodies to the given size in `bytes`. 10 | * 11 | * A string representation of the bytesize may also be passed, 12 | * for example "5mb", "200kb", "1gb", etc. 13 | * 14 | * Examples: 15 | * 16 | * var server = connect( 17 | * connect.limit('5.5mb') 18 | * ).listen(3000); 19 | * 20 | * TODO: pause EV_READ 21 | * 22 | * @param {Number|String} bytes 23 | * @return {Function} 24 | * @api public 25 | */ 26 | 27 | module.exports = function limit(bytes){ 28 | if ('string' == typeof bytes) bytes = parse(bytes); 29 | if ('number' != typeof bytes) throw new Error('limit() bytes required'); 30 | return function limit(req, res, next){ 31 | var received = 0 32 | , len = req.headers['content-length'] 33 | ? parseInt(req.headers['content-length'], 10) 34 | : null; 35 | 36 | // deny the request 37 | function deny() { 38 | req.destroy(); 39 | } 40 | 41 | // self-awareness 42 | if (req._limit) return next(); 43 | req._limit = true; 44 | 45 | // limit by content-length 46 | if (len && len > bytes) { 47 | res.statusCode = 413; 48 | res.end('Request Entity Too Large'); 49 | return; 50 | } 51 | 52 | // limit 53 | req.on('data', function(chunk){ 54 | received += chunk.length; 55 | if (received > bytes) deny(); 56 | }); 57 | 58 | next(); 59 | }; 60 | }; 61 | 62 | /** 63 | * Parse byte `size` string. 64 | * 65 | * @param {String} size 66 | * @return {Number} 67 | * @api private 68 | */ 69 | 70 | function parse(size) { 71 | var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) 72 | , n = parseFloat(parts[1]) 73 | , type = parts[2]; 74 | 75 | var map = { 76 | kb: 1024 77 | , mb: 1024 * 1024 78 | , gb: 1024 * 1024 * 1024 79 | }; 80 | 81 | return map[type] * n; 82 | } -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/methodOverride.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - methodOverride 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Provides faux HTTP method support. 11 | * 12 | * Pass an optional `key` to use when checking for 13 | * a method override, othewise defaults to _\_method_. 14 | * The original method is available via `req.originalMethod`. 15 | * 16 | * @param {String} key 17 | * @return {Function} 18 | * @api public 19 | */ 20 | 21 | module.exports = function methodOverride(key){ 22 | key = key || "_method"; 23 | return function methodOverride(req, res, next) { 24 | req.originalMethod = req.originalMethod || req.method; 25 | 26 | // req.body 27 | if (req.body && key in req.body) { 28 | req.method = req.body[key].toUpperCase(); 29 | delete req.body[key]; 30 | // check X-HTTP-Method-Override 31 | } else if (req.headers['x-http-method-override']) { 32 | req.method = req.headers['x-http-method-override'].toUpperCase(); 33 | } 34 | 35 | next(); 36 | }; 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/profiler.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - profiler 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Profile the duration of a request. 10 | * 11 | * Typically this middleware should be utilized 12 | * _above_ all others, as it proxies the `res.end()` 13 | * method, being first allows it to encapsulate all 14 | * other middleware. 15 | * 16 | * Example Output: 17 | * 18 | * GET / 19 | * response time 2ms 20 | * memory rss 52.00kb 21 | * memory vsize 2.07mb 22 | * heap before 3.76mb / 8.15mb 23 | * heap after 3.80mb / 8.15mb 24 | * 25 | * @api public 26 | */ 27 | 28 | module.exports = function profiler(){ 29 | return function(req, res, next){ 30 | var end = res.end 31 | , start = snapshot(); 32 | 33 | // state snapshot 34 | function snapshot() { 35 | return { 36 | mem: process.memoryUsage() 37 | , time: new Date 38 | }; 39 | } 40 | 41 | // proxy res.end() 42 | res.end = function(data, encoding){ 43 | res.end = end; 44 | res.end(data, encoding); 45 | compare(req, start, snapshot()) 46 | }; 47 | 48 | next(); 49 | } 50 | }; 51 | 52 | /** 53 | * Compare `start` / `end` snapshots. 54 | * 55 | * @param {IncomingRequest} req 56 | * @param {Object} start 57 | * @param {Object} end 58 | * @api private 59 | */ 60 | 61 | function compare(req, start, end) { 62 | console.log(); 63 | row(req.method, req.url); 64 | row('response time:', (end.time - start.time) + 'ms'); 65 | row('memory rss:', formatBytes(end.mem.rss - start.mem.rss)); 66 | row('memory vsize:', formatBytes(end.mem.vsize - start.mem.vsize)); 67 | row('heap before:', formatBytes(start.mem.heapUsed) + ' / ' + formatBytes(start.mem.heapTotal)); 68 | row('heap after:', formatBytes(end.mem.heapUsed) + ' / ' + formatBytes(end.mem.heapTotal)); 69 | console.log(); 70 | } 71 | 72 | /** 73 | * Row helper 74 | * 75 | * @param {String} key 76 | * @param {String} val 77 | * @api private 78 | */ 79 | 80 | function row(key, val) { 81 | console.log(' \033[90m%s\033[0m \033[36m%s\033[0m', key, val); 82 | } 83 | 84 | /** 85 | * Format byte-size. 86 | * 87 | * @param {Number} bytes 88 | * @return {String} 89 | * @api private 90 | */ 91 | 92 | function formatBytes(bytes) { 93 | var kb = 1024 94 | , mb = 1024 * kb 95 | , gb = 1024 * mb; 96 | if (bytes < kb) return bytes + 'b'; 97 | if (bytes < mb) return (bytes / kb).toFixed(2) + 'kb'; 98 | if (bytes < gb) return (bytes / mb).toFixed(2) + 'mb'; 99 | return (bytes / gb).toFixed(2) + 'gb'; 100 | }; 101 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/query.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - query 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * Copyright(c) 2011 Sencha Inc. 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var qs = require('qs') 14 | , parse = require('url').parse; 15 | 16 | /** 17 | * Automatically parse the query-string when available, 18 | * populating the `req.query` object. 19 | * 20 | * Examples: 21 | * 22 | * connect( 23 | * connect.query() 24 | * , function(req, res){ 25 | * res.end(JSON.stringify(req.query)); 26 | * } 27 | * ).listen(3000); 28 | * 29 | * @return {Function} 30 | * @api public 31 | */ 32 | 33 | module.exports = function query(){ 34 | return function query(req, res, next){ 35 | req.query = ~req.url.indexOf('?') 36 | ? qs.parse(parse(req.url).query) 37 | : {}; 38 | next(); 39 | }; 40 | }; 41 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/responseTime.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - responseTime 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Adds the `X-Response-Time` header displaying the response 10 | * duration in milliseconds. 11 | * 12 | * @return {Function} 13 | * @api public 14 | */ 15 | 16 | module.exports = function responseTime(){ 17 | return function(req, res, next){ 18 | var writeHead = res.writeHead 19 | , start = new Date; 20 | 21 | if (res._responseTime) return next(); 22 | res._responseTime = true; 23 | 24 | // proxy writeHead to calculate duration 25 | res.writeHead = function(status, headers){ 26 | var duration = new Date - start; 27 | res.setHeader('X-Response-Time', duration + 'ms'); 28 | res.writeHead = writeHead; 29 | res.writeHead(status, headers); 30 | }; 31 | 32 | next(); 33 | }; 34 | }; 35 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/session/cookie.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - session - Cookie 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var utils = require('../../utils'); 14 | 15 | /** 16 | * Initialize a new `Cookie` with the given `options`. 17 | * 18 | * @param {Object} options 19 | * @api private 20 | */ 21 | 22 | var Cookie = module.exports = function Cookie(options) { 23 | this.path = '/'; 24 | this.httpOnly = true; 25 | this.maxAge = 14400000; 26 | if (options) utils.merge(this, options); 27 | this.originalMaxAge = undefined == this.originalMaxAge 28 | ? this.maxAge 29 | : this.originalMaxAge; 30 | }; 31 | 32 | /** 33 | * Prototype. 34 | */ 35 | 36 | Cookie.prototype = { 37 | 38 | /** 39 | * Set expires `date`. 40 | * 41 | * @param {Date} date 42 | * @api public 43 | */ 44 | 45 | set expires(date) { 46 | this._expires = date; 47 | this.originalMaxAge = this.maxAge; 48 | }, 49 | 50 | /** 51 | * Get expires `date`. 52 | * 53 | * @return {Date} 54 | * @api public 55 | */ 56 | 57 | get expires() { 58 | return this._expires; 59 | }, 60 | 61 | /** 62 | * Set expires via max-age in `ms`. 63 | * 64 | * @param {Number} ms 65 | * @api public 66 | */ 67 | 68 | set maxAge(ms) { 69 | this.expires = 'number' == typeof ms 70 | ? new Date(Date.now() + ms) 71 | : ms; 72 | }, 73 | 74 | /** 75 | * Get expires max-age in `ms`. 76 | * 77 | * @return {Number} 78 | * @api public 79 | */ 80 | 81 | get maxAge() { 82 | return this.expires instanceof Date 83 | ? this.expires.valueOf() - Date.now() 84 | : this.expires; 85 | }, 86 | 87 | /** 88 | * Return cookie data object. 89 | * 90 | * @return {Object} 91 | * @api private 92 | */ 93 | 94 | get data() { 95 | return { 96 | originalMaxAge: this.originalMaxAge 97 | , expires: this._expires 98 | , secure: this.secure 99 | , httpOnly: this.httpOnly 100 | , domain: this.domain 101 | , path: this.path 102 | } 103 | }, 104 | 105 | /** 106 | * Return a serialized cookie string. 107 | * 108 | * @return {String} 109 | * @api public 110 | */ 111 | 112 | serialize: function(name, val){ 113 | return utils.serializeCookie(name, val, this.data); 114 | }, 115 | 116 | /** 117 | * Return JSON representation of this cookie. 118 | * 119 | * @return {Object} 120 | * @api private 121 | */ 122 | 123 | toJSON: function(){ 124 | return this.data; 125 | } 126 | }; 127 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/session/memory.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - session - MemoryStore 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var Store = require('./store') 14 | , utils = require('../../utils') 15 | , Session = require('./session'); 16 | 17 | /** 18 | * Initialize a new `MemoryStore`. 19 | * 20 | * @api public 21 | */ 22 | 23 | var MemoryStore = module.exports = function MemoryStore() { 24 | this.sessions = {}; 25 | }; 26 | 27 | /** 28 | * Inherit from `Store.prototype`. 29 | */ 30 | 31 | MemoryStore.prototype.__proto__ = Store.prototype; 32 | 33 | /** 34 | * Attempt to fetch session by the given `sid`. 35 | * 36 | * @param {String} sid 37 | * @param {Function} fn 38 | * @api public 39 | */ 40 | 41 | MemoryStore.prototype.get = function(sid, fn){ 42 | var self = this; 43 | process.nextTick(function(){ 44 | var expires 45 | , sess = self.sessions[sid]; 46 | if (sess) { 47 | sess = JSON.parse(sess); 48 | expires = 'string' == typeof sess.cookie.expires 49 | ? new Date(sess.cookie.expires) 50 | : sess.cookie.expires; 51 | if (!expires || new Date < expires) { 52 | fn(null, sess); 53 | } else { 54 | self.destroy(sid, fn); 55 | } 56 | } else { 57 | fn(); 58 | } 59 | }); 60 | }; 61 | 62 | /** 63 | * Commit the given `sess` object associated with the given `sid`. 64 | * 65 | * @param {String} sid 66 | * @param {Session} sess 67 | * @param {Function} fn 68 | * @api public 69 | */ 70 | 71 | MemoryStore.prototype.set = function(sid, sess, fn){ 72 | var self = this; 73 | process.nextTick(function(){ 74 | self.sessions[sid] = JSON.stringify(sess); 75 | fn && fn(); 76 | }); 77 | }; 78 | 79 | /** 80 | * Destroy the session associated with the given `sid`. 81 | * 82 | * @param {String} sid 83 | * @api public 84 | */ 85 | 86 | MemoryStore.prototype.destroy = function(sid, fn){ 87 | var self = this; 88 | process.nextTick(function(){ 89 | delete self.sessions[sid]; 90 | fn && fn(); 91 | }); 92 | }; 93 | 94 | /** 95 | * Invoke the given callback `fn` with all active sessions. 96 | * 97 | * @param {Function} fn 98 | * @api public 99 | */ 100 | 101 | MemoryStore.prototype.all = function(fn){ 102 | var arr = [] 103 | , keys = Object.keys(this.sessions); 104 | for (var i = 0, len = keys.length; i < len; ++i) { 105 | arr.push(this.sessions[keys[i]]); 106 | } 107 | fn(null, arr); 108 | }; 109 | 110 | /** 111 | * Clear all sessions. 112 | * 113 | * @param {Function} fn 114 | * @api public 115 | */ 116 | 117 | MemoryStore.prototype.clear = function(fn){ 118 | this.sessions = {}; 119 | fn && fn(); 120 | }; 121 | 122 | /** 123 | * Fetch number of sessions. 124 | * 125 | * @param {Function} fn 126 | * @api public 127 | */ 128 | 129 | MemoryStore.prototype.length = function(fn){ 130 | fn(null, Object.keys(this.sessions).length); 131 | }; 132 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/session/session.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - session - Session 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var utils = require('../../utils') 14 | , Cookie = require('./cookie'); 15 | 16 | /** 17 | * Create a new `Session` with the given request and `data`. 18 | * 19 | * @param {IncomingRequest} req 20 | * @param {Object} data 21 | * @api private 22 | */ 23 | 24 | var Session = module.exports = function Session(req, data) { 25 | Object.defineProperty(this, 'req', { value: req }); 26 | Object.defineProperty(this, 'id', { value: req.sessionID }); 27 | if ('object' == typeof data) { 28 | utils.merge(this, data); 29 | } else { 30 | this.lastAccess = Date.now(); 31 | } 32 | }; 33 | 34 | /** 35 | * Update `.lastAccess` timestamp, 36 | * and reset `.cookie.maxAge` to prevent 37 | * the cookie from expiring when the 38 | * session is still active. 39 | * 40 | * @return {Session} for chaining 41 | * @api public 42 | */ 43 | 44 | Session.prototype.touch = function(){ 45 | return this 46 | .resetLastAccess() 47 | .resetMaxAge(); 48 | }; 49 | 50 | /** 51 | * Update `.lastAccess` timestamp. 52 | * 53 | * @return {Session} for chaining 54 | * @api public 55 | */ 56 | 57 | Session.prototype.resetLastAccess = function(){ 58 | this.lastAccess = Date.now(); 59 | return this; 60 | }; 61 | 62 | /** 63 | * Reset `.maxAge` to `.originalMaxAge`. 64 | * 65 | * @return {Session} for chaining 66 | * @api public 67 | */ 68 | 69 | Session.prototype.resetMaxAge = function(){ 70 | this.cookie.maxAge = this.cookie.originalMaxAge; 71 | return this; 72 | }; 73 | 74 | /** 75 | * Save the session data with optional callback `fn(err)`. 76 | * 77 | * @param {Function} fn 78 | * @return {Session} for chaining 79 | * @api public 80 | */ 81 | 82 | Session.prototype.save = function(fn){ 83 | this.req.sessionStore.set(this.id, this, fn || function(){}); 84 | return this; 85 | }; 86 | 87 | /** 88 | * Re-loads the session data _without_ altering 89 | * the maxAge or lastAccess properties. Invokes the 90 | * callback `fn(err)`, after which time if no exception 91 | * has occurred the `req.session` property will be 92 | * a new `Session` object, although representing the 93 | * same session. 94 | * 95 | * @param {Function} fn 96 | * @return {Session} for chaining 97 | * @api public 98 | */ 99 | 100 | Session.prototype.reload = function(fn){ 101 | var req = this.req 102 | , store = this.req.sessionStore; 103 | store.get(this.id, function(err, sess){ 104 | if (err) return fn(err); 105 | if (!sess) return fn(new Error('failed to load session')); 106 | store.createSession(req, sess); 107 | fn(); 108 | }); 109 | return this; 110 | }; 111 | 112 | /** 113 | * Destroy `this` session. 114 | * 115 | * @param {Function} fn 116 | * @return {Session} for chaining 117 | * @api public 118 | */ 119 | 120 | Session.prototype.destroy = function(fn){ 121 | delete this.req.session; 122 | this.req.sessionStore.destroy(this.id, fn); 123 | return this; 124 | }; 125 | 126 | /** 127 | * Regenerate this request's session. 128 | * 129 | * @param {Function} fn 130 | * @return {Session} for chaining 131 | * @api public 132 | */ 133 | 134 | Session.prototype.regenerate = function(fn){ 135 | this.req.sessionStore.regenerate(this.req, fn); 136 | return this; 137 | }; 138 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/session/store.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - session - Store 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var EventEmitter = require('events').EventEmitter 14 | , Session = require('./session') 15 | , Cookie = require('./cookie') 16 | , utils = require('../../utils'); 17 | 18 | /** 19 | * Initialize abstract `Store`. 20 | * 21 | * @api private 22 | */ 23 | 24 | var Store = module.exports = function Store(options){}; 25 | 26 | /** 27 | * Inherit from `EventEmitter.prototype`. 28 | */ 29 | 30 | Store.prototype.__proto__ = EventEmitter.prototype; 31 | 32 | /** 33 | * Re-generate the given requests's session. 34 | * 35 | * @param {IncomingRequest} req 36 | * @return {Function} fn 37 | * @api public 38 | */ 39 | 40 | Store.prototype.regenerate = function(req, fn){ 41 | var self = this; 42 | this.destroy(req.sessionID, function(err){ 43 | self.generate(req); 44 | fn(err); 45 | }); 46 | }; 47 | 48 | /** 49 | * Load a `Session` instance via the given `sid` 50 | * and invoke the callback `fn(err, sess)`. 51 | * 52 | * @param {String} sid 53 | * @param {Function} fn 54 | * @api public 55 | */ 56 | 57 | Store.prototype.load = function(sid, fn){ 58 | var self = this; 59 | this.get(sid, function(err, sess){ 60 | if (err) return fn(err); 61 | if (!sess) return fn(); 62 | var req = { sessionID: sid, sessionStore: self }; 63 | sess = self.createSession(req, sess, false); 64 | fn(null, sess); 65 | }); 66 | }; 67 | 68 | /** 69 | * Create session from JSON `sess` data. 70 | * 71 | * @param {IncomingRequest} req 72 | * @param {Object} sess 73 | * @return {Session} 74 | * @api private 75 | */ 76 | 77 | Store.prototype.createSession = function(req, sess, update){ 78 | var expires = sess.cookie.expires 79 | , orig = sess.cookie.originalMaxAge 80 | , update = null == update ? true : false; 81 | sess.cookie = new Cookie(sess.cookie); 82 | if ('string' == typeof expires) sess.cookie.expires = new Date(expires); 83 | sess.cookie.originalMaxAge = orig; 84 | req.session = new Session(req, sess); 85 | if (update) req.session.resetLastAccess(); 86 | return req.session; 87 | }; -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/middleware/vhost.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect - vhost 4 | * Copyright(c) 2010 Sencha Inc. 5 | * Copyright(c) 2011 TJ Holowaychuk 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Setup vhost for the given `hostname` and `server`. 11 | * 12 | * Examples: 13 | * 14 | * connect( 15 | * connect.vhost('foo.com', 16 | * connect.createServer(...middleware...) 17 | * ), 18 | * connect.vhost('bar.com', 19 | * connect.createServer(...middleware...) 20 | * ) 21 | * ); 22 | * 23 | * @param {String} hostname 24 | * @param {Server} server 25 | * @return {Function} 26 | * @api public 27 | */ 28 | 29 | module.exports = function vhost(hostname, server){ 30 | if (!hostname) throw new Error('vhost hostname required'); 31 | if (!server) throw new Error('vhost server required'); 32 | var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$'); 33 | if (server.onvhost) server.onvhost(hostname); 34 | return function vhost(req, res, next){ 35 | if (!req.headers.host) return next(); 36 | var host = req.headers.host.split(':')[0]; 37 | if (req.subdomains = regexp.exec(host)) { 38 | req.subdomains = req.subdomains[0].split('.').slice(0, -1); 39 | server.emit("request", req, res); 40 | } else { 41 | next(); 42 | } 43 | }; 44 | }; 45 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/patch.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Connect 4 | * Copyright(c) 2011 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var http = require('http') 13 | , res = http.OutgoingMessage.prototype; 14 | 15 | // original setHeader() 16 | 17 | var setHeader = res.setHeader; 18 | 19 | // original _renderHeaders() 20 | 21 | var _renderHeaders = res._renderHeaders; 22 | 23 | if (res._hasConnectPatch) return; 24 | 25 | /** 26 | * Provide a public "header sent" flag 27 | * until node does. 28 | * 29 | * @return {Boolean} 30 | * @api public 31 | */ 32 | 33 | res.__defineGetter__('headerSent', function(){ 34 | return this._headerSent; 35 | }); 36 | 37 | /** 38 | * Set header `field` to `val`, special-casing 39 | * the `Set-Cookie` field for multiple support. 40 | * 41 | * @param {String} field 42 | * @param {String} val 43 | * @api public 44 | */ 45 | 46 | res.setHeader = function(field, val){ 47 | var key = field.toLowerCase() 48 | , prev; 49 | 50 | // special-case Set-Cookie 51 | if (this._headers && 'set-cookie' == key) { 52 | if (prev = this.getHeader(field)) { 53 | val = Array.isArray(prev) 54 | ? prev.concat(val) 55 | : [prev, val]; 56 | } 57 | // charset 58 | } else if ('content-type' == key && this.charset) { 59 | val += '; charset=' + this.charset; 60 | } 61 | 62 | return setHeader.call(this, field, val); 63 | }; 64 | 65 | /** 66 | * Proxy `res.end()` to expose a 'header' event, 67 | * allowing arbitrary augmentation before the header 68 | * fields are written to the socket. 69 | * 70 | * NOTE: this _only_ supports node's progressive header 71 | * field API aka `res.setHeader()`. 72 | */ 73 | 74 | res._renderHeaders = function(){ 75 | this.emit('header'); 76 | return _renderHeaders.call(this); 77 | }; 78 | 79 | res._hasConnectPatch = true; 80 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/directory.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | listing directory {directory} 4 | 5 | 67 | 68 | 69 | 70 |
    71 |

    {linked-path}

    72 | {files} 73 |
    74 | 75 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {error} 4 | 5 | 6 | 7 |
    8 |

    {title}

    9 |

    500 {error}

    10 |
      {stack}
    11 |
    12 | 13 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/favicon.ico -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_add.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_attach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_code.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_error.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_find.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_go.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_green.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_key.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_link.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_red.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_save.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_word.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/icons/page_world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/node_modules/express/node_modules/connect/lib/public/icons/page_world.png -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/lib/public/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 80px 100px; 4 | font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; 5 | background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); 6 | background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); 7 | background-repeat: no-repeat; 8 | color: #555; 9 | -webkit-font-smoothing: antialiased; 10 | } 11 | h1, h2, h3 { 12 | margin: 0; 13 | font-size: 22px; 14 | color: #343434; 15 | } 16 | h1 em, h2 em { 17 | padding: 0 5px; 18 | font-weight: normal; 19 | } 20 | h1 { 21 | font-size: 60px; 22 | } 23 | h2 { 24 | margin-top: 10px; 25 | } 26 | h3 { 27 | margin: 5px 0 10px 0; 28 | padding-bottom: 5px; 29 | border-bottom: 1px solid #eee; 30 | font-size: 18px; 31 | } 32 | ul { 33 | margin: 0; 34 | padding: 0; 35 | } 36 | ul li { 37 | margin: 5px 0; 38 | padding: 3px 8px; 39 | list-style: none; 40 | } 41 | ul li:hover { 42 | cursor: pointer; 43 | color: #2e2e2e; 44 | } 45 | ul li .path { 46 | padding-left: 5px; 47 | font-weight: bold; 48 | } 49 | ul li .line { 50 | padding-right: 5px; 51 | font-style: italic; 52 | } 53 | ul li:first-child .path { 54 | padding-left: 0; 55 | } 56 | p { 57 | line-height: 1.5; 58 | } 59 | a { 60 | color: #555; 61 | text-decoration: none; 62 | } 63 | a:hover { 64 | color: #303030; 65 | } 66 | #stacktrace { 67 | margin-top: 15px; 68 | } 69 | .directory h1 { 70 | margin-bottom: 15px; 71 | font-size: 18px; 72 | } 73 | ul#files { 74 | width: 100%; 75 | height: 500px; 76 | } 77 | ul#files li { 78 | padding: 0; 79 | } 80 | ul#files li img { 81 | position: absolute; 82 | top: 5px; 83 | left: 5px; 84 | } 85 | ul#files li a { 86 | position: relative; 87 | display: block; 88 | margin: 1px; 89 | width: 30%; 90 | height: 25px; 91 | line-height: 25px; 92 | text-indent: 8px; 93 | float: left; 94 | border: 1px solid transparent; 95 | -webkit-border-radius: 5px; 96 | -moz-border-radius: 5px; 97 | border-radius: 5px; 98 | overflow: hidden; 99 | text-overflow: ellipsis; 100 | } 101 | ul#files li a.icon { 102 | text-indent: 25px; 103 | } 104 | ul#files li a:focus, 105 | ul#files li a:hover { 106 | outline: none; 107 | background: rgba(255,255,255,0.65); 108 | border: 1px solid #ececec; 109 | } 110 | ul#files li a.highlight { 111 | -webkit-transition: background .4s ease-in-out; 112 | background: #ffff4f; 113 | border-color: #E9DC51; 114 | } 115 | #search { 116 | display: block; 117 | position: fixed; 118 | top: 20px; 119 | right: 20px; 120 | width: 90px; 121 | -webkit-transition: width ease 0.2s, opacity ease 0.4s; 122 | -moz-transition: width ease 0.2s, opacity ease 0.4s; 123 | -webkit-border-radius: 32px; 124 | -moz-border-radius: 32px; 125 | -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); 126 | -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); 127 | -webkit-font-smoothing: antialiased; 128 | text-align: left; 129 | font: 13px "Helvetica Neue", Arial, sans-serif; 130 | padding: 4px 10px; 131 | border: none; 132 | background: transparent; 133 | margin-bottom: 0; 134 | outline: none; 135 | opacity: 0.7; 136 | color: #888; 137 | } 138 | #search:focus { 139 | width: 120px; 140 | opacity: 1.0; 141 | } 142 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "connect", 3 | "version": "1.7.2", 4 | "description": "High performance middleware framework", 5 | "keywords": ["framework", "web", "middleware", "connect", "rack"], 6 | "repository": "git://github.com/senchalabs/connect.git", 7 | "author": "TJ Holowaychuk (http://tjholowaychuk.com)", 8 | "repository": "git://github.com/senchalabs/connect", 9 | "dependencies": { 10 | "qs": ">= 0.3.1", 11 | "mime": ">= 0.0.1" 12 | }, 13 | "devDependencies": { 14 | "expresso": "0.9.2", 15 | "koala": "0.1.2", 16 | "less": "1.1.1", 17 | "sass": "0.5.0", 18 | "markdown": "0.2.1", 19 | "ejs": "0.4.3", 20 | "should": "0.3.2" 21 | }, 22 | "main": "index", 23 | "engines": { "node": ">= 0.4.1 < 0.7.0" } 24 | } -------------------------------------------------------------------------------- /node_modules/express/node_modules/connect/test.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var connect = require('./') 7 | , utils = connect.utils 8 | , http = require('http') 9 | , url = require('url') 10 | , path = require('path') 11 | , fs = require('fs'); 12 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Benjamin Thomas, Robert Kieffer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/README.md: -------------------------------------------------------------------------------- 1 | # mime 2 | 3 | Support for mapping between file extensions and MIME types. This module uses the latest version of the Apache "mime.types" file (maps over 620 types to 800+ extensions). It is also trivially easy to add your own types and extensions, should you need to do that. 4 | 5 | ## Install 6 | 7 | Install with [npm](http://github.com/isaacs/npm): 8 | 9 | npm install mime 10 | 11 | ## API - Queries 12 | 13 | ### mime.lookup(path) 14 | Get the mime type associated with a file. This is method is case-insensitive. Everything in path up to and including the last '/' or '.' is ignored, so you can pass it paths, filenames, or extensions, like so: 15 | 16 | var mime = require('mime'); 17 | 18 | mime.lookup('/path/to/file.txt'); // => 'text/plain' 19 | mime.lookup('file.txt'); // => 'text/plain' 20 | mime.lookup('.txt'); // => 'text/plain' 21 | mime.lookup('htm'); // => 'text/html' 22 | 23 | ### mime.extension(type) - lookup the default extension for type 24 | 25 | mime.extension('text/html'); // => 'html' 26 | mime.extension('application/octet-stream'); // => 'bin' 27 | 28 | ### mime.charsets.lookup() - map mime-type to charset 29 | 30 | mime.charsets.lookup('text/plain'); // => 'UTF-8' 31 | 32 | (The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) 33 | 34 | ## API - Customizing 35 | 36 | The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types). 37 | ### mime.define() - Add custom mime/extension mappings 38 | 39 | mime.define({ 40 | 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], 41 | 'application/x-my-type': ['x-mt', 'x-mtt'], 42 | // etc ... 43 | }); 44 | 45 | mime.lookup('x-sft'); // => 'text/x-some-format' 46 | mime.extension('text/x-some-format'); // => 'x-sf' 47 | 48 | ### mime.load(filepath) - Load mappings from an Apache ".types" format file 49 | 50 | mime.load('./my_project.types'); 51 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/mime.js: -------------------------------------------------------------------------------- 1 | var path = require('path'), 2 | fs = require('fs'); 3 | 4 | var mime = module.exports = { 5 | /** Map of extension to mime type */ 6 | types: {}, 7 | 8 | /** Map of mime type to extension */ 9 | extensions :{}, 10 | 11 | /** 12 | * Define mimetype -> extension mappings. Each key is a mime-type that maps 13 | * to an array of extensions associated with the type. The first extension is 14 | * used as the default extension for the type. 15 | * 16 | * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); 17 | * 18 | * @param map (Object) type definitions 19 | */ 20 | define: function(map) { 21 | for (var type in map) { 22 | var exts = map[type]; 23 | 24 | for (var i = 0; i < exts.length; i++) { 25 | mime.types[exts[i]] = type; 26 | } 27 | 28 | // Default extension is the first one we encounter 29 | if (!mime.extensions[type]) { 30 | mime.extensions[type] = exts[0]; 31 | } 32 | } 33 | }, 34 | 35 | /** 36 | * Load an Apache2-style ".types" file 37 | * 38 | * This may be called multiple times (it's expected). Where files declare 39 | * overlapping types/extensions, the last file wins. 40 | * 41 | * @param file (String) path of file to load. 42 | */ 43 | load: function(file) { 44 | // Read file and split into lines 45 | var map = {}, 46 | content = fs.readFileSync(file, 'ascii'), 47 | lines = content.split(/[\r\n]+/); 48 | 49 | lines.forEach(function(line, lineno) { 50 | // Clean up whitespace/comments, and split into fields 51 | var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); 52 | map[fields.shift()] = fields; 53 | }); 54 | 55 | mime.define(map); 56 | }, 57 | 58 | /** 59 | * Lookup a mime type based on extension 60 | */ 61 | lookup: function(path, fallback) { 62 | var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); 63 | return mime.types[ext] || fallback || mime.default_type; 64 | }, 65 | 66 | /** 67 | * Return file extension associated with a mime type 68 | */ 69 | extension: function(mimeType) { 70 | return mime.extensions[mimeType]; 71 | }, 72 | 73 | /** 74 | * Lookup a charset based on mime type. 75 | */ 76 | charsets: { 77 | lookup: function (mimeType, fallback) { 78 | // Assume text types are utf8. Modify mime logic as needed. 79 | return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; 80 | } 81 | } 82 | }; 83 | 84 | // Load our local copy of 85 | // http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types 86 | mime.load(path.join(__dirname, 'types/mime.types')); 87 | 88 | // Overlay enhancements submitted by the node.js community 89 | mime.load(path.join(__dirname, 'types/node.types')); 90 | 91 | // Set the default type 92 | mime.default_type = mime.types.bin; 93 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Robert Kieffer", 4 | "url": "http://github.com/broofa", 5 | "email": "robert@broofa.com" 6 | }, 7 | "contributors": [ 8 | { 9 | "name": "Benjamin Thomas", 10 | "url": "http://github.com/bentomas", 11 | "email": "benjamin@benjaminthomas.org" 12 | } 13 | ], 14 | "dependencies": {}, 15 | "description": "A comprehensive library for mime-type mapping", 16 | "devDependencies": {"async_testing": ""}, 17 | "keywords": ["util", "mime"], 18 | "main": "mime.js", 19 | "name": "mime", 20 | "repository": {"url": "http://github.com/bentomas/node-mime", "type": "git"}, 21 | "version": "1.2.4" 22 | } 23 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Requires the async_testing module 3 | * 4 | * Usage: node test.js 5 | */ 6 | var mime = require('./mime'); 7 | exports["test mime lookup"] = function(test) { 8 | // easy 9 | test.equal('text/plain', mime.lookup('text.txt')); 10 | 11 | // hidden file or multiple periods 12 | test.equal('text/plain', mime.lookup('.text.txt')); 13 | 14 | // just an extension 15 | test.equal('text/plain', mime.lookup('.txt')); 16 | 17 | // just an extension without a dot 18 | test.equal('text/plain', mime.lookup('txt')); 19 | 20 | // default 21 | test.equal('application/octet-stream', mime.lookup('text.nope')); 22 | 23 | // fallback 24 | test.equal('fallback', mime.lookup('text.fallback', 'fallback')); 25 | 26 | test.finish(); 27 | }; 28 | 29 | exports["test extension lookup"] = function(test) { 30 | // easy 31 | test.equal('txt', mime.extension(mime.types.text)); 32 | test.equal('html', mime.extension(mime.types.htm)); 33 | test.equal('bin', mime.extension('application/octet-stream')); 34 | 35 | test.finish(); 36 | }; 37 | 38 | exports["test mime lookup uppercase"] = function(test) { 39 | // easy 40 | test.equal('text/plain', mime.lookup('TEXT.TXT')); 41 | 42 | // just an extension 43 | test.equal('text/plain', mime.lookup('.TXT')); 44 | 45 | // just an extension without a dot 46 | test.equal('text/plain', mime.lookup('TXT')); 47 | 48 | // default 49 | test.equal('application/octet-stream', mime.lookup('TEXT.NOPE')); 50 | 51 | // fallback 52 | test.equal('fallback', mime.lookup('TEXT.FALLBACK', 'fallback')); 53 | 54 | test.finish(); 55 | }; 56 | 57 | exports["test custom types"] = function(test) { 58 | test.equal('application/octet-stream', mime.lookup('file.buffer')); 59 | test.equal('audio/mp4', mime.lookup('file.m4a')); 60 | 61 | test.finish(); 62 | }; 63 | 64 | exports["test charset lookup"] = function(test) { 65 | // easy 66 | test.equal('UTF-8', mime.charsets.lookup('text/plain')); 67 | 68 | // none 69 | test.ok(typeof mime.charsets.lookup(mime.types.js) == 'undefined'); 70 | 71 | // fallback 72 | test.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); 73 | 74 | test.finish(); 75 | }; 76 | 77 | if (module == require.main) { 78 | require('async_testing').run(__filename, process.ARGV); 79 | } 80 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mime/types/node.types: -------------------------------------------------------------------------------- 1 | # What: Google Chrome Extension 2 | # Why: To allow apps to (work) be served with the right content type header. 3 | # http://codereview.chromium.org/2830017 4 | # Added by: niftylettuce 5 | application/x-chrome-extension crx 6 | 7 | # What: OTF Message Silencer 8 | # Why: To silence the "Resource interpreted as font but transferred with MIME 9 | # type font/otf" message that occurs in Google Chrome 10 | # Added by: niftylettuce 11 | font/opentype otf 12 | 13 | # What: HTC support 14 | # Why: To properly render .htc files such as CSS3PIE 15 | # Added by: niftylettuce 16 | text/x-component htc 17 | 18 | # What: HTML5 application cache manifest 19 | # Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps 20 | # per https://developer.mozilla.org/en/offline_resources_in_firefox 21 | # Added by: louisremi 22 | text/cache-manifest appcache manifest 23 | 24 | # What: node binary buffer format 25 | # Why: semi-standard extension w/in the node community 26 | # Added by: tootallnate 27 | application/octet-stream buffer 28 | 29 | # What: The "protected" MP-4 formats used by iTunes. 30 | # Why: Required for streaming music to browsers (?) 31 | # Added by: broofa 32 | application/mp4 m4p 33 | audio/mp4 m4a 34 | 35 | # What: Music playlist format (http://en.wikipedia.org/wiki/M3U) 36 | # Why: See https://github.com/bentomas/node-mime/pull/6 37 | # Added by: mjrusso 38 | application/x-mpegURL m3u8 39 | 40 | # What: Video format, Part of RFC1890 41 | # Why: See https://github.com/bentomas/node-mime/pull/6 42 | # Added by: mjrusso 43 | video/MP2T ts 44 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/.gitignore.orig: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/.gitignore.rej: -------------------------------------------------------------------------------- 1 | --- /dev/null 2 | +++ .gitignore 3 | @@ -0,0 +1,2 @@ 4 | +node_modules/ 5 | +npm-debug.log -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 James Halliday (mail@substack.net) 2 | 3 | This project is free software released under the MIT/X11 license: 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/README.markdown: -------------------------------------------------------------------------------- 1 | mkdirp 2 | ====== 3 | 4 | Like `mkdir -p`, but in node.js! 5 | 6 | Example 7 | ======= 8 | 9 | pow.js 10 | ------ 11 | var mkdirp = require('mkdirp'); 12 | 13 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 14 | if (err) console.error(err) 15 | else console.log('pow!') 16 | }); 17 | 18 | Output 19 | pow! 20 | 21 | And now /tmp/foo/bar/baz exists, huzzah! 22 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/examples/pow.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('mkdirp'); 2 | 3 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 4 | if (err) console.error(err) 5 | else console.log('pow!') 6 | }); 7 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/examples/pow.js.orig: -------------------------------------------------------------------------------- 1 | var mkdirp = require('mkdirp'); 2 | 3 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 4 | if (err) console.error(err) 5 | else console.log('pow!') 6 | }); 7 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/examples/pow.js.rej: -------------------------------------------------------------------------------- 1 | --- examples/pow.js 2 | +++ examples/pow.js 3 | @@ -1,6 +1,15 @@ 4 | -var mkdirp = require('mkdirp').mkdirp; 5 | +var mkdirp = require('../').mkdirp, 6 | + mkdirpSync = require('../').mkdirpSync; 7 | 8 | mkdirp('/tmp/foo/bar/baz', 0755, function (err) { 9 | if (err) console.error(err) 10 | else console.log('pow!') 11 | }); 12 | + 13 | +try { 14 | + mkdirpSync('/tmp/bar/foo/baz', 0755); 15 | + console.log('double pow!'); 16 | +} 17 | +catch (ex) { 18 | + console.log(ex); 19 | +} -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/index.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | var exports = module.exports = function mkdirP (p, mode, f) { 5 | var cb = f || function () {}; 6 | p = path.resolve(p); 7 | 8 | var ps = path.normalize(p).split('/'); 9 | path.exists(p, function (exists) { 10 | if (exists) cb(null); 11 | else mkdirP(ps.slice(0,-1).join('/'), mode, function (err) { 12 | if (err && err.code !== 'EEXIST') cb(err) 13 | else fs.mkdir(p, mode, function (err) { 14 | if (err && err.code !== 'EEXIST') cb(err) 15 | else cb() 16 | }); 17 | }); 18 | }); 19 | }; 20 | exports.mkdirp = exports.mkdirP = module.exports; 21 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "mkdirp", 3 | "description" : "Recursively mkdir, like `mkdir -p`", 4 | "version" : "0.0.7", 5 | "author" : "James Halliday (http://substack.net)", 6 | "main" : "./index", 7 | "keywords" : [ 8 | "mkdir", 9 | "directory" 10 | ], 11 | "repository" : { 12 | "type" : "git", 13 | "url" : "http://github.com/substack/node-mkdirp.git" 14 | }, 15 | "scripts" : { 16 | "test" : "node node_modules/tap/bin/tap.js test/*.js" 17 | }, 18 | "devDependencies" : { 19 | "tap" : "0.0.x" 20 | }, 21 | "license" : "MIT/X11", 22 | "engines": { "node": "*" } 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/test/mkdirp.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('woo', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var file = '/tmp/' + [x,y,z].join('/'); 13 | 14 | mkdirp(file, 0755, function (err) { 15 | if (err) t.fail(err); 16 | else path.exists(file, function (ex) { 17 | if (!ex) t.fail('file not created') 18 | else fs.stat(file, function (err, stat) { 19 | if (err) t.fail(err) 20 | else { 21 | t.equal(stat.mode & 0777, 0755); 22 | t.ok(stat.isDirectory(), 'target not a directory'); 23 | t.end(); 24 | } 25 | }) 26 | }) 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/test/race.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../').mkdirp; 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('race', function (t) { 7 | t.plan(4); 8 | var ps = [ '', 'tmp' ]; 9 | 10 | for (var i = 0; i < 25; i++) { 11 | var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 12 | ps.push(dir); 13 | } 14 | var file = ps.join('/'); 15 | 16 | var res = 2; 17 | mk(file, function () { 18 | if (--res === 0) t.end(); 19 | }); 20 | 21 | mk(file, function () { 22 | if (--res === 0) t.end(); 23 | }); 24 | 25 | function mk (file, cb) { 26 | mkdirp(file, 0755, function (err) { 27 | if (err) t.fail(err); 28 | else path.exists(file, function (ex) { 29 | if (!ex) t.fail('file not created') 30 | else fs.stat(file, function (err, stat) { 31 | if (err) t.fail(err) 32 | else { 33 | t.equal(stat.mode & 0777, 0755); 34 | t.ok(stat.isDirectory(), 'target not a directory'); 35 | if (cb) cb(); 36 | } 37 | }) 38 | }) 39 | }); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/mkdirp/test/rel.js: -------------------------------------------------------------------------------- 1 | var mkdirp = require('../'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | var test = require('tap').test; 5 | 6 | test('rel', function (t) { 7 | t.plan(2); 8 | var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 9 | var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 10 | var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); 11 | 12 | var cwd = process.cwd(); 13 | process.chdir('/tmp'); 14 | 15 | var file = [x,y,z].join('/'); 16 | 17 | mkdirp(file, 0755, function (err) { 18 | if (err) t.fail(err); 19 | else path.exists(file, function (ex) { 20 | if (!ex) t.fail('file not created') 21 | else fs.stat(file, function (err, stat) { 22 | if (err) t.fail(err) 23 | else { 24 | process.chdir(cwd); 25 | t.equal(stat.mode & 0777, 0755); 26 | t.ok(stat.isDirectory(), 'target not a directory'); 27 | t.end(); 28 | } 29 | }) 30 | }) 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "support/expresso"] 2 | path = support/expresso 3 | url = git://github.com/visionmedia/expresso.git 4 | [submodule "support/should"] 5 | path = support/should 6 | url = git://github.com/visionmedia/should.js.git 7 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/History.md: -------------------------------------------------------------------------------- 1 | 2 | 0.3.1 / 2011-08-17 3 | ================== 4 | 5 | * Added `try/catch` around malformed uri components 6 | * Add test coverage for Array native method bleed-though 7 | 8 | 0.3.0 / 2011-07-19 9 | ================== 10 | 11 | * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] 12 | 13 | 0.2.0 / 2011-06-29 14 | ================== 15 | 16 | * Added `qs.stringify()` [Cory Forsyth] 17 | 18 | 0.1.0 / 2011-04-13 19 | ================== 20 | 21 | * Added jQuery-ish array support 22 | 23 | 0.0.7 / 2011-03-13 24 | ================== 25 | 26 | * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] 27 | allows for convenient `qs.parse(url.parse(str).query)` 28 | 29 | 0.0.6 / 2011-02-14 30 | ================== 31 | 32 | * Fixed; support for implicit arrays 33 | 34 | 0.0.4 / 2011-02-09 35 | ================== 36 | 37 | * Fixed `+` as a space 38 | 39 | 0.0.3 / 2011-02-08 40 | ================== 41 | 42 | * Fixed case when right-hand value contains "]" 43 | 44 | 0.0.2 / 2011-02-07 45 | ================== 46 | 47 | * Fixed "=" presence in key 48 | 49 | 0.0.1 / 2011-02-07 50 | ================== 51 | 52 | * Initial release -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/Makefile: -------------------------------------------------------------------------------- 1 | 2 | test: 3 | @./node_modules/.bin/expresso \ 4 | -I support \ 5 | -I lib 6 | 7 | .PHONY: test -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/Readme.md: -------------------------------------------------------------------------------- 1 | # node-querystring 2 | 3 | query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. 4 | 5 | ## Installation 6 | 7 | $ npm install qs 8 | 9 | 10 | ## Examples 11 | 12 | require('qs').parse('user[name][first]=tj&user[email]=tj'); 13 | // => { user: { name: { first: 'tj' }, email: 'tj' } } 14 | 15 | ## Testing 16 | 17 | Update git submodules: 18 | 19 | $ git submodule init 20 | $ git submodule update 21 | 22 | and execute: 23 | 24 | $ make test 25 | 26 | ## License 27 | 28 | (The MIT License) 29 | 30 | Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> 31 | 32 | Permission is hereby granted, free of charge, to any person obtaining 33 | a copy of this software and associated documentation files (the 34 | 'Software'), to deal in the Software without restriction, including 35 | without limitation the rights to use, copy, modify, merge, publish, 36 | distribute, sublicense, and/or sell copies of the Software, and to 37 | permit persons to whom the Software is furnished to do so, subject to 38 | the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be 41 | included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 44 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 45 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 46 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 47 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 48 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 49 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/benchmark.js: -------------------------------------------------------------------------------- 1 | 2 | var qs = require('./'); 3 | 4 | var times = 100000 5 | , start = new Date 6 | , n = times; 7 | 8 | console.log('times: %d', times); 9 | 10 | while (n--) qs.parse('foo=bar'); 11 | console.log('simple: %dms', new Date - start); 12 | 13 | var start = new Date 14 | , n = times; 15 | 16 | while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); 17 | console.log('nested: %dms', new Date - start); -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/examples.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var qs = require('./'); 7 | 8 | var obj = qs.parse('foo'); 9 | console.log(obj) 10 | 11 | var obj = qs.parse('foo=bar=baz'); 12 | console.log(obj) 13 | 14 | var obj = qs.parse('users[]'); 15 | console.log(obj) 16 | 17 | var obj = qs.parse('name=tj&email=tj@vision-media.ca'); 18 | console.log(obj) 19 | 20 | var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); 21 | console.log(obj) 22 | 23 | var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); 24 | console.log(obj) 25 | 26 | var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); 27 | console.log(obj) 28 | 29 | var obj = qs.parse('a=a&a=b&a=c'); 30 | console.log(obj) 31 | 32 | var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); 33 | console.log(obj) 34 | 35 | var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); 36 | console.log(obj) 37 | 38 | var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); 39 | console.log(obj) 40 | 41 | var obj = qs.parse('user[0]=tj&user[1]=TJ'); 42 | console.log(obj) 43 | 44 | var obj = qs.parse('user[0]=tj&user[]=TJ'); 45 | console.log(obj) 46 | 47 | var obj = qs.parse('user[0]=tj&user[foo]=TJ'); 48 | console.log(obj) 49 | -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = require('./lib/querystring'); -------------------------------------------------------------------------------- /node_modules/express/node_modules/qs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qs", 3 | "description": "querystring parser", 4 | "version": "0.3.1", 5 | "repository": { 6 | "type" : "git", 7 | "url" : "git://github.com/visionmedia/node-querystring.git" 8 | }, 9 | "devDependencies": { 10 | "expresso": "0.9.2" 11 | , "should": "*" 12 | }, 13 | "author": "TJ Holowaychuk (http://tjholowaychuk.com)", 14 | "main": "index", 15 | "engines": { "node": "*" } 16 | } -------------------------------------------------------------------------------- /node_modules/express/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express", 3 | "description": "Sinatra inspired web development framework", 4 | "version": "2.5.0", 5 | "author": "TJ Holowaychuk ", 6 | "contributors": [ 7 | { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" }, 8 | { "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com" }, 9 | { "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" }, 10 | { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } 11 | ], 12 | "dependencies": { 13 | "connect": "1.7.x", 14 | "mime": ">= 0.0.1", 15 | "qs": ">= 0.3.1", 16 | "mkdirp": "0.0.7" 17 | }, 18 | "devDependencies": { 19 | "connect-form": "0.2.1", 20 | "ejs": "0.4.2", 21 | "expresso": "0.9.2", 22 | "hamljs": "0.5.1", 23 | "jade": "0.16.2", 24 | "stylus": "0.13.0", 25 | "should": "0.3.2", 26 | "express-messages": "0.0.2", 27 | "node-markdown": ">= 0.0.1", 28 | "connect-redis": ">= 0.0.1" 29 | }, 30 | "keywords": ["framework", "sinatra", "web", "rest", "restful"], 31 | "repository": "git://github.com/visionmedia/express", 32 | "main": "index", 33 | "bin": { "express": "./bin/express" }, 34 | "scripts": { 35 | "test": "make test", 36 | "prepublish" : "npm prune" 37 | }, 38 | "engines": { "node": ">= 0.4.1 < 0.7.0" } 39 | } -------------------------------------------------------------------------------- /node_modules/express/testing/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var express = require('../') 7 | , http = require('http') 8 | , connect = require('connect'); 9 | 10 | var app = express.createServer(); 11 | 12 | app.set('views', __dirname + '/views'); 13 | app.set('view engine', 'jade'); 14 | 15 | app.configure(function(){ 16 | app.use(function(req, res, next){ 17 | debugger 18 | res.write('first'); 19 | console.error('first'); 20 | next(); 21 | }); 22 | 23 | app.use(app.router); 24 | 25 | app.use(function(req, res, next){ 26 | console.error('last'); 27 | res.end('last'); 28 | }); 29 | }); 30 | 31 | app.get('/', function(req, res, next){ 32 | console.error('middle'); 33 | res.write(' route '); 34 | next(); 35 | }); 36 | 37 | app.listen(3000); 38 | console.log('listening on port 3000'); -------------------------------------------------------------------------------- /node_modules/express/testing/views/page.html: -------------------------------------------------------------------------------- 1 | p register test -------------------------------------------------------------------------------- /node_modules/express/testing/views/page.jade: -------------------------------------------------------------------------------- 1 | html 2 | body 3 | h1 test -------------------------------------------------------------------------------- /node_modules/express/testing/views/test.md: -------------------------------------------------------------------------------- 1 | testing _some_ markdown -------------------------------------------------------------------------------- /node_modules/express/testing/views/user/index.jade: -------------------------------------------------------------------------------- 1 | p user page -------------------------------------------------------------------------------- /node_modules/express/testing/views/user/list.jade: -------------------------------------------------------------------------------- 1 | p user list page -------------------------------------------------------------------------------- /node_modules/socket.io/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | lib-cov 3 | *.seed 4 | *.log 5 | *.csv 6 | *.dat 7 | *.out 8 | *.pid 9 | benchmarks/*.png 10 | node_modules 11 | -------------------------------------------------------------------------------- /node_modules/socket.io/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | -------------------------------------------------------------------------------- /node_modules/socket.io/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ALL_TESTS = $(shell find test/ -name '*.test.js') 3 | ALL_BENCH = $(shell find benchmarks -name '*.bench.js') 4 | 5 | run-tests: 6 | @./node_modules/.bin/expresso \ 7 | -t 3000 \ 8 | -I support \ 9 | --serial \ 10 | $(TESTFLAGS) \ 11 | $(TESTS) 12 | 13 | test: 14 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 15 | 16 | test-cov: 17 | @TESTFLAGS=--cov $(MAKE) test 18 | 19 | test-leaks: 20 | @ls test/leaks/* | xargs node --expose_debug_as=debug --expose_gc 21 | 22 | run-bench: 23 | @node $(PROFILEFLAGS) benchmarks/runner.js 24 | 25 | bench: 26 | @$(MAKE) BENCHMARKS="$(ALL_BENCH)" run-bench 27 | 28 | profile: 29 | @PROFILEFLAGS='--prof --trace-opt --trace-bailout --trace-deopt' $(MAKE) bench 30 | 31 | .PHONY: test bench profile 32 | -------------------------------------------------------------------------------- /node_modules/socket.io/benchmarks/decode.bench.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var benchmark = require('benchmark') 7 | , colors = require('colors') 8 | , io = require('../') 9 | , parser = io.parser 10 | , suite = new benchmark.Suite('Decode packet'); 11 | 12 | suite.add('string', function () { 13 | parser.decodePacket('4:::"2"'); 14 | }); 15 | 16 | suite.add('event', function () { 17 | parser.decodePacket('5:::{"name":"woot"}'); 18 | }); 19 | 20 | suite.add('event+ack', function () { 21 | parser.decodePacket('5:1+::{"name":"tobi"}'); 22 | }); 23 | 24 | suite.add('event+data', function () { 25 | parser.decodePacket('5:::{"name":"edwald","args":[{"a": "b"},2,"3"]}'); 26 | }); 27 | 28 | suite.add('heartbeat', function () { 29 | parser.decodePacket('2:::'); 30 | }); 31 | 32 | suite.add('error', function () { 33 | parser.decodePacket('7:::2+0'); 34 | }); 35 | 36 | var payload = parser.encodePayload([ 37 | parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) 38 | , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) 39 | , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) 40 | , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) 41 | , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) 42 | , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) 43 | , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) 44 | ]); 45 | 46 | suite.add('payload', function () { 47 | parser.decodePayload(payload); 48 | }); 49 | 50 | suite.on('cycle', function (bench, details) { 51 | console.log('\n' + suite.name.grey, details.name.white.bold); 52 | console.log([ 53 | details.hz.toFixed(2).cyan + ' ops/sec'.grey 54 | , details.count.toString().white + ' times executed'.grey 55 | , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey 56 | , 57 | ].join(', '.grey)); 58 | }); 59 | 60 | if (!module.parent) { 61 | suite.run(); 62 | } else { 63 | module.exports = suite; 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/socket.io/benchmarks/encode.bench.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var benchmark = require('benchmark') 7 | , colors = require('colors') 8 | , io = require('../') 9 | , parser = io.parser 10 | , suite = new benchmark.Suite('Encode packet'); 11 | 12 | suite.add('string', function () { 13 | parser.encodePacket({ 14 | type: 'json' 15 | , endpoint: '' 16 | , data: '2' 17 | }); 18 | }); 19 | 20 | suite.add('event', function () { 21 | parser.encodePacket({ 22 | type: 'event' 23 | , name: 'woot' 24 | , endpoint: '' 25 | , args: [] 26 | }); 27 | }); 28 | 29 | suite.add('event+ack', function () { 30 | parser.encodePacket({ 31 | type: 'json' 32 | , id: 1 33 | , ack: 'data' 34 | , endpoint: '' 35 | , data: { a: 'b' } 36 | }); 37 | }); 38 | 39 | suite.add('event+data', function () { 40 | parser.encodePacket({ 41 | type: 'event' 42 | , name: 'edwald' 43 | , endpoint: '' 44 | , args: [{a: 'b'}, 2, '3'] 45 | }); 46 | }); 47 | 48 | suite.add('heartbeat', function () { 49 | parser.encodePacket({ 50 | type: 'heartbeat' 51 | , endpoint: '' 52 | }) 53 | }); 54 | 55 | suite.add('error', function () { 56 | parser.encodePacket({ 57 | type: 'error' 58 | , reason: 'unauthorized' 59 | , advice: 'reconnect' 60 | , endpoint: '' 61 | }) 62 | }) 63 | 64 | suite.add('payload', function () { 65 | parser.encodePayload([ 66 | parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) 67 | , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) 68 | , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) 69 | , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) 70 | , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) 71 | , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) 72 | , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) 73 | ]); 74 | }); 75 | 76 | suite.on('cycle', function (bench, details) { 77 | console.log('\n' + suite.name.grey, details.name.white.bold); 78 | console.log([ 79 | details.hz.toFixed(2).cyan + ' ops/sec'.grey 80 | , details.count.toString().white + ' times executed'.grey 81 | , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey 82 | , 83 | ].join(', '.grey)); 84 | }); 85 | 86 | if (!module.parent) { 87 | suite.run(); 88 | } else { 89 | module.exports = suite; 90 | } 91 | -------------------------------------------------------------------------------- /node_modules/socket.io/benchmarks/runner.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Benchmark runner dependencies 3 | */ 4 | 5 | var colors = require('colors') 6 | , path = require('path'); 7 | 8 | /** 9 | * Find all the benchmarks 10 | */ 11 | 12 | var benchmarks_files = process.env.BENCHMARKS.split(' ') 13 | , all = [].concat(benchmarks_files) 14 | , first = all.shift() 15 | , benchmarks = {}; 16 | 17 | // find the benchmarks and load them all in our obj 18 | benchmarks_files.forEach(function (file) { 19 | benchmarks[file] = require(path.join(__dirname, '..', file)); 20 | }); 21 | 22 | // setup the complete listeners 23 | benchmarks_files.forEach(function (file) { 24 | var benchmark = benchmarks[file] 25 | , next_file = all.shift() 26 | , next = benchmarks[next_file]; 27 | 28 | /** 29 | * Generate a oncomplete function for the tests, either we are done or we 30 | * have more benchmarks to process. 31 | */ 32 | 33 | function complete () { 34 | if (!next) { 35 | console.log( 36 | '\n\nBenchmark completed in'.grey 37 | , (Date.now() - start).toString().green + ' ms'.grey 38 | ); 39 | } else { 40 | console.log('\nStarting benchmark '.grey + next_file.yellow); 41 | next.run(); 42 | } 43 | } 44 | 45 | // attach the listener 46 | benchmark.on('complete', complete); 47 | }); 48 | 49 | /** 50 | * Start the benchmark 51 | */ 52 | 53 | var start = Date.now(); 54 | console.log('Starting benchmark '.grey + first.yellow); 55 | benchmarks[first].run(); 56 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/chat/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var express = require('express') 6 | , stylus = require('stylus') 7 | , nib = require('nib') 8 | , sio = require('../../lib/socket.io'); 9 | 10 | /** 11 | * App. 12 | */ 13 | 14 | var app = express.createServer(); 15 | 16 | /** 17 | * App configuration. 18 | */ 19 | 20 | app.configure(function () { 21 | app.use(stylus.middleware({ src: __dirname + '/public', compile: compile })); 22 | app.use(express.static(__dirname + '/public')); 23 | app.set('views', __dirname); 24 | app.set('view engine', 'jade'); 25 | 26 | function compile (str, path) { 27 | return stylus(str) 28 | .set('filename', path) 29 | .use(nib()); 30 | }; 31 | }); 32 | 33 | /** 34 | * App routes. 35 | */ 36 | 37 | app.get('/', function (req, res) { 38 | res.render('index', { layout: false }); 39 | }); 40 | 41 | /** 42 | * App listen. 43 | */ 44 | 45 | app.listen(3000, function () { 46 | var addr = app.address(); 47 | console.log(' app listening on http://' + addr.address + ':' + addr.port); 48 | }); 49 | 50 | /** 51 | * Socket.IO server (single process only) 52 | */ 53 | 54 | var io = sio.listen(app) 55 | , nicknames = {}; 56 | 57 | io.sockets.on('connection', function (socket) { 58 | socket.on('user message', function (msg) { 59 | socket.broadcast.emit('user message', socket.nickname, msg); 60 | }); 61 | 62 | socket.on('nickname', function (nick, fn) { 63 | if (nicknames[nick]) { 64 | fn(true); 65 | } else { 66 | fn(false); 67 | nicknames[nick] = socket.nickname = nick; 68 | socket.broadcast.emit('announcement', nick + ' connected'); 69 | io.sockets.emit('nicknames', nicknames); 70 | } 71 | }); 72 | 73 | socket.on('disconnect', function () { 74 | if (!socket.nickname) return; 75 | 76 | delete nicknames[socket.nickname]; 77 | socket.broadcast.emit('announcement', socket.nickname + ' disconnected'); 78 | socket.broadcast.emit('nicknames', nicknames); 79 | }); 80 | }); 81 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/chat/index.jade: -------------------------------------------------------------------------------- 1 | doctype 5 2 | html 3 | head 4 | link(href='/stylesheets/style.css', rel='stylesheet') 5 | script(src='http://code.jquery.com/jquery-1.6.1.min.js') 6 | script(src='/socket.io/socket.io.js') 7 | script 8 | // socket.io specific code 9 | var socket = io.connect(); 10 | 11 | socket.on('connect', function () { 12 | $('#chat').addClass('connected'); 13 | }); 14 | 15 | socket.on('announcement', function (msg) { 16 | $('#lines').append($('

    ').append($('').text(msg))); 17 | }); 18 | 19 | socket.on('nicknames', function (nicknames) { 20 | $('#nicknames').empty().append($('Online: ')); 21 | for (var i in nicknames) { 22 | $('#nicknames').append($('').text(nicknames[i])); 23 | } 24 | }); 25 | 26 | socket.on('user message', message); 27 | socket.on('reconnect', function () { 28 | $('#lines').remove(); 29 | message('System', 'Reconnected to the server'); 30 | }); 31 | 32 | socket.on('reconnecting', function () { 33 | message('System', 'Attempting to re-connect to the server'); 34 | }); 35 | 36 | socket.on('error', function (e) { 37 | message('System', e ? e : 'A unknown error occurred'); 38 | }); 39 | 40 | function message (from, msg) { 41 | $('#lines').append($('

    ').append($('').text(from), msg)); 42 | } 43 | 44 | // dom manipulation 45 | $(function () { 46 | $('#set-nickname').submit(function (ev) { 47 | socket.emit('nickname', $('#nick').val(), function (set) { 48 | if (!set) { 49 | clear(); 50 | return $('#chat').addClass('nickname-set'); 51 | } 52 | $('#nickname-err').css('visibility', 'visible'); 53 | }); 54 | return false; 55 | }); 56 | 57 | $('#send-message').submit(function () { 58 | message('me', $('#message').val()); 59 | socket.emit('user message', $('#message').val()); 60 | clear(); 61 | $('#lines').get(0).scrollTop = 10000000; 62 | return false; 63 | }); 64 | 65 | function clear () { 66 | $('#message').val('').focus(); 67 | }; 68 | }); 69 | body 70 | #chat 71 | #nickname 72 | form.wrap#set-nickname 73 | p Please type in your nickname and press enter. 74 | input#nick 75 | p#nickname-err Nickname already in use 76 | #connecting 77 | .wrap Connecting to socket.io server 78 | #messages 79 | #nicknames 80 | #lines 81 | form#send-message 82 | input#message 83 | button Send 84 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/chat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chat.io" 3 | , "description": "example chat application with socket.io" 4 | , "version": "0.0.1" 5 | , "dependencies": { 6 | "express": "2.5.0" 7 | , "jade": "0.16.4" 8 | , "stylus": "0.19.0" 9 | , "nib": "0.2.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/chat/public/stylesheets/mixins.styl: -------------------------------------------------------------------------------- 1 | border-radius(n) 2 | -webkit-border-radius n 3 | -moz-border-radius n 4 | border-radius n 5 | 6 | // replace str with val 7 | 8 | replace(expr, str, val) 9 | expr = clone(expr) 10 | for e, i in expr 11 | if str == e 12 | expr[i] = val 13 | expr 14 | 15 | // normalize gradient point (webkit) 16 | 17 | grad-point(pos) 18 | if length(pos) == 1 19 | return left pos if pos in (top bottom) 20 | return pos top if pos in (left right) 21 | else if pos[0] in (top bottom) 22 | pos[1] pos[0] 23 | else 24 | pos 25 | 26 | // implicit color stop position 27 | 28 | pos-in-stops(i, stops) 29 | len = length(stops) 30 | if len - 1 == i 31 | 100% 32 | else if i 33 | unit(i / len * 100, '%') 34 | else 35 | 0% 36 | 37 | // normalize color stops 38 | // - (color pos) -> (pos color) 39 | // - (color) -> (implied-pos color) 40 | 41 | normalize-stops(stops) 42 | stops = clone(stops) 43 | for stop, i in stops 44 | if length(stop) == 1 45 | color = stop[0] 46 | stop[0] = pos-in-stops(i, stops) 47 | stop[1] = color 48 | else if typeof(stop[1]) == 'unit' 49 | pos = stop[1] 50 | stop[1] = stop[0] 51 | stop[0] = pos 52 | stops 53 | 54 | // join color stops with the given translation function 55 | 56 | join-stops(stops, translate) 57 | str = '' 58 | len = length(stops) 59 | for stop, i in stops 60 | str += ', ' if i 61 | pos = stop[0] 62 | color = stop[1] 63 | str += translate(color, pos) 64 | unquote(str) 65 | 66 | // webkit translation function 67 | 68 | webkit-stop(color, pos) 69 | s('color-stop(%d, %s)', pos / 100, color) 70 | 71 | // mozilla translation function 72 | 73 | moz-stop(color, pos) 74 | s('%s %s', color, pos) 75 | 76 | // create a linear gradient with the given start 77 | // position, followed by color stops 78 | 79 | linear-gradient(start, stops...) 80 | error('color stops required') unless length(stops) 81 | prop = current-property[0] 82 | val = current-property[1] 83 | stops = normalize-stops(stops) 84 | 85 | // webkit 86 | end = grad-point(opposite-position(start)) 87 | webkit = s('-webkit-gradient(linear, %s, %s, %s)', grad-point(start), end, join-stops(stops, webkit-stop)) 88 | add-property(prop, replace(val, '__CALL__', webkit)) 89 | 90 | // moz 91 | stops = join-stops(stops, moz-stop) 92 | moz = s('-moz-linear-gradient(%s, %s)', start, stops) 93 | add-property(prop, replace(val, '__CALL__', moz)) 94 | 95 | // literal 96 | s('linear-gradient(%s, %s)', start, stops) 97 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/chat/public/stylesheets/style.styl: -------------------------------------------------------------------------------- 1 | @import 'nib' 2 | 3 | #chat, #nickname, #messages 4 | width 600px 5 | 6 | #chat 7 | position relative 8 | border 1px solid #ccc 9 | 10 | #nickname, #connecting 11 | position absolute 12 | height 410px 13 | z-index 100 14 | left 0 15 | top 0 16 | background #fff 17 | text-align center 18 | width 600px 19 | font 15px Georgia 20 | color #666 21 | display block 22 | .wrap 23 | padding-top 150px 24 | 25 | #nickname 26 | input 27 | border 1px solid #ccc 28 | padding 10px 29 | &:focus 30 | border-color #999 31 | outline 0 32 | #nickname-err 33 | color darkred 34 | font-size 12px 35 | visibility hidden 36 | 37 | .connected 38 | #connecting 39 | display none 40 | 41 | .nickname-set 42 | #nickname 43 | display none 44 | 45 | #messages 46 | height 380px 47 | background #eee 48 | em 49 | text-shadow 0 1px 0 #fff 50 | color #999 51 | p 52 | padding 0 53 | margin 0 54 | font 12px Helvetica, Arial 55 | padding 5px 10px 56 | b 57 | display inline-block 58 | padding-right 10px 59 | p:nth-child(even) 60 | background #fafafa 61 | #nicknames 62 | background #ccc 63 | padding 2px 4px 4px 64 | font 11px Helvetica 65 | span 66 | color black 67 | b 68 | display inline-block 69 | color #fff 70 | background #999 71 | padding 3px 6px 72 | margin-right 5px 73 | border-radius 10px 74 | text-shadow 0 1px 0 #666 75 | #lines 76 | height 355px 77 | overflow auto 78 | overflow-x hidden 79 | overflow-y auto 80 | &::-webkit-scrollbar 81 | width 6px 82 | height 6px 83 | &::-webkit-scrollbar-button:start:decrement, ::-webkit-scrollbar-button:end:increment 84 | display block 85 | height 10px 86 | &::-webkit-scrollbar-button:vertical:increment 87 | background-color #fff 88 | &::-webkit-scrollbar-track-piece 89 | background-color #fff 90 | -webkit-border-radius 3px 91 | &::-webkit-scrollbar-thumb:vertical 92 | height 50px 93 | background-color #ccc 94 | -webkit-border-radius 3px 95 | &::-webkit-scrollbar-thumb:horizontal 96 | width 50px 97 | background-color #fff 98 | -webkit-border-radius 3px 99 | 100 | #send-message 101 | background #fff 102 | position relative 103 | input 104 | border none 105 | height 30px 106 | padding 0 10px 107 | line-height 30px 108 | vertical-align middle 109 | width 580px 110 | &:focus 111 | outline 0 112 | button 113 | position absolute 114 | top 5px 115 | right 5px 116 | 117 | button 118 | download-button() 119 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/irc-output/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var express = require('express') 6 | , stylus = require('stylus') 7 | , nib = require('nib') 8 | , sio = require('../../lib/socket.io') 9 | , irc = require('./irc'); 10 | 11 | /** 12 | * App. 13 | */ 14 | 15 | var app = express.createServer(); 16 | 17 | /** 18 | * App configuration. 19 | */ 20 | 21 | app.configure(function () { 22 | app.use(stylus.middleware({ src: __dirname + '/public', compile: compile })) 23 | app.use(express.static(__dirname + '/public')); 24 | app.set('views', __dirname); 25 | app.set('view engine', 'jade'); 26 | 27 | function compile (str, path) { 28 | return stylus(str) 29 | .set('filename', path) 30 | .use(nib()); 31 | }; 32 | }); 33 | 34 | /** 35 | * App routes. 36 | */ 37 | 38 | app.get('/', function (req, res) { 39 | res.render('index', { layout: false }); 40 | }); 41 | 42 | /** 43 | * App listen. 44 | */ 45 | 46 | app.listen(3000, function () { 47 | var addr = app.address(); 48 | console.log(' app listening on http://' + addr.address + ':' + addr.port); 49 | }); 50 | 51 | /** 52 | * Socket.IO server 53 | */ 54 | 55 | var io = sio.listen(app) 56 | 57 | /** 58 | * Connect to IRC. 59 | */ 60 | 61 | var client = new irc.Client('irc.freenode.net', 6667); 62 | client.connect('socketio\\test\\' + String(Math.random()).substr(-3)); 63 | client.on('001', function () { 64 | this.send('JOIN', '#node.js'); 65 | }); 66 | client.on('PART', function (prefix) { 67 | io.sockets.emit('announcement', irc.user(prefix) + ' left the channel'); 68 | }); 69 | client.on('JOIN', function (prefix) { 70 | io.sockets.emit('announcement', irc.user(prefix) + ' joined the channel'); 71 | }); 72 | client.on('PRIVMSG', function (prefix, channel, text) { 73 | io.sockets.emit('irc message', irc.user(prefix), text); 74 | }); 75 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/irc-output/index.jade: -------------------------------------------------------------------------------- 1 | doctype 5 2 | html 3 | head 4 | link(href='/stylesheets/style.css', rel='stylesheet') 5 | script(src='http://code.jquery.com/jquery-1.6.1.min.js') 6 | script(src='/socket.io/socket.io.js') 7 | script 8 | var socket = io.connect(); 9 | 10 | socket.on('connect', function () { 11 | $('#irc').addClass('connected'); 12 | }); 13 | 14 | socket.on('announcement', function (msg) { 15 | $('#messages').append($('

    ').append($('').text(msg))); 16 | $('#messages').get(0).scrollTop = 10000000; 17 | }); 18 | 19 | socket.on('irc message', function (user, msg) { 20 | $('#messages').append($('

    ').append($('').text(user), msg)); 21 | $('#messages').get(0).scrollTop = 10000000; 22 | }); 23 | body 24 | h2 Node.JS IRC 25 | #irc 26 | #connecting 27 | .wrap Connecting to socket.io server 28 | #messages 29 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/irc-output/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "socket.io-irc" 3 | , "version": "0.0.1" 4 | , "dependencies": { 5 | "express": "2.5.0" 6 | , "jade": "0.16.4" 7 | , "stylus": "0.19.0" 8 | , "nib": "0.2.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/socket.io/examples/irc-output/public/stylesheets/style.styl: -------------------------------------------------------------------------------- 1 | @import 'nib' 2 | 3 | h2 4 | font bold 18px Helvetica Neue, Arial 5 | 6 | #irc, #messages 7 | width 600px 8 | 9 | #irc 10 | position relative 11 | border 1px solid #ccc 12 | 13 | #connecting 14 | position absolute 15 | height 410px 16 | z-index 100 17 | left 0 18 | top 0 19 | background #fff 20 | text-align center 21 | width 600px 22 | font 15px Georgia 23 | color #666 24 | display block 25 | .wrap 26 | padding-top 150px 27 | 28 | .connected 29 | #connecting 30 | display none 31 | 32 | #messages 33 | height 380px 34 | background #eee 35 | overflow auto 36 | overflow-x hidden 37 | overflow-y auto 38 | &::-webkit-scrollbar 39 | width 6px 40 | height 6px 41 | &::-webkit-scrollbar-button:start:decrement, ::-webkit-scrollbar-button:end:increment 42 | display block 43 | height 10px 44 | &::-webkit-scrollbar-button:vertical:increment 45 | background-color #fff 46 | &::-webkit-scrollbar-track-piece 47 | background-color #fff 48 | -webkit-border-radius 3px 49 | &::-webkit-scrollbar-thumb:vertical 50 | height 50px 51 | background-color #ccc 52 | -webkit-border-radius 3px 53 | &::-webkit-scrollbar-thumb:horizontal 54 | width 50px 55 | background-color #fff 56 | -webkit-border-radius 3px 57 | em 58 | text-shadow 0 1px 0 #fff 59 | color #999 60 | p 61 | padding 0 62 | margin 0 63 | font 12px Helvetica, Arial 64 | padding 5px 10px 65 | b 66 | display inline-block 67 | padding-right 10px 68 | p:nth-child(even) 69 | background #fafafa 70 | -------------------------------------------------------------------------------- /node_modules/socket.io/index.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | module.exports = require('./lib/socket.io'); 9 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/logger.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var util = require('./util') 13 | , toArray = util.toArray; 14 | 15 | /** 16 | * Log levels. 17 | */ 18 | 19 | var levels = [ 20 | 'error' 21 | , 'warn' 22 | , 'info' 23 | , 'debug' 24 | ]; 25 | 26 | /** 27 | * Colors for log levels. 28 | */ 29 | 30 | var colors = [ 31 | 31 32 | , 33 33 | , 36 34 | , 90 35 | ]; 36 | 37 | /** 38 | * Pads the nice output to the longest log level. 39 | */ 40 | 41 | function pad (str) { 42 | var max = 0; 43 | 44 | for (var i = 0, l = levels.length; i < l; i++) 45 | max = Math.max(max, levels[i].length); 46 | 47 | if (str.length < max) 48 | return str + new Array(max - str.length + 1).join(' '); 49 | 50 | return str; 51 | }; 52 | 53 | /** 54 | * Logger (console). 55 | * 56 | * @api public 57 | */ 58 | 59 | var Logger = module.exports = function (opts) { 60 | opts = opts || {} 61 | this.colors = false !== opts.colors; 62 | this.level = 3; 63 | this.enabled = true; 64 | }; 65 | 66 | /** 67 | * Log method. 68 | * 69 | * @api public 70 | */ 71 | 72 | Logger.prototype.log = function (type) { 73 | var index = levels.indexOf(type); 74 | 75 | if (index > this.level || !this.enabled) 76 | return this; 77 | 78 | console.log.apply( 79 | console 80 | , [this.colors 81 | ? ' \033[' + colors[index] + 'm' + pad(type) + ' -\033[39m' 82 | : type + ':' 83 | ].concat(toArray(arguments).slice(1)) 84 | ); 85 | 86 | return this; 87 | }; 88 | 89 | /** 90 | * Generate methods. 91 | */ 92 | 93 | levels.forEach(function (name) { 94 | Logger.prototype[name] = function () { 95 | this.log.apply(this, [name].concat(toArray(arguments))); 96 | }; 97 | }); 98 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/socket.io.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var client = require('socket.io-client'); 13 | 14 | /** 15 | * Version. 16 | */ 17 | 18 | exports.version = '0.8.7'; 19 | 20 | /** 21 | * Supported protocol version. 22 | */ 23 | 24 | exports.protocol = 1; 25 | 26 | /** 27 | * Client that we serve. 28 | */ 29 | 30 | exports.clientVersion = client.version; 31 | 32 | /** 33 | * Attaches a manager 34 | * 35 | * @param {HTTPServer/Number} a HTTP/S server or a port number to listen on. 36 | * @param {Object} opts to be passed to Manager and/or http server 37 | * @param {Function} callback if a port is supplied 38 | * @api public 39 | */ 40 | 41 | exports.listen = function (server, options, fn) { 42 | if ('function' == typeof options) { 43 | fn = options; 44 | options = {}; 45 | } 46 | 47 | if ('undefined' == typeof server) { 48 | // create a server that listens on port 80 49 | server = 80; 50 | } 51 | 52 | if ('number' == typeof server) { 53 | // if a port number is passed 54 | var port = server; 55 | 56 | if (options && options.key) 57 | server = require('https').createServer(options); 58 | else 59 | server = require('http').createServer(); 60 | 61 | // default response 62 | server.on('request', function (req, res) { 63 | res.writeHead(200); 64 | res.end('Welcome to socket.io.'); 65 | }); 66 | 67 | server.listen(port, fn); 68 | } 69 | 70 | // otherwise assume a http/s server 71 | return new exports.Manager(server, options); 72 | }; 73 | 74 | /** 75 | * Manager constructor. 76 | * 77 | * @api public 78 | */ 79 | 80 | exports.Manager = require('./manager'); 81 | 82 | /** 83 | * Transport constructor. 84 | * 85 | * @api public 86 | */ 87 | 88 | exports.Transport = require('./transport'); 89 | 90 | /** 91 | * Socket constructor. 92 | * 93 | * @api public 94 | */ 95 | 96 | exports.Socket = require('./socket'); 97 | 98 | /** 99 | * Static constructor. 100 | * 101 | * @api public 102 | */ 103 | 104 | exports.Static = require('./static'); 105 | 106 | /** 107 | * Store constructor. 108 | * 109 | * @api public 110 | */ 111 | 112 | exports.Store = require('./store'); 113 | 114 | /** 115 | * Memory Store constructor. 116 | * 117 | * @api public 118 | */ 119 | 120 | exports.MemoryStore = require('./stores/memory'); 121 | 122 | /** 123 | * Redis Store constructor. 124 | * 125 | * @api public 126 | */ 127 | 128 | exports.RedisStore = require('./stores/redis'); 129 | 130 | /** 131 | * Parser. 132 | * 133 | * @api public 134 | */ 135 | 136 | exports.parser = require('./parser'); 137 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/store.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Expose the constructor. 10 | */ 11 | 12 | exports = module.exports = Store; 13 | 14 | /** 15 | * Module dependencies. 16 | */ 17 | 18 | var EventEmitter = process.EventEmitter; 19 | 20 | /** 21 | * Store interface 22 | * 23 | * @api public 24 | */ 25 | 26 | function Store (options) { 27 | this.options = options; 28 | this.clients = {}; 29 | }; 30 | 31 | /** 32 | * Inherit from EventEmitter. 33 | */ 34 | 35 | Store.prototype.__proto__ = EventEmitter.prototype; 36 | 37 | /** 38 | * Initializes a client store 39 | * 40 | * @param {String} id 41 | * @api public 42 | */ 43 | 44 | Store.prototype.client = function (id) { 45 | if (!this.clients[id]) { 46 | this.clients[id] = new (this.constructor.Client)(this, id); 47 | } 48 | 49 | return this.clients[id]; 50 | }; 51 | 52 | /** 53 | * Destroys a client 54 | * 55 | * @api {String} sid 56 | * @param {Number} number of seconds to expire client data 57 | * @api private 58 | */ 59 | 60 | Store.prototype.destroyClient = function (id, expiration) { 61 | if (this.clients[id]) { 62 | this.clients[id].destroy(expiration); 63 | delete this.clients[id]; 64 | } 65 | 66 | return this; 67 | }; 68 | 69 | /** 70 | * Destroys the store 71 | * 72 | * @param {Number} number of seconds to expire client data 73 | * @api private 74 | */ 75 | 76 | Store.prototype.destroy = function (clientExpiration) { 77 | var keys = Object.keys(this.clients) 78 | , count = keys.length; 79 | 80 | for (var i = 0, l = count; i < l; i++) { 81 | this.destroyClient(keys[i], clientExpiration); 82 | } 83 | 84 | this.clients = {}; 85 | 86 | return this; 87 | }; 88 | 89 | /** 90 | * Client. 91 | * 92 | * @api public 93 | */ 94 | 95 | Store.Client = function (store, id) { 96 | this.store = store; 97 | this.id = id; 98 | }; 99 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/stores/memory.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var crypto = require('crypto') 13 | , Store = require('../store'); 14 | 15 | /** 16 | * Exports the constructor. 17 | */ 18 | 19 | exports = module.exports = Memory; 20 | Memory.Client = Client; 21 | 22 | /** 23 | * Memory store 24 | * 25 | * @api public 26 | */ 27 | 28 | function Memory (opts) { 29 | Store.call(this, opts); 30 | }; 31 | 32 | /** 33 | * Inherits from Store. 34 | */ 35 | 36 | Memory.prototype.__proto__ = Store.prototype; 37 | 38 | /** 39 | * Publishes a message. 40 | * 41 | * @api private 42 | */ 43 | 44 | Memory.prototype.publish = function () { }; 45 | 46 | /** 47 | * Subscribes to a channel 48 | * 49 | * @api private 50 | */ 51 | 52 | Memory.prototype.subscribe = function () { }; 53 | 54 | /** 55 | * Unsubscribes 56 | * 57 | * @api private 58 | */ 59 | 60 | Memory.prototype.unsubscribe = function () { }; 61 | 62 | /** 63 | * Client constructor 64 | * 65 | * @api private 66 | */ 67 | 68 | function Client () { 69 | Store.Client.apply(this, arguments); 70 | this.data = {}; 71 | }; 72 | 73 | /** 74 | * Inherits from Store.Client 75 | */ 76 | 77 | Client.prototype.__proto__ = Store.Client; 78 | 79 | /** 80 | * Gets a key 81 | * 82 | * @api public 83 | */ 84 | 85 | Client.prototype.get = function (key, fn) { 86 | fn(null, this.data[key] === undefined ? null : this.data[key]); 87 | return this; 88 | }; 89 | 90 | /** 91 | * Sets a key 92 | * 93 | * @api public 94 | */ 95 | 96 | Client.prototype.set = function (key, value, fn) { 97 | this.data[key] = value; 98 | fn && fn(null); 99 | return this; 100 | }; 101 | 102 | /** 103 | * Has a key 104 | * 105 | * @api public 106 | */ 107 | 108 | Client.prototype.has = function (key, fn) { 109 | fn(null, key in this.data); 110 | }; 111 | 112 | /** 113 | * Deletes a key 114 | * 115 | * @api public 116 | */ 117 | 118 | Client.prototype.del = function (key, fn) { 119 | delete this.data[key]; 120 | fn && fn(null); 121 | return this; 122 | }; 123 | 124 | /** 125 | * Destroys the client. 126 | * 127 | * @param {Number} number of seconds to expire data 128 | * @api private 129 | */ 130 | 131 | Client.prototype.destroy = function (expiration) { 132 | if ('number' != typeof expiration) { 133 | this.data = {}; 134 | } else { 135 | var self = this; 136 | 137 | setTimeout(function () { 138 | self.data = {}; 139 | }, expiration * 1000); 140 | } 141 | 142 | return this; 143 | }; 144 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/flashsocket.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | var WebSocket = require('./websocket'); 12 | 13 | /** 14 | * Export the constructor. 15 | */ 16 | 17 | exports = module.exports = FlashSocket; 18 | 19 | /** 20 | * The FlashSocket transport is just a proxy 21 | * for WebSocket connections. 22 | * 23 | * @api public 24 | */ 25 | 26 | function FlashSocket (mng, data, req) { 27 | return WebSocket.call(this, mng, data, req); 28 | } 29 | 30 | /** 31 | * Inherits from WebSocket. 32 | */ 33 | 34 | FlashSocket.prototype.__proto__ = WebSocket.prototype; 35 | 36 | /** 37 | * Transport name 38 | * 39 | * @api public 40 | */ 41 | 42 | FlashSocket.prototype.name = 'flashsocket'; 43 | 44 | /** 45 | * Listens for new configuration changes of the Manager 46 | * this way we can enable and disable the flash server. 47 | * 48 | * @param {Manager} Manager instance. 49 | * @api private 50 | */ 51 | 52 | 53 | FlashSocket.init = function (manager) { 54 | var server; 55 | function create () { 56 | server = require('policyfile').createServer({ 57 | log: function(msg){ 58 | manager.log.info(msg.toLowerCase()); 59 | } 60 | }, manager.get('origins')); 61 | 62 | server.on('close', function (e) { 63 | server = null; 64 | }); 65 | 66 | server.listen(manager.get('flash policy port'), manager.server); 67 | 68 | manager.flashPolicyServer = server; 69 | } 70 | 71 | // listen for origin changes, so we can update the server 72 | manager.on('set:origins', function (value, key) { 73 | if (!server) return; 74 | 75 | // update the origins and compile a new response buffer 76 | server.origins = Array.isArray(value) ? value : [value]; 77 | server.compile(); 78 | }); 79 | 80 | // destory the server and create a new server 81 | manager.on('set:flash policy port', function (value, key) { 82 | var transports = manager.get('transports'); 83 | if (~transports.indexOf('flashsocket')) { 84 | if (server) { 85 | if (server.port === value) return; 86 | // destroy the server and rebuild it on a new port 87 | try { 88 | server.close(); 89 | } 90 | catch (e) { /* ignore exception. could e.g. be that the server isn't started yet */ } 91 | } 92 | create(); 93 | } 94 | }); 95 | 96 | // only start the server 97 | manager.on('set:transports', function (value, key){ 98 | if (!server && ~manager.get('transports').indexOf('flashsocket')) { 99 | create(); 100 | } 101 | }); 102 | // check if we need to initialize at start 103 | if (~manager.get('transports').indexOf('flashsocket')){ 104 | create(); 105 | } 106 | }; 107 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/htmlfile.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var HTTPTransport = require('./http'); 13 | 14 | /** 15 | * Export the constructor. 16 | */ 17 | 18 | exports = module.exports = HTMLFile; 19 | 20 | /** 21 | * HTMLFile transport constructor. 22 | * 23 | * @api public 24 | */ 25 | 26 | function HTMLFile (mng, data, req) { 27 | HTTPTransport.call(this, mng, data, req); 28 | }; 29 | 30 | /** 31 | * Inherits from Transport. 32 | */ 33 | 34 | HTMLFile.prototype.__proto__ = HTTPTransport.prototype; 35 | 36 | /** 37 | * Transport name 38 | * 39 | * @api public 40 | */ 41 | 42 | HTMLFile.prototype.name = 'htmlfile'; 43 | 44 | /** 45 | * Handles the request. 46 | * 47 | * @api private 48 | */ 49 | 50 | HTMLFile.prototype.handleRequest = function (req) { 51 | HTTPTransport.prototype.handleRequest.call(this, req); 52 | 53 | if (req.method == 'GET') { 54 | req.res.writeHead(200, { 55 | 'Content-Type': 'text/html; charset=UTF-8' 56 | , 'Connection': 'keep-alive' 57 | , 'Transfer-Encoding': 'chunked' 58 | }); 59 | 60 | req.res.write( 61 | '' 62 | + '' 63 | + new Array(174).join(' ') 64 | ); 65 | } 66 | }; 67 | 68 | /** 69 | * Performs the write. 70 | * 71 | * @api private 72 | */ 73 | 74 | HTMLFile.prototype.write = function (data) { 75 | data = ''; 76 | 77 | if (this.response.write(data)) { 78 | this.drained = true; 79 | } 80 | 81 | this.log.debug(this.name + ' writing', data); 82 | }; 83 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/http-polling.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var HTTPTransport = require('./http'); 13 | 14 | /** 15 | * Exports the constructor. 16 | */ 17 | 18 | exports = module.exports = HTTPPolling; 19 | 20 | /** 21 | * HTTP polling constructor. 22 | * 23 | * @api public. 24 | */ 25 | 26 | function HTTPPolling (mng, data, req) { 27 | HTTPTransport.call(this, mng, data, req); 28 | }; 29 | 30 | /** 31 | * Inherits from HTTPTransport. 32 | * 33 | * @api public. 34 | */ 35 | 36 | HTTPPolling.prototype.__proto__ = HTTPTransport.prototype; 37 | 38 | /** 39 | * Transport name 40 | * 41 | * @api public 42 | */ 43 | 44 | HTTPPolling.prototype.name = 'httppolling'; 45 | 46 | /** 47 | * Removes heartbeat timeouts for polling. 48 | */ 49 | 50 | HTTPPolling.prototype.setHeartbeatInterval = function () { 51 | return this; 52 | }; 53 | 54 | /** 55 | * Handles a request 56 | * 57 | * @api private 58 | */ 59 | 60 | HTTPPolling.prototype.handleRequest = function (req) { 61 | HTTPTransport.prototype.handleRequest.call(this, req); 62 | 63 | if (req.method == 'GET') { 64 | var self = this; 65 | 66 | this.pollTimeout = setTimeout(function () { 67 | self.packet({ type: 'noop' }); 68 | self.log.debug(self.name + ' closed due to exceeded duration'); 69 | }, this.manager.get('polling duration') * 1000); 70 | 71 | this.log.debug('setting poll timeout'); 72 | } 73 | }; 74 | 75 | /** 76 | * Clears polling timeout 77 | * 78 | * @api private 79 | */ 80 | 81 | HTTPPolling.prototype.clearPollTimeout = function () { 82 | if (this.pollTimeout) { 83 | clearTimeout(this.pollTimeout); 84 | this.pollTimeout = null; 85 | this.log.debug('clearing poll timeout'); 86 | } 87 | 88 | return this; 89 | }; 90 | 91 | /** 92 | * Override clear timeouts to clear the poll timeout 93 | * 94 | * @api private 95 | */ 96 | 97 | HTTPPolling.prototype.clearTimeouts = function () { 98 | HTTPTransport.prototype.clearTimeouts.call(this); 99 | 100 | this.clearPollTimeout(); 101 | }; 102 | 103 | /** 104 | * doWrite to clear poll timeout 105 | * 106 | * @api private 107 | */ 108 | 109 | HTTPPolling.prototype.doWrite = function () { 110 | this.clearPollTimeout(); 111 | }; 112 | 113 | /** 114 | * Performs a write. 115 | * 116 | * @api private. 117 | */ 118 | 119 | HTTPPolling.prototype.write = function (data, close) { 120 | this.doWrite(data); 121 | this.response.end(); 122 | this.onClose(); 123 | }; 124 | 125 | /** 126 | * Override end. 127 | * 128 | * @api private 129 | */ 130 | 131 | HTTPPolling.prototype.end = function () { 132 | this.clearPollTimeout(); 133 | return HTTPTransport.prototype.end.call(this); 134 | }; 135 | 136 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/http.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var Transport = require('../transport') 13 | , parser = require('../parser') 14 | , qs = require('querystring'); 15 | 16 | /** 17 | * Export the constructor. 18 | */ 19 | 20 | exports = module.exports = HTTPTransport; 21 | 22 | /** 23 | * HTTP interface constructor. For all non-websocket transports. 24 | * 25 | * @api public 26 | */ 27 | 28 | function HTTPTransport (mng, data, req) { 29 | Transport.call(this, mng, data, req); 30 | }; 31 | 32 | /** 33 | * Inherits from Transport. 34 | */ 35 | 36 | HTTPTransport.prototype.__proto__ = Transport.prototype; 37 | 38 | /** 39 | * Handles a request. 40 | * 41 | * @api private 42 | */ 43 | 44 | HTTPTransport.prototype.handleRequest = function (req) { 45 | if (req.method == 'POST') { 46 | var buffer = '' 47 | , res = req.res 48 | , origin = req.headers.origin 49 | , headers = { 'Content-Length': 1 } 50 | , self = this; 51 | 52 | req.on('data', function (data) { 53 | buffer += data; 54 | }); 55 | 56 | req.on('end', function () { 57 | res.writeHead(200, headers); 58 | res.end('1'); 59 | 60 | self.onData(self.postEncoded ? qs.parse(buffer).d : buffer); 61 | }); 62 | 63 | if (origin) { 64 | // https://developer.mozilla.org/En/HTTP_Access_Control 65 | headers['Access-Control-Allow-Origin'] = '*'; 66 | 67 | if (req.headers.cookie) { 68 | headers['Access-Control-Allow-Credentials'] = 'true'; 69 | } 70 | } 71 | } else { 72 | this.response = req.res; 73 | 74 | Transport.prototype.handleRequest.call(this, req); 75 | } 76 | }; 77 | 78 | /** 79 | * Handles data payload. 80 | * 81 | * @api private 82 | */ 83 | 84 | HTTPTransport.prototype.onData = function (data) { 85 | var messages = parser.decodePayload(data); 86 | this.log.debug(this.name + ' received data packet', data); 87 | 88 | for (var i = 0, l = messages.length; i < l; i++) { 89 | this.onMessage(messages[i]); 90 | } 91 | }; 92 | 93 | /** 94 | * Closes the request-response cycle 95 | * 96 | * @api private 97 | */ 98 | 99 | HTTPTransport.prototype.doClose = function () { 100 | this.response.end(); 101 | }; 102 | 103 | /** 104 | * Writes a payload of messages 105 | * 106 | * @api private 107 | */ 108 | 109 | HTTPTransport.prototype.payload = function (msgs) { 110 | this.write(parser.encodePayload(msgs)); 111 | }; 112 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Export transports. 4 | */ 5 | 6 | module.exports = { 7 | websocket: require('./websocket') 8 | , flashsocket: require('./flashsocket') 9 | , htmlfile: require('./htmlfile') 10 | , 'xhr-polling': require('./xhr-polling') 11 | , 'jsonp-polling': require('./jsonp-polling') 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/jsonp-polling.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var HTTPPolling = require('./http-polling'); 13 | 14 | /** 15 | * Export the constructor. 16 | */ 17 | 18 | exports = module.exports = JSONPPolling; 19 | 20 | /** 21 | * JSON-P polling transport. 22 | * 23 | * @api public 24 | */ 25 | 26 | function JSONPPolling (mng, data, req) { 27 | HTTPPolling.call(this, mng, data, req); 28 | 29 | this.head = 'io.j[0]('; 30 | this.foot = ');'; 31 | 32 | if (data.query.i) { 33 | this.head = 'io.j[' + data.query.i + ']('; 34 | } 35 | }; 36 | 37 | /** 38 | * Inherits from Transport. 39 | */ 40 | 41 | JSONPPolling.prototype.__proto__ = HTTPPolling.prototype; 42 | 43 | /** 44 | * Transport name 45 | * 46 | * @api public 47 | */ 48 | 49 | JSONPPolling.prototype.name = 'jsonppolling'; 50 | 51 | /** 52 | * Make sure POST are decoded. 53 | */ 54 | 55 | JSONPPolling.prototype.postEncoded = true; 56 | 57 | /** 58 | * Handles incoming data. 59 | * Due to a bug in \n handling by browsers, we expect a JSONified string. 60 | * 61 | * @api private 62 | */ 63 | 64 | JSONPPolling.prototype.onData = function (data) { 65 | try { 66 | data = JSON.parse(data); 67 | } catch (e) { 68 | this.error('parse', 'reconnect'); 69 | return; 70 | } 71 | 72 | HTTPPolling.prototype.onData.call(this, data); 73 | }; 74 | 75 | /** 76 | * Performs the write. 77 | * 78 | * @api private 79 | */ 80 | 81 | JSONPPolling.prototype.doWrite = function (data) { 82 | HTTPPolling.prototype.doWrite.call(this); 83 | 84 | var data = data === undefined 85 | ? '' : this.head + JSON.stringify(data) + this.foot; 86 | 87 | this.response.writeHead(200, { 88 | 'Content-Type': 'text/javascript; charset=UTF-8' 89 | , 'Content-Length': Buffer.byteLength(data) 90 | , 'Connection': 'Keep-Alive' 91 | , 'X-XSS-Protection': '0' 92 | }); 93 | 94 | this.response.write(data); 95 | this.log.debug(this.name + ' writing', data); 96 | }; 97 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/websocket.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var protocolVersions = require('./websocket/'); 13 | 14 | /** 15 | * Export the constructor. 16 | */ 17 | 18 | exports = module.exports = WebSocket; 19 | 20 | /** 21 | * HTTP interface constructor. Interface compatible with all transports that 22 | * depend on request-response cycles. 23 | * 24 | * @api public 25 | */ 26 | 27 | function WebSocket (mng, data, req) { 28 | var transport 29 | , version = req.headers['sec-websocket-version']; 30 | if (typeof version !== 'undefined' && typeof protocolVersions[version] !== 'undefined') { 31 | transport = new protocolVersions[version](mng, data, req); 32 | } 33 | else transport = new protocolVersions['default'](mng, data, req); 34 | if (typeof this.name !== 'undefined') transport.name = this.name; 35 | return transport; 36 | }; 37 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/websocket/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Export websocket versions. 4 | */ 5 | 6 | module.exports = { 7 | 7: require('./hybi-07-12'), 8 | 8: require('./hybi-07-12'), 9 | 13: require('./hybi-16'), 10 | default: require('./default') 11 | }; 12 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/transports/xhr-polling.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var HTTPPolling = require('./http-polling'); 13 | 14 | /** 15 | * Export the constructor. 16 | */ 17 | 18 | exports = module.exports = XHRPolling; 19 | 20 | /** 21 | * Ajax polling transport. 22 | * 23 | * @api public 24 | */ 25 | 26 | function XHRPolling (mng, data, req) { 27 | HTTPPolling.call(this, mng, data, req); 28 | }; 29 | 30 | /** 31 | * Inherits from Transport. 32 | */ 33 | 34 | XHRPolling.prototype.__proto__ = HTTPPolling.prototype; 35 | 36 | /** 37 | * Transport name 38 | * 39 | * @api public 40 | */ 41 | 42 | XHRPolling.prototype.name = 'xhr-polling'; 43 | 44 | /** 45 | * Frames data prior to write. 46 | * 47 | * @api private 48 | */ 49 | 50 | XHRPolling.prototype.doWrite = function (data) { 51 | HTTPPolling.prototype.doWrite.call(this); 52 | 53 | var origin = this.req.headers.origin 54 | , headers = { 55 | 'Content-Type': 'text/plain; charset=UTF-8' 56 | , 'Content-Length': data === undefined ? 0 : Buffer.byteLength(data) 57 | , 'Connection': 'Keep-Alive' 58 | }; 59 | 60 | if (origin) { 61 | // https://developer.mozilla.org/En/HTTP_Access_Control 62 | headers['Access-Control-Allow-Origin'] = '*'; 63 | 64 | if (this.req.headers.cookie) { 65 | headers['Access-Control-Allow-Credentials'] = 'true'; 66 | } 67 | } 68 | 69 | this.response.writeHead(200, headers); 70 | this.response.write(data); 71 | this.log.debug(this.name + ' writing', data); 72 | }; 73 | -------------------------------------------------------------------------------- /node_modules/socket.io/lib/util.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | /** 13 | * Converts an enumerable to an array. 14 | * 15 | * @api public 16 | */ 17 | 18 | exports.toArray = function (enu) { 19 | var arr = []; 20 | 21 | for (var i = 0, l = enu.length; i < l; i++) 22 | arr.push(enu[i]); 23 | 24 | return arr; 25 | }; 26 | 27 | /** 28 | * Unpacks a buffer to a number. 29 | * 30 | * @api public 31 | */ 32 | 33 | exports.unpack = function (buffer) { 34 | var n = 0; 35 | for (var i = 0; i < buffer.length; ++i) { 36 | n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; 37 | } 38 | return n; 39 | } 40 | 41 | /** 42 | * Left pads a string. 43 | * 44 | * @api public 45 | */ 46 | 47 | exports.padl = function (s,n,c) { 48 | return new Array(1 + n - s.length).join(c) + s; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /node_modules/socket.io/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "socket.io" 3 | , "version": "0.8.7" 4 | , "description": "Real-time apps made cross-browser & easy with a WebSocket-like API" 5 | , "homepage": "http://socket.io" 6 | , "keywords": ["websocket", "socket", "realtime", "socket.io", "comet", "ajax"] 7 | , "author": "Guillermo Rauch " 8 | , "contributors": [ 9 | { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } 10 | , { "name": "Arnout Kazemier", "email": "info@3rd-eden.com" } 11 | , { "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" } 12 | , { "name": "Einar Otto Stangvik", "email": "einaros@gmail.com" } 13 | ] 14 | , "repository":{ 15 | "type": "git" 16 | , "url": "https://github.com/LearnBoost/socket.io.git" 17 | } 18 | , "dependencies": { 19 | "socket.io-client": "0.8.7" 20 | , "policyfile": "0.0.4" 21 | , "redis": "0.6.7" 22 | } 23 | , "devDependencies": { 24 | "expresso": "0.9.2" 25 | , "should": "0.0.4" 26 | , "assertvanish": "0.0.3-1" 27 | , "benchmark": "0.2.2" 28 | , "microtime": "0.1.3-1" 29 | , "colors": "0.5.1" 30 | } 31 | , "main": "index" 32 | , "engines": { "node": ">= 0.4.0" } 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Peter Griess 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of node-websocket-client nor the names of its 15 | contributors may be used to endorse or promote products derived from this 16 | software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/Makefile: -------------------------------------------------------------------------------- 1 | # This makefile exists to help run tests. 2 | # 3 | # If TEST_UNIX is a non-empty value, runs tests for UNIX sockets. This 4 | # functionality is not in node-websocket-server at the moment. 5 | 6 | .PHONY: test 7 | 8 | all: test test-unix 9 | 10 | test: 11 | for f in `ls -1 test/test-*.js | grep -v unix` ; do \ 12 | echo $$f ; \ 13 | node $$f ; \ 14 | done 15 | 16 | test-unix: 17 | if [[ -n "$$TEST_UNIX" ]] ; then \ 18 | for f in `ls -1 test/test-*.js | grep unix` ; do \ 19 | echo $$f ; \ 20 | node $$f ; \ 21 | done \ 22 | fi 23 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/README.md: -------------------------------------------------------------------------------- 1 | A prototype [Web Socket](http://www.whatwg.org/specs/web-socket-protocol/) 2 | client implementation for [node.js](http://nodejs.org). 3 | 4 | Tested with 5 | [miksago/node-websocket-server](http://github.com/miksago/node-websocket-server) 6 | v1.2.00. 7 | 8 | Requires [nodejs](http://nodejs.org) 0.1.98 or later. 9 | 10 | ## Installation 11 | 12 | Install this using `npm` as follows 13 | 14 | npm install websocket-client 15 | 16 | ... or just dump `lib/websocket.js` in your `$NODE_PATH`. 17 | 18 | ## Usage 19 | 20 | var sys = require('sys'); 21 | var WebSocket = require('websocket').WebSocket; 22 | 23 | var ws = new WebSocket('ws://localhost:8000/biff', 'borf'); 24 | ws.addListener('data', function(buf) { 25 | sys.debug('Got data: ' + sys.inspect(buf)); 26 | }); 27 | ws.onmessage = function(m) { 28 | sys.debug('Got message: ' + m); 29 | } 30 | 31 | ## API 32 | 33 | This supports the `send()` and `onmessage()` APIs. The `WebSocket` object will 34 | also emit `data` events that are node `Buffer` objects, in case you want to 35 | work with something lower-level than strings. 36 | 37 | ## Transports 38 | 39 | Multiple transports are supported, indicated by the scheme provided to the 40 | `WebSocket` constructor. `ws://` is a standard TCP-based Web Socket; 41 | `ws+unix://` allows connection to a UNIX socket at the given path. 42 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/examples/client-unix.js: -------------------------------------------------------------------------------- 1 | var sys = require('sys'); 2 | var WebSocket = require('../lib/websocket').WebSocket; 3 | 4 | var ws = new WebSocket('ws+unix://' + process.argv[2], 'boffo'); 5 | 6 | ws.addListener('message', function(d) { 7 | sys.debug('Received message: ' + d.toString('utf8')); 8 | }); 9 | 10 | ws.addListener('open', function() { 11 | ws.send('This is a message', 1); 12 | }); 13 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/examples/client.js: -------------------------------------------------------------------------------- 1 | var sys = require('sys'); 2 | var WebSocket = require('../lib/websocket').WebSocket; 3 | 4 | var ws = new WebSocket('ws://localhost:8000/biff', 'borf'); 5 | ws.addListener('data', function(buf) { 6 | sys.debug('Got data: ' + sys.inspect(buf)); 7 | }); 8 | ws.onmessage = function(m) { 9 | sys.debug('Got message: ' + m); 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/examples/server-unix.js: -------------------------------------------------------------------------------- 1 | var sys = require('sys'); 2 | var ws = require('websocket-server/ws'); 3 | 4 | var srv = ws.createServer({ debug : true}); 5 | srv.addListener('connection', function(s) { 6 | sys.debug('Got a connection!'); 7 | 8 | s._req.socket.addListener('fd', function(fd) { 9 | sys.debug('Got an fd: ' + fd); 10 | }); 11 | }); 12 | 13 | srv.listen(process.argv[2]); 14 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "websocket-client", 3 | "version" : "1.0.0", 4 | "description" : "An HTML5 Web Sockets client", 5 | "author" : "Peter Griess ", 6 | "engines" : { 7 | "node" : ">=0.1.98" 8 | }, 9 | "repositories" : [ 10 | { 11 | "type" : "git", 12 | "url" : "http://github.com/pgriess/node-websocket-client.git" 13 | } 14 | ], 15 | "licenses" : [ 16 | { 17 | "type" : "BSD", 18 | "url" : "http://github.com/pgriess/node-websocket-client/blob/master/LICENSE" 19 | } 20 | ], 21 | "main" : "./lib/websocket" 22 | } 23 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-basic.js: -------------------------------------------------------------------------------- 1 | // Verify that we can connect to a WebSocket server, exchange messages, and 2 | // shut down cleanly. 3 | 4 | var assert = require('assert'); 5 | var WebSocket = require('../lib/websocket').WebSocket; 6 | var WebSocketServer = require('websocket-server/ws/server').Server; 7 | 8 | var PORT = 1024 + Math.floor(Math.random() * 4096); 9 | var C_MSG = 'Client test: ' + (Math.random() * 100); 10 | var S_MSG = 'Server test: ' + (Math.random() * 100); 11 | 12 | var serverGotConnection = false; 13 | var clientGotOpen = false; 14 | var clientGotData = false; 15 | var clientGotMessage = false; 16 | var serverGotMessage = false; 17 | var serverGotClose = false; 18 | var clientGotClose = false; 19 | 20 | var wss = new WebSocketServer(); 21 | wss.listen(PORT, 'localhost'); 22 | wss.on('connection', function(c) { 23 | serverGotConnection = true; 24 | 25 | c.on('message', function(m) { 26 | assert.equal(m, C_MSG); 27 | serverGotMessage = true; 28 | 29 | c.close(); 30 | }); 31 | 32 | c.on('close', function() { 33 | serverGotClose = true; 34 | wss.close(); 35 | }); 36 | 37 | c.write(S_MSG); 38 | }); 39 | 40 | var ws = new WebSocket('ws://localhost:' + PORT + '/', 'biff'); 41 | ws.on('open', function() { 42 | clientGotOpen = true; 43 | }); 44 | ws.on('data', function(buf) { 45 | assert.equal(typeof buf, 'object'); 46 | assert.equal(buf.toString('utf8'), S_MSG); 47 | 48 | clientGotData = true; 49 | 50 | ws.send(C_MSG); 51 | }); 52 | ws.onmessage = function(m) { 53 | assert.deepEqual(m, {data : S_MSG}); 54 | clientGotMessage = true; 55 | }; 56 | ws.onclose = function() { 57 | clientGotClose = true; 58 | }; 59 | 60 | process.on('exit', function() { 61 | assert.ok(serverGotConnection); 62 | assert.ok(clientGotOpen); 63 | assert.ok(clientGotData); 64 | assert.ok(clientGotMessage); 65 | assert.ok(serverGotMessage); 66 | assert.ok(serverGotClose); 67 | assert.ok(clientGotClose); 68 | }); 69 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-client-close.js: -------------------------------------------------------------------------------- 1 | // Verify that a connection can be closed gracefully from the client. 2 | 3 | var assert = require('assert'); 4 | var WebSocket = require('../lib/websocket').WebSocket; 5 | var WebSocketServer = require('websocket-server/ws/server').Server; 6 | 7 | var PORT = 1024 + Math.floor(Math.random() * 4096); 8 | var C_MSG = 'Client test: ' + (Math.random() * 100); 9 | 10 | var serverGotClientMessage = false; 11 | var clientGotServerClose = false; 12 | var serverGotClientClose = false; 13 | 14 | var wss = new WebSocketServer(); 15 | wss.listen(PORT, 'localhost'); 16 | wss.on('connection', function(c) { 17 | c.on('message', function(m) { 18 | assert.equal(m, C_MSG); 19 | serverGotClientMessage = true; 20 | }); 21 | c.on('close', function() { 22 | serverGotClientClose = true; 23 | wss.close(); 24 | }); 25 | }); 26 | 27 | var ws = new WebSocket('ws://localhost:' + PORT); 28 | ws.onopen = function() { 29 | ws.send(C_MSG); 30 | 31 | // XXX: Add a timeout here 32 | ws.close(5); 33 | }; 34 | ws.onclose = function() { 35 | assert.equal(ws.CLOSED, ws.readyState); 36 | clientGotServerClose = true; 37 | }; 38 | 39 | process.on('exit', function() { 40 | assert.ok(serverGotClientMessage); 41 | assert.ok(clientGotServerClose); 42 | assert.ok(serverGotClientClose); 43 | }); 44 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-readonly-attrs.js: -------------------------------------------------------------------------------- 1 | // Verify that some attributes of a WebSocket object are read-only. 2 | 3 | var assert = require('assert'); 4 | var sys = require('sys'); 5 | var WebSocket = require('../lib/websocket').WebSocket; 6 | var WebSocketServer = require('websocket-server/ws/server').Server; 7 | 8 | var PORT = 1024 + Math.floor(Math.random() * 4096); 9 | 10 | var wss = new WebSocketServer(); 11 | wss.listen(PORT, 'localhost'); 12 | wss.on('connection', function(c) { 13 | c.close(); 14 | wss.close(); 15 | }); 16 | var ws = new WebSocket('ws://localhost:' + PORT + '/', 'biff'); 17 | ws.on('open', function() { 18 | assert.equal(ws.CONNECTING, 0); 19 | try { 20 | ws.CONNECTING = 13; 21 | assert.equal( 22 | ws.CONNECTING, 0, 23 | 'Should not have been able to set read-only CONNECTING attribute' 24 | ); 25 | } catch (e) { 26 | assert.equal(e.type, 'no_setter_in_callback'); 27 | } 28 | 29 | assert.equal(ws.OPEN, 1); 30 | assert.equal(ws.CLOSING, 2); 31 | assert.equal(ws.CLOSED, 3); 32 | 33 | assert.equal(ws.url, 'ws://localhost:' + PORT + '/'); 34 | try { 35 | ws.url = 'foobar'; 36 | assert.equal( 37 | ws.url, 'ws://localhost:' + PORT + '/', 38 | 'Should not have been able to set read-only url attribute' 39 | ); 40 | } catch (e) { 41 | assert.equal(e.type, 'no_setter_in_callback'); 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-ready-state.js: -------------------------------------------------------------------------------- 1 | // Verify that readyState transitions are implemented correctly 2 | 3 | var assert = require('assert'); 4 | var WebSocket = require('../lib/websocket').WebSocket; 5 | var WebSocketServer = require('websocket-server/ws/server').Server; 6 | 7 | var PORT = 1024 + Math.floor(Math.random() * 4096); 8 | 9 | var wss = new WebSocketServer(); 10 | wss.listen(PORT, 'localhost'); 11 | wss.on('connection', function(c) { 12 | c.close(); 13 | }); 14 | 15 | var ws = new WebSocket('ws://localhost:' + PORT); 16 | assert.equal(ws.readyState, ws.CONNECTING); 17 | ws.onopen = function() { 18 | assert.equal(ws.readyState, ws.OPEN); 19 | 20 | ws.close(); 21 | assert.ok(ws.readyState == ws.CLOSING); 22 | }; 23 | ws.onclose = function() { 24 | assert.equal(ws.readyState, ws.CLOSED); 25 | wss.close(); 26 | }; 27 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-server-close.js: -------------------------------------------------------------------------------- 1 | // Verify that a connection can be closed gracefully from the server. 2 | 3 | var assert = require('assert'); 4 | var WebSocket = require('../lib/websocket').WebSocket; 5 | var WebSocketServer = require('websocket-server/ws/server').Server; 6 | 7 | var PORT = 1024 + Math.floor(Math.random() * 4096); 8 | var S_MSG = 'Server test: ' + (Math.random() * 100); 9 | 10 | var clientGotServerMessage = false; 11 | var clientGotServerClose = false; 12 | var serverGotClientClose = false; 13 | 14 | var wss = new WebSocketServer(); 15 | wss.listen(PORT, 'localhost'); 16 | wss.on('connection', function(c) { 17 | c.on('close', function() { 18 | serverGotClientClose = true; 19 | wss.close(); 20 | }); 21 | 22 | c.write(S_MSG); 23 | c.close(); 24 | }); 25 | 26 | var ws = new WebSocket('ws://localhost:' + PORT); 27 | ws.onmessage = function(m) { 28 | assert.deepEqual(m, {data: S_MSG}); 29 | 30 | clientGotServerMessage = true; 31 | }; 32 | ws.onclose = function() { 33 | assert.equal(ws.CLOSED, ws.readyState); 34 | clientGotServerClose = true; 35 | }; 36 | 37 | process.on('exit', function() { 38 | assert.ok(clientGotServerMessage); 39 | assert.ok(clientGotServerClose); 40 | assert.ok(serverGotClientClose); 41 | }); 42 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-unix-send-fd.js: -------------------------------------------------------------------------------- 1 | // Verify that both sides of the WS connection can both send and receive file 2 | // descriptors. 3 | 4 | var assert = require('assert'); 5 | var fs = require('fs'); 6 | var path = require('path'); 7 | var sys = require('sys'); 8 | var WebSocket = require('../lib/websocket').WebSocket; 9 | var WebSocketServer = require('websocket-server/ws/server').Server; 10 | 11 | var PATH = path.join(__dirname, 'sock.' + process.pid); 12 | var C_MSG = 'Client test: ' + (Math.random() * 100); 13 | var S_MSG = 'Server test: ' + (Math.random() * 100); 14 | 15 | var clientReceivedData = false; 16 | var clientReceivedFD = false; 17 | var serverReceivedData = false; 18 | var serverReceivedFD = false; 19 | 20 | var wss = new WebSocketServer(); 21 | wss.on('listening', function() { 22 | var ws = new WebSocket('ws+unix://' + PATH); 23 | ws.on('data', function(d) { 24 | assert.equal(d.toString('utf8'), S_MSG); 25 | 26 | clientReceivedData = true; 27 | 28 | ws.send(C_MSG, 1); 29 | ws.close(); 30 | }); 31 | ws.on('fd', function(fd) { 32 | assert.ok(fd >= 0); 33 | 34 | clientReceivedFD = true; 35 | }); 36 | }); 37 | wss.on('connection', function(c) { 38 | c.write(S_MSG, 0); 39 | c._req.socket.on('fd', function(fd) { 40 | assert.ok(fd >= 0); 41 | 42 | serverReceivedFD = true; 43 | }); 44 | c.on('message', function(d) { 45 | assert.equal(d, C_MSG); 46 | 47 | serverReceivedData = true; 48 | 49 | wss.close(); 50 | }); 51 | }); 52 | wss.listen(PATH); 53 | 54 | process.on('exit', function() { 55 | assert.ok(clientReceivedFD); 56 | assert.ok(clientReceivedData); 57 | assert.ok(serverReceivedFD); 58 | assert.ok(serverReceivedData); 59 | 60 | try { 61 | fs.unlinkSync(PATH); 62 | } catch (e) { } 63 | }); 64 | -------------------------------------------------------------------------------- /node_modules/socket.io/support/node-websocket-client/test/test-unix-sockets.js: -------------------------------------------------------------------------------- 1 | // Verify that we can connect to a server over UNIX domain sockets. 2 | 3 | var assert = require('assert'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var sys = require('sys'); 7 | var WebSocket = require('../lib/websocket').WebSocket; 8 | var WebSocketServer = require('websocket-server/ws/server').Server; 9 | 10 | var PATH = path.join(__dirname, 'sock.' + process.pid); 11 | var S_MSG = 'Server test: ' + (Math.random() * 100); 12 | 13 | var serverGotConnection = false; 14 | var clientGotOpen = false; 15 | var clientGotData = false; 16 | 17 | var wss = new WebSocketServer(); 18 | wss.on('listening', function() { 19 | var ws = new WebSocket('ws+unix://' + PATH); 20 | ws.on('open', function() { 21 | clientGotOpen = true; 22 | 23 | ws.close(); 24 | }); 25 | ws.on('data', function(d) { 26 | assert.equal(d.toString('utf8'), S_MSG); 27 | clientGotData = true; 28 | }); 29 | }); 30 | wss.on('connection', function(c) { 31 | serverGotConnection = true; 32 | 33 | c.write(S_MSG); 34 | wss.close(); 35 | }); 36 | wss.listen(PATH); 37 | 38 | process.on('exit', function() { 39 | assert.ok(serverGotConnection); 40 | assert.ok(clientGotOpen); 41 | assert.ok(clientGotData); 42 | 43 | try { 44 | fs.unlinkSync(PATH); 45 | } catch(e) { } 46 | }); 47 | -------------------------------------------------------------------------------- /node_modules/socket.io/test/fixtures/cert.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDXTCCAkWgAwIBAgIJAMUSOvlaeyQHMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV 3 | BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQwHhcNMTAxMTE2MDkzMjQ5WhcNMTMxMTE1MDkzMjQ5WjBF 5 | MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 6 | ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB 7 | CgKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEVwfPQQp4X 8 | wtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+1FAE0c5o 9 | exPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404WthquTqg 10 | S7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy25IyBK3QJ 11 | c+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWAQsqW+COL 12 | 0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABo1AwTjAdBgNVHQ4EFgQUDnV4d6mD 13 | tOnluLoCjkUHTX/n4agwHwYDVR0jBBgwFoAUDnV4d6mDtOnluLoCjkUHTX/n4agw 14 | DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAFwV4MQfTo+qMv9JMiyno 15 | IEiqfOz4RgtmBqRnXUffcjS2dhc7/z+FPZnM79Kej8eLHoVfxCyWRHFlzm93vEdv 16 | wxOCrD13EDOi08OOZfxWyIlCa6Bg8cMAKqQzd2OvQOWqlRWBTThBJIhWflU33izX 17 | Qn5GdmYqhfpc+9ZHHGhvXNydtRQkdxVK2dZNzLBvBlLlRmtoClU7xm3A+/5dddeP 18 | AQHEPtyFlUw49VYtZ3ru6KqPms7MKvcRhYLsy9rwSfuuniMlx4d0bDR7TOkw0QQS 19 | A0N8MGQRQpzl4mw4jLzyM5d5QtuGBh2P6hPGa0YQxtI3RPT/p6ENzzBiAKXiSfzo 20 | xw== 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /node_modules/socket.io/test/fixtures/key.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEV 3 | wfPQQp4XwtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+ 4 | 1FAE0c5oexPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404 5 | WthquTqgS7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy2 6 | 5IyBK3QJc+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWA 7 | QsqW+COL0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABAoIBAGe4+9VqZfJN+dsq 8 | 8Osyuz01uQ8OmC0sAWTIqUlQgENIyf9rCJsUBlYmwR5BT6Z69XP6QhHdpSK+TiAR 9 | XUz0EqG9HYzcxHIBaACP7j6iRoQ8R4kbbiWKo0z3WqQGIOqFjvD/mKEuQdE5mEYw 10 | eOUCG6BnX1WY2Yr8WKd2AA/tp0/Y4d8z04u9eodMpSTbHTzYMJb5SbBN1vo6FY7q 11 | 8zSuO0BMzXlAxUsCwHsk1GQHFr8Oh3zIR7bQGtMBouI+6Lhh7sjFYsfxJboqMTBV 12 | IKaA216M6ggHG7MU1/jeKcMGDmEfqQLQoyWp29rMK6TklUgipME2L3UD7vTyAVzz 13 | xbVOpZkCgYEA8CXW4sZBBrSSrLR5SB+Ubu9qNTggLowOsC/kVKB2WJ4+xooc5HQo 14 | mFhq1v/WxPQoWIxdYsfg2odlL+JclK5Qcy6vXmRSdAQ5lK9gBDKxZSYc3NwAw2HA 15 | zyHCTK+I0n8PBYQ+yGcrxu0WqTGnlLW+Otk4CejO34WlgHwbH9bbY5UCgYEA3ZvT 16 | C4+OoMHXlmICSt29zUrYiL33IWsR3/MaONxTEDuvgkOSXXQOl/8Ebd6Nu+3WbsSN 17 | bjiPC/JyL1YCVmijdvFpl4gjtgvfJifs4G+QHvO6YfsYoVANk4u6g6rUuBIOwNK4 18 | RwYxwDc0oysp+g7tPxoSgDHReEVKJNzGBe9NGGsCgYEA4O4QP4gCEA3B9BF2J5+s 19 | n9uPVxmiyvZUK6Iv8zP4pThTBBMIzNIf09G9AHPQ7djikU2nioY8jXKTzC3xGTHM 20 | GJZ5m6fLsu7iH+nDvSreDSeNkTBfZqGAvoGYQ8uGE+L+ZuRfCcXYsxIOT5s6o4c3 21 | Dle2rVFpsuKzCY00urW796ECgYBn3go75+xEwrYGQSer6WR1nTgCV29GVYXKPooy 22 | zmmMOT1Yw80NSkEw0pFD4cTyqVYREsTrPU0mn1sPfrOXxnGfZSVFpcR/Je9QVfQ7 23 | eW7GYxwfom335aqHVj10SxRqteP+UoWWnHujCPz94VRKZMakBddYCIGSan+G6YdS 24 | 7sdmwwKBgBc2qj0wvGXDF2kCLwSGfWoMf8CS1+5fIiUIdT1e/+7MfDdbmLMIFVjF 25 | QKS3zVViXCbrG5SY6wS9hxoc57f6E2A8vcaX6zy2xkZlGHQCpWRtEM5R01OWJQaH 26 | HsHMmQZGUQVoDm1oRkDhrTFK4K3ukc3rAxzeTZ96utOQN8/KJsTv 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /node_modules/socket.io/test/hybi-common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns a Buffer from a "ff 00 ff"-type hex string. 3 | */ 4 | 5 | getBufferFromHexString = function(byteStr) { 6 | var bytes = byteStr.split(' '); 7 | var buf = new Buffer(bytes.length); 8 | for (var i = 0; i < bytes.length; ++i) { 9 | buf[i] = parseInt(bytes[i], 16); 10 | } 11 | return buf; 12 | } 13 | 14 | /** 15 | * Returns a hex string from a Buffer. 16 | */ 17 | 18 | getHexStringFromBuffer = function(data) { 19 | var s = ''; 20 | for (var i = 0; i < data.length; ++i) { 21 | s += padl(data[i].toString(16), 2, '0') + ' '; 22 | } 23 | return s.trim(); 24 | } 25 | 26 | /** 27 | * Splits a buffer in two parts. 28 | */ 29 | 30 | splitBuffer = function(buffer) { 31 | var b1 = new Buffer(Math.ceil(buffer.length / 2)); 32 | buffer.copy(b1, 0, 0, b1.length); 33 | var b2 = new Buffer(Math.floor(buffer.length / 2)); 34 | buffer.copy(b2, 0, b1.length, b1.length + b2.length); 35 | return [b1, b2]; 36 | } 37 | 38 | /** 39 | * Performs hybi07+ type masking on a hex string or buffer. 40 | */ 41 | 42 | mask = function(buf, maskString) { 43 | if (typeof buf == 'string') buf = new Buffer(buf); 44 | var mask = getBufferFromHexString(maskString || '34 83 a8 68'); 45 | for (var i = 0; i < buf.length; ++i) { 46 | buf[i] ^= mask[i % 4]; 47 | } 48 | return buf; 49 | } 50 | 51 | /** 52 | * Returns a hex string representing the length of a message 53 | */ 54 | 55 | getHybiLengthAsHexString = function(len, masked) { 56 | if (len < 126) { 57 | var buf = new Buffer(1); 58 | buf[0] = (masked ? 0x80 : 0) | len; 59 | } 60 | else if (len < 65536) { 61 | var buf = new Buffer(3); 62 | buf[0] = (masked ? 0x80 : 0) | 126; 63 | getBufferFromHexString(pack(4, len)).copy(buf, 1); 64 | } 65 | else { 66 | var buf = new Buffer(9); 67 | buf[0] = (masked ? 0x80 : 0) | 127; 68 | getBufferFromHexString(pack(16, len)).copy(buf, 1); 69 | } 70 | return getHexStringFromBuffer(buf); 71 | } 72 | 73 | /** 74 | * Unpacks a Buffer into a number. 75 | */ 76 | 77 | unpack = function(buffer) { 78 | var n = 0; 79 | for (var i = 0; i < buffer.length; ++i) { 80 | n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; 81 | } 82 | return n; 83 | } 84 | 85 | /** 86 | * Returns a hex string, representing a specific byte count 'length', from a number. 87 | */ 88 | 89 | pack = function(length, number) { 90 | return padl(number.toString(16), length, '0').replace(/(\d\d)/g, '$1 ').trim(); 91 | } 92 | 93 | /** 94 | * Left pads the string 's' to a total length of 'n' with char 'c'. 95 | */ 96 | 97 | padl = function(s, n, c) { 98 | return new Array(1 + n - s.length).join(c) + s; 99 | } 100 | -------------------------------------------------------------------------------- /node_modules/socket.io/test/io.test.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * socket.io-node 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Test dependencies. 10 | */ 11 | 12 | var sio = require('socket.io') 13 | , fs = require('fs') 14 | , http = require('http') 15 | , https = require('https') 16 | , should = require('./common') 17 | , ports = 15000; 18 | 19 | /** 20 | * Test. 21 | */ 22 | 23 | module.exports = { 24 | 25 | 'test that protocol version is present': function (done) { 26 | sio.protocol.should.be.a('number'); 27 | done(); 28 | }, 29 | 30 | 'test that default transports are present': function (done) { 31 | sio.Manager.defaultTransports.should.be.an.instanceof(Array); 32 | done(); 33 | }, 34 | 35 | 'test that version is present': function (done) { 36 | sio.version.should.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/); 37 | done(); 38 | }, 39 | 40 | 'test listening with a port': function (done) { 41 | var cl = client(++ports) 42 | , io = create(cl); 43 | 44 | io.server.should.be.an.instanceof(http.Server); 45 | 46 | cl.get('/', function (res, data) { 47 | res.statusCode.should.eql(200); 48 | data.should.eql('Welcome to socket.io.'); 49 | 50 | cl.end(); 51 | io.server.close(); 52 | done(); 53 | }); 54 | }, 55 | 56 | 'test listening with a server': function (done) { 57 | var server = http.createServer() 58 | , io = sio.listen(server) 59 | , port = ++ports 60 | , cl = client(port); 61 | 62 | server.listen(port); 63 | 64 | cl.get('/socket.io', function (res, data) { 65 | res.statusCode.should.eql(200); 66 | data.should.eql('Welcome to socket.io.'); 67 | 68 | cl.end(); 69 | server.close(); 70 | done(); 71 | }); 72 | }, 73 | 74 | 'test listening with a https server': function (done) { 75 | var server = https.createServer({ 76 | key: fs.readFileSync(__dirname + '/fixtures/key.key') 77 | , cert: fs.readFileSync(__dirname + '/fixtures/cert.crt') 78 | }, function () { }) 79 | , io = sio.listen(server) 80 | , port = ++ports; 81 | 82 | server.listen(port); 83 | 84 | var req = require('https').get({ 85 | host: 'localhost' 86 | , port: port 87 | , path: '/socket.io' 88 | }, function (res) { 89 | res.statusCode.should.eql(200); 90 | 91 | var buf = ''; 92 | 93 | res.on('data', function (data) { 94 | buf += data; 95 | }); 96 | 97 | res.on('end', function () { 98 | buf.should.eql('Welcome to socket.io.'); 99 | 100 | res.socket.end(); 101 | server.close(); 102 | done(); 103 | }); 104 | }); 105 | }, 106 | 107 | 'test listening with no arguments listens on 80': function (done) { 108 | try { 109 | var io = sio.listen() 110 | , cl = client(80); 111 | 112 | cl.get('/socket.io', function (res) { 113 | res.statusCode.should.eql(200); 114 | 115 | cl.end(); 116 | io.server.close(); 117 | done(); 118 | }); 119 | done(); 120 | } catch (e) { 121 | e.should.match(/EACCES/); 122 | done(); 123 | } 124 | } 125 | }; 126 | -------------------------------------------------------------------------------- /node_modules/socket.io/test/leaks/socket.leaktest.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * socket.io-node 3 | * Copyright(c) 2011 LearnBoost 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Test dependencies. 9 | */ 10 | 11 | require.paths.unshift(__dirname + '/../../lib'); 12 | 13 | var assertvanish = require('assertvanish') 14 | , common = require('../common') 15 | , ports = 15800; 16 | 17 | function resultCallback (leaks, leakedSocket) { 18 | if (leaks) { 19 | console.error('Leak detected'); 20 | process.exit(1); 21 | } else { 22 | console.error('No leaks'); 23 | process.exit(0); 24 | } 25 | }; 26 | 27 | /** 28 | * Test. 29 | */ 30 | 31 | var cl = client(++ports); 32 | var io = create(cl); 33 | 34 | io.sockets.on('connection', function (socket) { 35 | console.log('connected'); 36 | 37 | socket.on('disconnect', function() { 38 | console.log("client gone"); 39 | setTimeout(gc, 1000); 40 | assertvanish(socket, 2000, {silent: true, callback: resultCallback}); 41 | }); 42 | }); 43 | 44 | setTimeout(function() { 45 | cl.handshake(function (sid) { 46 | var ws = websocket(cl, sid); 47 | ws.on('open', function () { 48 | console.log('open!'); 49 | setTimeout(function() { 50 | ws.close(); 51 | }, 500); 52 | }); 53 | }); 54 | }, 100); 55 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intech/TicTacToe/5fa237980f4ca56581172aae562206cf51c5add7/preview.png -------------------------------------------------------------------------------- /public/ga.js: -------------------------------------------------------------------------------- 1 | try { 2 | var _gaq = _gaq || []; 3 | _gaq.push(['_setAccount', 'UA-27010709-1']); 4 | _gaq.push(['_trackPageview']); 5 | (function() { 6 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 7 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 8 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 9 | })(); 10 | (function() { 11 | var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 12 | po.src = 'https://apis.google.com/js/plusone.js'; 13 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 14 | window.___gcfg = { 15 | lang: 'ru', 16 | parsetags: 'onload' 17 | }; 18 | })(); 19 | } catch(err) {} -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Крестики-нолики 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 |
    Подключаемся к серверу...



    24 |
    Время до конца хода: 15 сек.
    25 |
    26 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /public/tictactoe.css: -------------------------------------------------------------------------------- 1 | #mask { 2 | position:absolute; 3 | z-index: 5; 4 | background-color: #000; 5 | width: 100%; 6 | height: 100%; 7 | overflow: hidden; 8 | display: none; 9 | } 10 | #masked, #timerpanel { 11 | vertical-align: middle; 12 | display: none; 13 | } 14 | #timer { 15 | font-weight: bold; 16 | color: red; 17 | font-size: 16px; 18 | vertical-align: middle; 19 | } 20 | #board {} 21 | #board-table td { 22 | height: 100px; 23 | width: 100px; 24 | text-align: center; 25 | vertical-align: middle; 26 | font-size: 42pt; 27 | font-weight: bold; 28 | font-family: Arial; 29 | cursor: pointer; 30 | } 31 | #play_again { 32 | display: block; 33 | font-size: 20px; 34 | } 35 | #status { 36 | padding: 10px; 37 | margin: 10px; 38 | } 39 | #stats { 40 | width: 320px; 41 | } 42 | #stats > div { 43 | width: 300px; 44 | padding: 3px; 45 | margin: 1px; 46 | } 47 | --------------------------------------------------------------------------------