summaryrefslogtreecommitdiff
path: root/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/.bin/express15
-rw-r--r--node_modules/.bin/express.cmd5
-rw-r--r--node_modules/.bin/wscat15
-rw-r--r--node_modules/.bin/wscat.cmd5
-rw-r--r--node_modules/ejs/.gitmodules0
-rw-r--r--node_modules/ejs/.npmignore4
-rw-r--r--node_modules/ejs/.travis.yml7
-rw-r--r--node_modules/ejs/History.md131
-rw-r--r--node_modules/ejs/Makefile23
-rw-r--r--node_modules/ejs/Readme.md188
-rw-r--r--node_modules/ejs/benchmark.js14
-rw-r--r--node_modules/ejs/ejs.js581
-rw-r--r--node_modules/ejs/ejs.min.js1
-rw-r--r--node_modules/ejs/examples/client.html24
-rw-r--r--node_modules/ejs/examples/functions.ejs9
-rw-r--r--node_modules/ejs/examples/functions.js22
-rw-r--r--node_modules/ejs/examples/list.ejs7
-rw-r--r--node_modules/ejs/examples/list.js14
-rw-r--r--node_modules/ejs/index.js2
-rw-r--r--node_modules/ejs/lib/ejs.js353
-rw-r--r--node_modules/ejs/lib/filters.js198
-rw-r--r--node_modules/ejs/lib/utils.js23
-rw-r--r--node_modules/ejs/package.json33
-rw-r--r--node_modules/ejs/support/compile.js176
-rw-r--r--node_modules/ejs/test/ejs.js265
-rw-r--r--node_modules/ejs/test/fixtures/backslash.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/backslash.html1
-rw-r--r--node_modules/ejs/test/fixtures/comments.ejs5
-rw-r--r--node_modules/ejs/test/fixtures/comments.html4
-rw-r--r--node_modules/ejs/test/fixtures/double-quote.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/double-quote.html1
-rw-r--r--node_modules/ejs/test/fixtures/error.ejs5
-rw-r--r--node_modules/ejs/test/fixtures/error.out8
-rw-r--r--node_modules/ejs/test/fixtures/fail.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/include.css.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/include.css.html3
-rw-r--r--node_modules/ejs/test/fixtures/include.ejs5
-rw-r--r--node_modules/ejs/test/fixtures/include.html9
-rw-r--r--node_modules/ejs/test/fixtures/includes/menu-item.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/includes/menu/item.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/menu.ejs11
-rw-r--r--node_modules/ejs/test/fixtures/menu.html3
-rw-r--r--node_modules/ejs/test/fixtures/messed.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/messed.html1
-rw-r--r--node_modules/ejs/test/fixtures/newlines.ejs5
-rw-r--r--node_modules/ejs/test/fixtures/newlines.html9
-rw-r--r--node_modules/ejs/test/fixtures/no.newlines.ejs5
-rw-r--r--node_modules/ejs/test/fixtures/no.newlines.html5
-rw-r--r--node_modules/ejs/test/fixtures/para.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/pet.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/single-quote.ejs1
-rw-r--r--node_modules/ejs/test/fixtures/single-quote.html1
-rw-r--r--node_modules/ejs/test/fixtures/style.css3
-rw-r--r--node_modules/ejs/test/fixtures/user.ejs1
-rw-r--r--node_modules/express/.npmignore9
-rw-r--r--node_modules/express/.travis.yml4
-rw-r--r--node_modules/express/History.md1183
-rw-r--r--node_modules/express/LICENSE22
-rw-r--r--node_modules/express/Makefile33
-rw-r--r--node_modules/express/Readme.md179
-rw-r--r--node_modules/express/bin/express422
-rw-r--r--node_modules/express/index.js4
-rw-r--r--node_modules/express/lib/application.js535
-rw-r--r--node_modules/express/lib/express.js86
-rw-r--r--node_modules/express/lib/middleware.js32
-rw-r--r--node_modules/express/lib/request.js526
-rw-r--r--node_modules/express/lib/response.js757
-rw-r--r--node_modules/express/lib/router/index.js273
-rw-r--r--node_modules/express/lib/router/route.js72
-rw-r--r--node_modules/express/lib/utils.js313
-rw-r--r--node_modules/express/lib/view.js77
-rw-r--r--node_modules/express/node_modules/buffer-crc32/.npmignore1
-rw-r--r--node_modules/express/node_modules/buffer-crc32/.travis.yml8
-rw-r--r--node_modules/express/node_modules/buffer-crc32/README.md47
-rw-r--r--node_modules/express/node_modules/buffer-crc32/index.js88
-rw-r--r--node_modules/express/node_modules/buffer-crc32/package.json43
-rw-r--r--node_modules/express/node_modules/buffer-crc32/tests/crc.test.js89
-rw-r--r--node_modules/express/node_modules/commander/History.md158
-rw-r--r--node_modules/express/node_modules/commander/Readme.md276
-rw-r--r--node_modules/express/node_modules/commander/index.js1152
-rw-r--r--node_modules/express/node_modules/commander/node_modules/keypress/README.md101
-rw-r--r--node_modules/express/node_modules/commander/node_modules/keypress/index.js346
-rw-r--r--node_modules/express/node_modules/commander/node_modules/keypress/package.json35
-rw-r--r--node_modules/express/node_modules/commander/node_modules/keypress/test.js28
-rw-r--r--node_modules/express/node_modules/commander/package.json44
-rw-r--r--node_modules/express/node_modules/connect/.npmignore12
-rw-r--r--node_modules/express/node_modules/connect/.travis.yml4
-rw-r--r--node_modules/express/node_modules/connect/LICENSE24
-rw-r--r--node_modules/express/node_modules/connect/Readme.md133
-rw-r--r--node_modules/express/node_modules/connect/index.js4
-rw-r--r--node_modules/express/node_modules/connect/lib/cache.js81
-rw-r--r--node_modules/express/node_modules/connect/lib/connect.js92
-rw-r--r--node_modules/express/node_modules/connect/lib/index.js50
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/basicAuth.js103
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/bodyParser.js61
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/compress.js189
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/cookieParser.js62
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/cookieSession.js115
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/csrf.js75
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/directory.js229
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/errorHandler.js86
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/favicon.js80
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/json.js89
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/limit.js78
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/logger.js339
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/methodOverride.js59
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/multipart.js133
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/query.js46
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/responseTime.js32
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/session.js355
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/session/cookie.js140
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/session/memory.js129
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/session/session.js116
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/session/store.js84
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/static.js95
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/staticCache.js231
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/timeout.js55
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/urlencoded.js78
-rw-r--r--node_modules/express/node_modules/connect/lib/middleware/vhost.js40
-rw-r--r--node_modules/express/node_modules/connect/lib/patch.js79
-rw-r--r--node_modules/express/node_modules/connect/lib/proto.js230
-rw-r--r--node_modules/express/node_modules/connect/lib/public/directory.html81
-rw-r--r--node_modules/express/node_modules/connect/lib/public/error.html14
-rw-r--r--node_modules/express/node_modules/connect/lib/public/favicon.icobin0 -> 1406 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page.pngbin0 -> 635 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_add.pngbin0 -> 739 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_attach.pngbin0 -> 794 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_code.pngbin0 -> 818 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_copy.pngbin0 -> 663 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_delete.pngbin0 -> 740 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_edit.pngbin0 -> 807 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_error.pngbin0 -> 793 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_excel.pngbin0 -> 817 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_find.pngbin0 -> 879 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_gear.pngbin0 -> 833 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_go.pngbin0 -> 779 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_green.pngbin0 -> 621 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_key.pngbin0 -> 801 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_lightning.pngbin0 -> 839 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_link.pngbin0 -> 830 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.pngbin0 -> 813 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_paste.pngbin0 -> 703 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_red.pngbin0 -> 641 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_refresh.pngbin0 -> 858 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_save.pngbin0 -> 774 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white.pngbin0 -> 294 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.pngbin0 -> 591 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.pngbin0 -> 664 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_add.pngbin0 -> 512 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_c.pngbin0 -> 587 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.pngbin0 -> 656 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.pngbin0 -> 666 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_code.pngbin0 -> 603 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.pngbin0 -> 587 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.pngbin0 -> 592 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.pngbin0 -> 724 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.pngbin0 -> 309 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.pngbin0 -> 621 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.pngbin0 -> 700 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.pngbin0 -> 639 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_database.pngbin0 -> 579 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.pngbin0 -> 536 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.pngbin0 -> 638 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.pngbin0 -> 618 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_error.pngbin0 -> 623 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.pngbin0 -> 663 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_find.pngbin0 -> 676 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.pngbin0 -> 582 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.pngbin0 -> 639 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.pngbin0 -> 402 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_get.pngbin0 -> 516 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_go.pngbin0 -> 612 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_h.pngbin0 -> 603 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.pngbin0 -> 296 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_key.pngbin0 -> 616 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.pngbin0 -> 669 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_link.pngbin0 -> 614 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.pngbin0 -> 554 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.pngbin0 -> 706 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_office.pngbin0 -> 779 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.pngbin0 -> 688 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.pngbin0 -> 618 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.pngbin0 -> 620 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_php.pngbin0 -> 538 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.pngbin0 -> 650 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.pngbin0 -> 588 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_put.pngbin0 -> 523 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.pngbin0 -> 626 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.pngbin0 -> 317 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_star.pngbin0 -> 565 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.pngbin0 -> 634 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_text.pngbin0 -> 342 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.pngbin0 -> 315 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.pngbin0 -> 668 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.pngbin0 -> 644 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.pngbin0 -> 702 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_width.pngbin0 -> 309 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_word.pngbin0 -> 651 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_world.pngbin0 -> 734 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.pngbin0 -> 613 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.pngbin0 -> 386 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_word.pngbin0 -> 777 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/icons/page_world.pngbin0 -> 903 bytes
-rw-r--r--node_modules/express/node_modules/connect/lib/public/style.css141
-rw-r--r--node_modules/express/node_modules/connect/lib/utils.js386
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/.npmignore1
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/History.md10
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/Makefile7
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/Readme.md51
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/component.json7
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/index.js39
-rw-r--r--node_modules/express/node_modules/connect/node_modules/bytes/package.json24
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/.npmignore4
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml5
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/LICENSE7
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/Readme.md419
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js71
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/example/json.js67
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/example/post.js43
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js48
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/index.js1
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js72
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js535
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js3
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js35
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js324
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js20
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js27
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/package.json42
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/common.js18
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.pngbin0 -> 1660 bytes
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gzbin0 -> 301 bytes
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gifbin0 -> 49 bytes
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt1
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.pngbin0 -> 931 bytes
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt1
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md3
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js24
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js6
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js9
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js9
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js21
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js8
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js72
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js96
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js38
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js45
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js24
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js80
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js104
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js756
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js50
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js45
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js71
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/run.js1
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js27
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js48
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js49
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html67
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js33
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js63
-rw-r--r--node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js47
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/.npmignore4
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/History.md5
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/Makefile7
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/Readme.md29
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/index.js29
-rw-r--r--node_modules/express/node_modules/connect/node_modules/pause/package.json24
-rw-r--r--node_modules/express/node_modules/connect/node_modules/qs/.gitmodules6
-rw-r--r--node_modules/express/node_modules/connect/node_modules/qs/.npmignore7
-rw-r--r--node_modules/express/node_modules/connect/node_modules/qs/Readme.md58
-rw-r--r--node_modules/express/node_modules/connect/node_modules/qs/index.js387
-rw-r--r--node_modules/express/node_modules/connect/node_modules/qs/package.json41
-rw-r--r--node_modules/express/node_modules/connect/node_modules/uid2/index.js49
-rw-r--r--node_modules/express/node_modules/connect/node_modules/uid2/package.json16
-rw-r--r--node_modules/express/node_modules/connect/package.json59
-rw-r--r--node_modules/express/node_modules/connect/test.js8
-rw-r--r--node_modules/express/node_modules/cookie-signature/.npmignore4
-rw-r--r--node_modules/express/node_modules/cookie-signature/History.md11
-rw-r--r--node_modules/express/node_modules/cookie-signature/Makefile7
-rw-r--r--node_modules/express/node_modules/cookie-signature/Readme.md42
-rw-r--r--node_modules/express/node_modules/cookie-signature/index.js42
-rw-r--r--node_modules/express/node_modules/cookie-signature/package.json28
-rw-r--r--node_modules/express/node_modules/cookie/.npmignore1
-rw-r--r--node_modules/express/node_modules/cookie/.travis.yml5
-rw-r--r--node_modules/express/node_modules/cookie/LICENSE9
-rw-r--r--node_modules/express/node_modules/cookie/README.md44
-rw-r--r--node_modules/express/node_modules/cookie/index.js70
-rw-r--r--node_modules/express/node_modules/cookie/package.json40
-rw-r--r--node_modules/express/node_modules/cookie/test/mocha.opts1
-rw-r--r--node_modules/express/node_modules/cookie/test/parse.js44
-rw-r--r--node_modules/express/node_modules/cookie/test/serialize.js64
-rw-r--r--node_modules/express/node_modules/debug/.npmignore4
-rw-r--r--node_modules/express/node_modules/debug/History.md62
-rw-r--r--node_modules/express/node_modules/debug/Readme.md115
-rw-r--r--node_modules/express/node_modules/debug/component.json9
-rw-r--r--node_modules/express/node_modules/debug/debug.js124
-rw-r--r--node_modules/express/node_modules/debug/example/app.js19
-rw-r--r--node_modules/express/node_modules/debug/example/browser.html24
-rw-r--r--node_modules/express/node_modules/debug/example/wildcards.js10
-rw-r--r--node_modules/express/node_modules/debug/example/worker.js22
-rw-r--r--node_modules/express/node_modules/debug/index.js5
-rw-r--r--node_modules/express/node_modules/debug/lib/debug.js134
-rw-r--r--node_modules/express/node_modules/debug/package.json44
-rw-r--r--node_modules/express/node_modules/fresh/.npmignore1
-rw-r--r--node_modules/express/node_modules/fresh/Makefile7
-rw-r--r--node_modules/express/node_modules/fresh/Readme.md32
-rw-r--r--node_modules/express/node_modules/fresh/index.js49
-rw-r--r--node_modules/express/node_modules/fresh/package.json24
-rw-r--r--node_modules/express/node_modules/methods/index.js26
-rw-r--r--node_modules/express/node_modules/methods/package.json24
-rw-r--r--node_modules/express/node_modules/mkdirp/.npmignore2
-rw-r--r--node_modules/express/node_modules/mkdirp/.travis.yml5
-rw-r--r--node_modules/express/node_modules/mkdirp/LICENSE21
-rw-r--r--node_modules/express/node_modules/mkdirp/examples/pow.js6
-rw-r--r--node_modules/express/node_modules/mkdirp/index.js82
-rw-r--r--node_modules/express/node_modules/mkdirp/package.json37
-rw-r--r--node_modules/express/node_modules/mkdirp/readme.markdown63
-rw-r--r--node_modules/express/node_modules/mkdirp/test/chmod.js38
-rw-r--r--node_modules/express/node_modules/mkdirp/test/clobber.js37
-rw-r--r--node_modules/express/node_modules/mkdirp/test/mkdirp.js28
-rw-r--r--node_modules/express/node_modules/mkdirp/test/perm.js32
-rw-r--r--node_modules/express/node_modules/mkdirp/test/perm_sync.js39
-rw-r--r--node_modules/express/node_modules/mkdirp/test/race.js41
-rw-r--r--node_modules/express/node_modules/mkdirp/test/rel.js32
-rw-r--r--node_modules/express/node_modules/mkdirp/test/return.js25
-rw-r--r--node_modules/express/node_modules/mkdirp/test/return_sync.js24
-rw-r--r--node_modules/express/node_modules/mkdirp/test/root.js18
-rw-r--r--node_modules/express/node_modules/mkdirp/test/sync.js32
-rw-r--r--node_modules/express/node_modules/mkdirp/test/umask.js28
-rw-r--r--node_modules/express/node_modules/mkdirp/test/umask_sync.js32
-rw-r--r--node_modules/express/node_modules/range-parser/.npmignore1
-rw-r--r--node_modules/express/node_modules/range-parser/History.md15
-rw-r--r--node_modules/express/node_modules/range-parser/Makefile7
-rw-r--r--node_modules/express/node_modules/range-parser/Readme.md28
-rw-r--r--node_modules/express/node_modules/range-parser/index.js49
-rw-r--r--node_modules/express/node_modules/range-parser/package.json24
-rw-r--r--node_modules/express/node_modules/send/.npmignore4
-rw-r--r--node_modules/express/node_modules/send/History.md35
-rw-r--r--node_modules/express/node_modules/send/Makefile8
-rw-r--r--node_modules/express/node_modules/send/Readme.md128
-rw-r--r--node_modules/express/node_modules/send/index.js2
-rw-r--r--node_modules/express/node_modules/send/lib/send.js474
-rw-r--r--node_modules/express/node_modules/send/lib/utils.js47
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/LICENSE19
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/README.md66
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/mime.js114
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/package.json39
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/test.js84
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/types/mime.types1588
-rw-r--r--node_modules/express/node_modules/send/node_modules/mime/types/node.types77
-rw-r--r--node_modules/express/node_modules/send/package.json45
-rw-r--r--node_modules/express/package.json88
-rw-r--r--node_modules/express/test.js17
-rw-r--r--node_modules/ws/.npmignore6
-rw-r--r--node_modules/ws/.travis.yml6
-rw-r--r--node_modules/ws/History.md260
-rw-r--r--node_modules/ws/Makefile38
-rw-r--r--node_modules/ws/README.md159
-rw-r--r--node_modules/ws/bench/parser.benchmark.js115
-rw-r--r--node_modules/ws/bench/sender.benchmark.js66
-rw-r--r--node_modules/ws/bench/speed.js105
-rw-r--r--node_modules/ws/bench/util.js105
-rw-r--r--node_modules/ws/bin/wscat190
-rw-r--r--node_modules/ws/binding.gyp14
-rw-r--r--node_modules/ws/builderror.log11
-rw-r--r--node_modules/ws/doc/ws.md179
-rw-r--r--node_modules/ws/examples/fileapi/.npmignore1
-rw-r--r--node_modules/ws/examples/fileapi/package.json18
-rw-r--r--node_modules/ws/examples/fileapi/public/app.js39
-rw-r--r--node_modules/ws/examples/fileapi/public/index.html22
-rw-r--r--node_modules/ws/examples/fileapi/public/uploader.js55
-rw-r--r--node_modules/ws/examples/fileapi/server.js103
-rw-r--r--node_modules/ws/examples/serverstats-express_3/package.json17
-rw-r--r--node_modules/ws/examples/serverstats-express_3/public/index.html33
-rw-r--r--node_modules/ws/examples/serverstats-express_3/server.js21
-rw-r--r--node_modules/ws/examples/serverstats/package.json17
-rw-r--r--node_modules/ws/examples/serverstats/public/index.html33
-rw-r--r--node_modules/ws/examples/serverstats/server.js19
-rw-r--r--node_modules/ws/examples/ssl.js59
-rw-r--r--node_modules/ws/index.js26
-rw-r--r--node_modules/ws/lib/BufferPool.js59
-rw-r--r--node_modules/ws/lib/BufferUtil.fallback.js47
-rw-r--r--node_modules/ws/lib/BufferUtil.js16
-rw-r--r--node_modules/ws/lib/ErrorCodes.js24
-rw-r--r--node_modules/ws/lib/Receiver.hixie.js180
-rw-r--r--node_modules/ws/lib/Receiver.js591
-rw-r--r--node_modules/ws/lib/Sender.hixie.js123
-rw-r--r--node_modules/ws/lib/Sender.js226
-rw-r--r--node_modules/ws/lib/Validation.fallback.js12
-rw-r--r--node_modules/ws/lib/Validation.js16
-rw-r--r--node_modules/ws/lib/WebSocket.js766
-rw-r--r--node_modules/ws/lib/WebSocketServer.js460
-rw-r--r--node_modules/ws/lib/browser.js5
-rw-r--r--node_modules/ws/node_modules/commander/.npmignore4
-rw-r--r--node_modules/ws/node_modules/commander/.travis.yml4
-rw-r--r--node_modules/ws/node_modules/commander/History.md107
-rw-r--r--node_modules/ws/node_modules/commander/Makefile7
-rw-r--r--node_modules/ws/node_modules/commander/Readme.md262
-rw-r--r--node_modules/ws/node_modules/commander/index.js2
-rw-r--r--node_modules/ws/node_modules/commander/lib/commander.js1026
-rw-r--r--node_modules/ws/node_modules/commander/package.json42
-rw-r--r--node_modules/ws/node_modules/options/.npmignore5
-rw-r--r--node_modules/ws/node_modules/options/Makefile12
-rw-r--r--node_modules/ws/node_modules/options/README.md28
-rw-r--r--node_modules/ws/node_modules/options/lib/options.js86
-rw-r--r--node_modules/ws/node_modules/options/package.json36
-rw-r--r--node_modules/ws/node_modules/options/test/fixtures/test.conf4
-rw-r--r--node_modules/ws/node_modules/options/test/options.test.js140
-rw-r--r--node_modules/ws/node_modules/tinycolor/.npmignore5
-rw-r--r--node_modules/ws/node_modules/tinycolor/README.md3
-rw-r--r--node_modules/ws/node_modules/tinycolor/example.js3
-rw-r--r--node_modules/ws/node_modules/tinycolor/package.json31
-rw-r--r--node_modules/ws/node_modules/tinycolor/tinycolor.js31
-rw-r--r--node_modules/ws/package.json48
-rw-r--r--node_modules/ws/src/bufferutil.cc115
-rw-r--r--node_modules/ws/src/validation.cc143
-rw-r--r--node_modules/ws/test/BufferPool.test.js63
-rw-r--r--node_modules/ws/test/Receiver.hixie.test.js158
-rw-r--r--node_modules/ws/test/Receiver.test.js255
-rw-r--r--node_modules/ws/test/Sender.hixie.test.js134
-rw-r--r--node_modules/ws/test/Sender.test.js24
-rw-r--r--node_modules/ws/test/Validation.test.js23
-rw-r--r--node_modules/ws/test/WebSocket.integration.js42
-rw-r--r--node_modules/ws/test/WebSocket.test.js1609
-rw-r--r--node_modules/ws/test/WebSocketServer.test.js1103
-rw-r--r--node_modules/ws/test/autobahn-server.js29
-rw-r--r--node_modules/ws/test/autobahn.js52
-rw-r--r--node_modules/ws/test/fixtures/agent1-cert.pem16
-rw-r--r--node_modules/ws/test/fixtures/agent1-key.pem15
-rw-r--r--node_modules/ws/test/fixtures/ca1-cert.pem15
-rw-r--r--node_modules/ws/test/fixtures/ca1-key.pem17
-rw-r--r--node_modules/ws/test/fixtures/certificate.pem13
-rw-r--r--node_modules/ws/test/fixtures/key.pem15
-rw-r--r--node_modules/ws/test/fixtures/request.pem11
-rw-r--r--node_modules/ws/test/fixtures/textfile9
-rw-r--r--node_modules/ws/test/hybi-common.js99
-rw-r--r--node_modules/ws/test/testserver.js180
438 files changed, 32986 insertions, 0 deletions
diff --git a/node_modules/.bin/express b/node_modules/.bin/express
new file mode 100644
index 0000000..cad5a1e
--- /dev/null
+++ b/node_modules/.bin/express
@@ -0,0 +1,15 @@
+#!/bin/sh
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ "$basedir/node" "$basedir/../express/bin/express" "$@"
+ ret=$?
+else
+ node "$basedir/../express/bin/express" "$@"
+ ret=$?
+fi
+exit $ret
diff --git a/node_modules/.bin/express.cmd b/node_modules/.bin/express.cmd
new file mode 100644
index 0000000..a17fbb0
--- /dev/null
+++ b/node_modules/.bin/express.cmd
@@ -0,0 +1,5 @@
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\..\express\bin\express" %*
+) ELSE (
+ node "%~dp0\..\express\bin\express" %*
+) \ No newline at end of file
diff --git a/node_modules/.bin/wscat b/node_modules/.bin/wscat
new file mode 100644
index 0000000..1a710cf
--- /dev/null
+++ b/node_modules/.bin/wscat
@@ -0,0 +1,15 @@
+#!/bin/sh
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ "$basedir/node" "$basedir/../ws/bin/wscat" "$@"
+ ret=$?
+else
+ node "$basedir/../ws/bin/wscat" "$@"
+ ret=$?
+fi
+exit $ret
diff --git a/node_modules/.bin/wscat.cmd b/node_modules/.bin/wscat.cmd
new file mode 100644
index 0000000..aa44584
--- /dev/null
+++ b/node_modules/.bin/wscat.cmd
@@ -0,0 +1,5 @@
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\..\ws\bin\wscat" %*
+) ELSE (
+ node "%~dp0\..\ws\bin\wscat" %*
+) \ No newline at end of file
diff --git a/node_modules/ejs/.gitmodules b/node_modules/ejs/.gitmodules
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/node_modules/ejs/.gitmodules
diff --git a/node_modules/ejs/.npmignore b/node_modules/ejs/.npmignore
new file mode 100644
index 0000000..020ddac
--- /dev/null
+++ b/node_modules/ejs/.npmignore
@@ -0,0 +1,4 @@
+# ignore any vim files:
+*.sw[a-z]
+vim/.netrwhist
+node_modules
diff --git a/node_modules/ejs/.travis.yml b/node_modules/ejs/.travis.yml
new file mode 100644
index 0000000..1ccd299
--- /dev/null
+++ b/node_modules/ejs/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - 0.11
+ - 0.10
+ - 0.9
+ - 0.6
+ - 0.8
diff --git a/node_modules/ejs/History.md b/node_modules/ejs/History.md
new file mode 100644
index 0000000..c26f168
--- /dev/null
+++ b/node_modules/ejs/History.md
@@ -0,0 +1,131 @@
+
+0.8.4 / 2013-05-08
+==================
+
+ * fix support for colons in filter arguments
+ * fix double callback when the callback throws
+ * rename escape option
+
+0.8.3 / 2012-09-13
+==================
+
+ * allow pre-compiling into a standalone function [seanmonstar]
+
+0.8.2 / 2012-08-16
+==================
+
+ * fix include "open" / "close" options. Closes #64
+
+0.8.1 / 2012-08-11
+==================
+
+ * fix comments. Closes #62 [Nate Silva]
+
+0.8.0 / 2012-07-25
+==================
+
+ * add `<% include file %>` support
+ * fix wrapping of custom require in build step. Closes #57
+
+0.7.3 / 2012-04-25
+==================
+
+ * Added repository to package.json [isaacs]
+
+0.7.1 / 2012-03-26
+==================
+
+ * Fixed exception when using express in production caused by typo. [slaskis]
+
+0.7.0 / 2012-03-24
+==================
+
+ * Added newline consumption support (`-%>`) [whoatemydomain]
+
+0.6.1 / 2011-12-09
+==================
+
+ * Fixed `ejs.renderFile()`
+
+0.6.0 / 2011-12-09
+==================
+
+ * Changed: you no longer need `{ locals: {} }`
+
+0.5.0 / 2011-11-20
+==================
+
+ * Added express 3.x support
+ * Added ejs.renderFile()
+ * Added 'json' filter
+ * Fixed tests for 0.5.x
+
+0.4.3 / 2011-06-20
+==================
+
+ * Fixed stacktraces line number when used multiline js expressions [Octave]
+
+0.4.2 / 2011-05-11
+==================
+
+ * Added client side support
+
+0.4.1 / 2011-04-21
+==================
+
+ * Fixed error context
+
+0.4.0 / 2011-04-21
+==================
+
+ * Added; ported jade's error reporting to ejs. [slaskis]
+
+0.3.1 / 2011-02-23
+==================
+
+ * Fixed optional `compile()` options
+
+0.3.0 / 2011-02-14
+==================
+
+ * Added 'json' filter [Yuriy Bogdanov]
+ * Use exported version of parse function to allow monkey-patching [Anatoliy Chakkaev]
+
+0.2.1 / 2010-10-07
+==================
+
+ * Added filter support
+ * Fixed _cache_ option. ~4x performance increase
+
+0.2.0 / 2010-08-05
+==================
+
+ * Added support for global tag config
+ * Added custom tag support. Closes #5
+ * Fixed whitespace bug. Closes #4
+
+0.1.0 / 2010-08-04
+==================
+
+ * Faster implementation [ashleydev]
+
+0.0.4 / 2010-08-02
+==================
+
+ * Fixed single quotes for content outside of template tags. [aniero]
+ * Changed; `exports.compile()` now expects only "locals"
+
+0.0.3 / 2010-07-15
+==================
+
+ * Fixed single quotes
+
+0.0.2 / 2010-07-09
+==================
+
+ * Fixed newline preservation
+
+0.0.1 / 2010-07-09
+==================
+
+ * Initial release
diff --git a/node_modules/ejs/Makefile b/node_modules/ejs/Makefile
new file mode 100644
index 0000000..a687a0a
--- /dev/null
+++ b/node_modules/ejs/Makefile
@@ -0,0 +1,23 @@
+
+SRC = $(shell find lib -name "*.js" -type f)
+UGLIFY_FLAGS = --no-mangle
+
+all: ejs.min.js
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec
+
+ejs.js: $(SRC)
+ @node support/compile.js $^
+
+ejs.min.js: ejs.js
+ @uglifyjs $(UGLIFY_FLAGS) $< > $@ \
+ && du ejs.min.js \
+ && du ejs.js
+
+clean:
+ rm -f ejs.js
+ rm -f ejs.min.js
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/ejs/Readme.md b/node_modules/ejs/Readme.md
new file mode 100644
index 0000000..ab0a3dd
--- /dev/null
+++ b/node_modules/ejs/Readme.md
@@ -0,0 +1,188 @@
+# EJS
+
+Embedded JavaScript templates.
+
+[![Build Status](https://travis-ci.org/visionmedia/ejs.png)](https://travis-ci.org/visionmedia/ejs)
+
+## Installation
+
+ $ npm install ejs
+
+## Features
+
+ * Complies with the [Express](http://expressjs.com) view system
+ * Static caching of intermediate JavaScript
+ * Unbuffered code for conditionals etc `<% code %>`
+ * Escapes html by default with `<%= code %>`
+ * Unescaped buffering with `<%- code %>`
+ * Supports tag customization
+ * Filter support for designer-friendly templates
+ * Includes
+ * Client-side support
+ * Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>`
+
+## Example
+
+ <% if (user) { %>
+ <h2><%= user.name %></h2>
+ <% } %>
+
+## Try out a live example now
+
+<a href="https://runnable.com/ejs" target="_blank"><img src="https://runnable.com/external/styles/assets/runnablebtn.png" style="width:67px;height:25px;"></a>
+
+## Usage
+
+ ejs.compile(str, options);
+ // => Function
+
+ ejs.render(str, options);
+ // => str
+
+## Options
+
+ - `cache` Compiled functions are cached, requires `filename`
+ - `filename` Used by `cache` to key caches
+ - `scope` Function execution context
+ - `debug` Output generated function body
+ - `compileDebug` When `false` no debug instrumentation is compiled
+ - `client` Returns standalone compiled function
+ - `open` Open tag, defaulting to "<%"
+ - `close` Closing tag, defaulting to "%>"
+ - * All others are template-local variables
+
+## Includes
+
+ Includes are relative to the template with the `include` statement,
+ for example if you have "./views/users.ejs" and "./views/user/show.ejs"
+ you would use `<% include user/show %>`. The included file(s) are literally
+ included into the template, _no_ IO is performed after compilation, thus
+ local variables are available to these included templates.
+
+```
+<ul>
+ <% users.forEach(function(user){ %>
+ <% include user/show %>
+ <% }) %>
+</ul>
+```
+
+## Custom delimiters
+
+Custom delimiters can also be applied globally:
+
+ var ejs = require('ejs');
+ ejs.open = '{{';
+ ejs.close = '}}';
+
+Which would make the following a valid template:
+
+ <h1>{{= title }}</h1>
+
+## Filters
+
+EJS conditionally supports the concept of "filters". A "filter chain"
+is a designer friendly api for manipulating data, without writing JavaScript.
+
+Filters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:
+
+Template:
+
+ <p><%=: users | map:'name' | join %></p>
+
+Output:
+
+ <p>Tj, Mape, Guillermo</p>
+
+Render call:
+
+ ejs.render(str, {
+ users: [
+ { name: 'tj' },
+ { name: 'mape' },
+ { name: 'guillermo' }
+ ]
+ });
+
+Or perhaps capitalize the first user's name for display:
+
+ <p><%=: users | first | capitalize %></p>
+
+## Filter list
+
+Currently these filters are available:
+
+ - first
+ - last
+ - capitalize
+ - downcase
+ - upcase
+ - sort
+ - sort_by:'prop'
+ - size
+ - length
+ - plus:n
+ - minus:n
+ - times:n
+ - divided_by:n
+ - join:'val'
+ - truncate:n
+ - truncate_words:n
+ - replace:pattern,substitution
+ - prepend:val
+ - append:val
+ - map:'prop'
+ - reverse
+ - get:'prop'
+
+## Adding filters
+
+ To add a filter simply add a method to the `.filters` object:
+
+```js
+ejs.filters.last = function(obj) {
+ return obj[obj.length - 1];
+};
+```
+
+## Layouts
+
+ Currently EJS has no notion of blocks, only compile-time `include`s,
+ however you may still utilize this feature to implement "layouts" by
+ simply including a header and footer like so:
+
+```html
+<% include head %>
+<h1>Title</h1>
+<p>My page</p>
+<% include foot %>
+```
+
+## client-side support
+
+ include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`.
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ejs/benchmark.js b/node_modules/ejs/benchmark.js
new file mode 100644
index 0000000..7b267e1
--- /dev/null
+++ b/node_modules/ejs/benchmark.js
@@ -0,0 +1,14 @@
+
+
+var ejs = require('./lib/ejs'),
+ str = '<% if (foo) { %><p><%= foo %></p><% } %>',
+ times = 50000;
+
+console.log('rendering ' + times + ' times');
+
+var start = new Date;
+while (times--) {
+ ejs.render(str, { cache: true, filename: 'test', locals: { foo: 'bar' }});
+}
+
+console.log('took ' + (new Date - start) + 'ms'); \ No newline at end of file
diff --git a/node_modules/ejs/ejs.js b/node_modules/ejs/ejs.js
new file mode 100644
index 0000000..d910f11
--- /dev/null
+++ b/node_modules/ejs/ejs.js
@@ -0,0 +1,581 @@
+ejs = (function(){
+
+// CommonJS require()
+
+function require(p){
+ if ('fs' == p) return {};
+ var path = require.resolve(p)
+ , mod = require.modules[path];
+ if (!mod) throw new Error('failed to require "' + p + '"');
+ if (!mod.exports) {
+ mod.exports = {};
+ mod.call(mod.exports, mod, mod.exports, require.relative(path));
+ }
+ return mod.exports;
+ }
+
+require.modules = {};
+
+require.resolve = function (path){
+ var orig = path
+ , reg = path + '.js'
+ , index = path + '/index.js';
+ return require.modules[reg] && reg
+ || require.modules[index] && index
+ || orig;
+ };
+
+require.register = function (path, fn){
+ require.modules[path] = fn;
+ };
+
+require.relative = function (parent) {
+ return function(p){
+ if ('.' != p.substr(0, 1)) return require(p);
+
+ var path = parent.split('/')
+ , segs = p.split('/');
+ path.pop();
+
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i];
+ if ('..' == seg) path.pop();
+ else if ('.' != seg) path.push(seg);
+ }
+
+ return require(path.join('/'));
+ };
+ };
+
+
+require.register("ejs.js", function(module, exports, require){
+
+/*!
+ * EJS
+ * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils')
+ , fs = require('fs');
+
+/**
+ * Library version.
+ */
+
+exports.version = '0.7.2';
+
+/**
+ * Filters.
+ *
+ * @type Object
+ */
+
+var filters = exports.filters = require('./filters');
+
+/**
+ * Intermediate js cache.
+ *
+ * @type Object
+ */
+
+var cache = {};
+
+/**
+ * Clear intermediate js cache.
+ *
+ * @api public
+ */
+
+exports.clearCache = function(){
+ cache = {};
+};
+
+/**
+ * Translate filtered code into function calls.
+ *
+ * @param {String} js
+ * @return {String}
+ * @api private
+ */
+
+function filtered(js) {
+ return js.substr(1).split('|').reduce(function(js, filter){
+ var parts = filter.split(':')
+ , name = parts.shift()
+ , args = parts.shift() || '';
+ if (args) args = ', ' + args;
+ return 'filters.' + name + '(' + js + args + ')';
+ });
+};
+
+/**
+ * Re-throw the given `err` in context to the
+ * `str` of ejs, `filename`, and `lineno`.
+ *
+ * @param {Error} err
+ * @param {String} str
+ * @param {String} filename
+ * @param {String} lineno
+ * @api private
+ */
+
+function rethrow(err, str, filename, lineno){
+ var lines = str.split('\n')
+ , start = Math.max(lineno - 3, 0)
+ , end = Math.min(lines.length, lineno + 3);
+
+ // Error context
+ var context = lines.slice(start, end).map(function(line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' >> ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'ejs') + ':'
+ + lineno + '\n'
+ + context + '\n\n'
+ + err.message;
+
+ throw err;
+}
+
+/**
+ * Parse the given `str` of ejs, returning the function body.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api public
+ */
+
+var parse = exports.parse = function(str, options){
+ var options = options || {}
+ , open = options.open || exports.open || '<%'
+ , close = options.close || exports.close || '%>';
+
+ var buf = [
+ "var buf = [];"
+ , "\nwith (locals) {"
+ , "\n buf.push('"
+ ];
+
+ var lineno = 1;
+
+ var consumeEOL = false;
+ for (var i = 0, len = str.length; i < len; ++i) {
+ if (str.slice(i, open.length + i) == open) {
+ i += open.length
+
+ var prefix, postfix, line = '__stack.lineno=' + lineno;
+ switch (str.substr(i, 1)) {
+ case '=':
+ prefix = "', escape((" + line + ', ';
+ postfix = ")), '";
+ ++i;
+ break;
+ case '-':
+ prefix = "', (" + line + ', ';
+ postfix = "), '";
+ ++i;
+ break;
+ default:
+ prefix = "');" + line + ';';
+ postfix = "; buf.push('";
+ }
+
+ var end = str.indexOf(close, i)
+ , js = str.substring(i, end)
+ , start = i
+ , n = 0;
+
+ if ('-' == js[js.length-1]){
+ js = js.substring(0, js.length - 2);
+ consumeEOL = true;
+ }
+
+ while (~(n = js.indexOf("\n", n))) n++, lineno++;
+ if (js.substr(0, 1) == ':') js = filtered(js);
+ buf.push(prefix, js, postfix);
+ i += end - start + close.length - 1;
+
+ } else if (str.substr(i, 1) == "\\") {
+ buf.push("\\\\");
+ } else if (str.substr(i, 1) == "'") {
+ buf.push("\\'");
+ } else if (str.substr(i, 1) == "\r") {
+ buf.push(" ");
+ } else if (str.substr(i, 1) == "\n") {
+ if (consumeEOL) {
+ consumeEOL = false;
+ } else {
+ buf.push("\\n");
+ lineno++;
+ }
+ } else {
+ buf.push(str.substr(i, 1));
+ }
+ }
+
+ buf.push("');\n}\nreturn buf.join('');");
+ return buf.join('');
+};
+
+/**
+ * Compile the given `str` of ejs into a `Function`.
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+var compile = exports.compile = function(str, options){
+ options = options || {};
+
+ var input = JSON.stringify(str)
+ , filename = options.filename
+ ? JSON.stringify(options.filename)
+ : 'undefined';
+
+ // Adds the fancy stack trace meta info
+ str = [
+ 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };',
+ rethrow.toString(),
+ 'try {',
+ exports.parse(str, options),
+ '} catch (err) {',
+ ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);',
+ '}'
+ ].join("\n");
+
+ if (options.debug) console.log(str);
+ var fn = new Function('locals, filters, escape', str);
+ return function(locals){
+ return fn.call(this, locals, filters, utils.escape);
+ }
+};
+
+/**
+ * Render the given `str` of ejs.
+ *
+ * Options:
+ *
+ * - `locals` Local variables object
+ * - `cache` Compiled functions are cached, requires `filename`
+ * - `filename` Used by `cache` to key caches
+ * - `scope` Function execution context
+ * - `debug` Output generated function body
+ * - `open` Open tag, defaulting to "<%"
+ * - `close` Closing tag, defaulting to "%>"
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {String}
+ * @api public
+ */
+
+exports.render = function(str, options){
+ var fn
+ , options = options || {};
+
+ if (options.cache) {
+ if (options.filename) {
+ fn = cache[options.filename] || (cache[options.filename] = compile(str, options));
+ } else {
+ throw new Error('"cache" option requires "filename".');
+ }
+ } else {
+ fn = compile(str, options);
+ }
+
+ options.__proto__ = options.locals;
+ return fn.call(options.scope, options);
+};
+
+/**
+ * Render an EJS file at the given `path` and callback `fn(err, str)`.
+ *
+ * @param {String} path
+ * @param {Object|Function} options or callback
+ * @param {Function} fn
+ * @api public
+ */
+
+exports.renderFile = function(path, options, fn){
+ var key = path + ':string';
+
+ if ('function' == typeof options) {
+ fn = options, options = {};
+ }
+
+ options.filename = path;
+
+ try {
+ var str = options.cache
+ ? cache[key] || (cache[key] = fs.readFileSync(path, 'utf8'))
+ : fs.readFileSync(path, 'utf8');
+
+ fn(null, exports.render(str, options));
+ } catch (err) {
+ fn(err);
+ }
+};
+
+// express support
+
+exports.__express = exports.renderFile;
+
+/**
+ * Expose to require().
+ */
+
+if (require.extensions) {
+ require.extensions['.ejs'] = function(module, filename) {
+ source = require('fs').readFileSync(filename, 'utf-8');
+ module._compile(compile(source, {}), filename);
+ };
+} else if (require.registerExtension) {
+ require.registerExtension('.ejs', function(src) {
+ return compile(src, {});
+ });
+}
+
+}); // module: ejs.js
+
+require.register("filters.js", function(module, exports, require){
+
+/*!
+ * EJS - Filters
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * First element of the target `obj`.
+ */
+
+exports.first = function(obj) {
+ return obj[0];
+};
+
+/**
+ * Last element of the target `obj`.
+ */
+
+exports.last = function(obj) {
+ return obj[obj.length - 1];
+};
+
+/**
+ * Capitalize the first letter of the target `str`.
+ */
+
+exports.capitalize = function(str){
+ str = String(str);
+ return str[0].toUpperCase() + str.substr(1, str.length);
+};
+
+/**
+ * Downcase the target `str`.
+ */
+
+exports.downcase = function(str){
+ return String(str).toLowerCase();
+};
+
+/**
+ * Uppercase the target `str`.
+ */
+
+exports.upcase = function(str){
+ return String(str).toUpperCase();
+};
+
+/**
+ * Sort the target `obj`.
+ */
+
+exports.sort = function(obj){
+ return Object.create(obj).sort();
+};
+
+/**
+ * Sort the target `obj` by the given `prop` ascending.
+ */
+
+exports.sort_by = function(obj, prop){
+ return Object.create(obj).sort(function(a, b){
+ a = a[prop], b = b[prop];
+ if (a > b) return 1;
+ if (a < b) return -1;
+ return 0;
+ });
+};
+
+/**
+ * Size or length of the target `obj`.
+ */
+
+exports.size = exports.length = function(obj) {
+ return obj.length;
+};
+
+/**
+ * Add `a` and `b`.
+ */
+
+exports.plus = function(a, b){
+ return Number(a) + Number(b);
+};
+
+/**
+ * Subtract `b` from `a`.
+ */
+
+exports.minus = function(a, b){
+ return Number(a) - Number(b);
+};
+
+/**
+ * Multiply `a` by `b`.
+ */
+
+exports.times = function(a, b){
+ return Number(a) * Number(b);
+};
+
+/**
+ * Divide `a` by `b`.
+ */
+
+exports.divided_by = function(a, b){
+ return Number(a) / Number(b);
+};
+
+/**
+ * Join `obj` with the given `str`.
+ */
+
+exports.join = function(obj, str){
+ return obj.join(str || ', ');
+};
+
+/**
+ * Truncate `str` to `len`.
+ */
+
+exports.truncate = function(str, len){
+ str = String(str);
+ return str.substr(0, len);
+};
+
+/**
+ * Truncate `str` to `n` words.
+ */
+
+exports.truncate_words = function(str, n){
+ var str = String(str)
+ , words = str.split(/ +/);
+ return words.slice(0, n).join(' ');
+};
+
+/**
+ * Replace `pattern` with `substitution` in `str`.
+ */
+
+exports.replace = function(str, pattern, substitution){
+ return String(str).replace(pattern, substitution || '');
+};
+
+/**
+ * Prepend `val` to `obj`.
+ */
+
+exports.prepend = function(obj, val){
+ return Array.isArray(obj)
+ ? [val].concat(obj)
+ : val + obj;
+};
+
+/**
+ * Append `val` to `obj`.
+ */
+
+exports.append = function(obj, val){
+ return Array.isArray(obj)
+ ? obj.concat(val)
+ : obj + val;
+};
+
+/**
+ * Map the given `prop`.
+ */
+
+exports.map = function(arr, prop){
+ return arr.map(function(obj){
+ return obj[prop];
+ });
+};
+
+/**
+ * Reverse the given `obj`.
+ */
+
+exports.reverse = function(obj){
+ return Array.isArray(obj)
+ ? obj.reverse()
+ : String(obj).split('').reverse().join('');
+};
+
+/**
+ * Get `prop` of the given `obj`.
+ */
+
+exports.get = function(obj, prop){
+ return obj[prop];
+};
+
+/**
+ * Packs the given `obj` into json string
+ */
+exports.json = function(obj){
+ return JSON.stringify(obj);
+};
+}); // module: filters.js
+
+require.register("utils.js", function(module, exports, require){
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+};
+
+}); // module: utils.js
+
+ return require("ejs");
+})(); \ No newline at end of file
diff --git a/node_modules/ejs/ejs.min.js b/node_modules/ejs/ejs.min.js
new file mode 100644
index 0000000..611ee42
--- /dev/null
+++ b/node_modules/ejs/ejs.min.js
@@ -0,0 +1 @@
+ejs=function(){function require(p){if("fs"==p)return{};var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');return mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path))),mod.exports}return require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&&reg||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p.substr(0,1))return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i<segs.length;i++){var seg=segs[i];".."==seg?path.pop():"."!=seg&&path.push(seg)}return require(path.join("/"))}},require.register("ejs.js",function(module,exports,require){var utils=require("./utils"),fs=require("fs");exports.version="0.7.2";var filters=exports.filters=require("./filters"),cache={};exports.clearCache=function(){cache={}};function filtered(js){return js.substr(1).split("|").reduce(function(js,filter){var parts=filter.split(":"),name=parts.shift(),args=parts.shift()||"";return args&&(args=", "+args),"filters."+name+"("+js+args+")"})}function rethrow(err,str,filename,lineno){var lines=str.split("\n"),start=Math.max(lineno-3,0),end=Math.min(lines.length,lineno+3),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message,err}var parse=exports.parse=function(str,options){var options=options||{},open=options.open||exports.open||"<%",close=options.close||exports.close||"%>",buf=["var buf = [];","\nwith (locals) {","\n buf.push('"],lineno=1,consumeEOL=!1;for(var i=0,len=str.length;i<len;++i)if(str.slice(i,open.length+i)==open){i+=open.length;var prefix,postfix,line="__stack.lineno="+lineno;switch(str.substr(i,1)){case"=":prefix="', escape(("+line+", ",postfix=")), '",++i;break;case"-":prefix="', ("+line+", ",postfix="), '",++i;break;default:prefix="');"+line+";",postfix="; buf.push('"}var end=str.indexOf(close,i),js=str.substring(i,end),start=i,n=0;"-"==js[js.length-1]&&(js=js.substring(0,js.length-2),consumeEOL=!0);while(~(n=js.indexOf("\n",n)))n++,lineno++;js.substr(0,1)==":"&&(js=filtered(js)),buf.push(prefix,js,postfix),i+=end-start+close.length-1}else str.substr(i,1)=="\\"?buf.push("\\\\"):str.substr(i,1)=="'"?buf.push("\\'"):str.substr(i,1)=="\r"?buf.push(" "):str.substr(i,1)=="\n"?consumeEOL?consumeEOL=!1:(buf.push("\\n"),lineno++):buf.push(str.substr(i,1));return buf.push("');\n}\nreturn buf.join('');"),buf.join("")},compile=exports.compile=function(str,options){options=options||{};var input=JSON.stringify(str),filename=options.filename?JSON.stringify(options.filename):"undefined";str=["var __stack = { lineno: 1, input: "+input+", filename: "+filename+" };",rethrow.toString(),"try {",exports.parse(str,options),"} catch (err) {"," rethrow(err, __stack.input, __stack.filename, __stack.lineno);","}"].join("\n"),options.debug&&console.log(str);var fn=new Function("locals, filters, escape",str);return function(locals){return fn.call(this,locals,filters,utils.escape)}};exports.render=function(str,options){var fn,options=options||{};if(options.cache){if(!options.filename)throw new Error('"cache" option requires "filename".');fn=cache[options.filename]||(cache[options.filename]=compile(str,options))}else fn=compile(str,options);return options.__proto__=options.locals,fn.call(options.scope,options)},exports.renderFile=function(path,options,fn){var key=path+":string";"function"==typeof options&&(fn=options,options={}),options.filename=path;try{var str=options.cache?cache[key]||(cache[key]=fs.readFileSync(path,"utf8")):fs.readFileSync(path,"utf8");fn(null,exports.render(str,options))}catch(err){fn(err)}},exports.__express=exports.renderFile,require.extensions?require.extensions[".ejs"]=function(module,filename){source=require("fs").readFileSync(filename,"utf-8"),module._compile(compile(source,{}),filename)}:require.registerExtension&&require.registerExtension(".ejs",function(src){return compile(src,{})})}),require.register("filters.js",function(module,exports,require){exports.first=function(obj){return obj[0]},exports.last=function(obj){return obj[obj.length-1]},exports.capitalize=function(str){return str=String(str),str[0].toUpperCase()+str.substr(1,str.length)},exports.downcase=function(str){return String(str).toLowerCase()},exports.upcase=function(str){return String(str).toUpperCase()},exports.sort=function(obj){return Object.create(obj).sort()},exports.sort_by=function(obj,prop){return Object.create(obj).sort(function(a,b){return a=a[prop],b=b[prop],a>b?1:a<b?-1:0})},exports.size=exports.length=function(obj){return obj.length},exports.plus=function(a,b){return Number(a)+Number(b)},exports.minus=function(a,b){return Number(a)-Number(b)},exports.times=function(a,b){return Number(a)*Number(b)},exports.divided_by=function(a,b){return Number(a)/Number(b)},exports.join=function(obj,str){return obj.join(str||", ")},exports.truncate=function(str,len){return str=String(str),str.substr(0,len)},exports.truncate_words=function(str,n){var str=String(str),words=str.split(/ +/);return words.slice(0,n).join(" ")},exports.replace=function(str,pattern,substitution){return String(str).replace(pattern,substitution||"")},exports.prepend=function(obj,val){return Array.isArray(obj)?[val].concat(obj):val+obj},exports.append=function(obj,val){return Array.isArray(obj)?obj.concat(val):obj+val},exports.map=function(arr,prop){return arr.map(function(obj){return obj[prop]})},exports.reverse=function(obj){return Array.isArray(obj)?obj.reverse():String(obj).split("").reverse().join("")},exports.get=function(obj,prop){return obj[prop]},exports.json=function(obj){return JSON.stringify(obj)}}),require.register("utils.js",function(module,exports,require){exports.escape=function(html){return String(html).replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}),require("ejs")}(); \ No newline at end of file
diff --git a/node_modules/ejs/examples/client.html b/node_modules/ejs/examples/client.html
new file mode 100644
index 0000000..30dfea9
--- /dev/null
+++ b/node_modules/ejs/examples/client.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <script src="../ejs.js"></script>
+ <script id="users" type="text/template">
+ <% if (names.length) { %>
+ <ul>
+ <% names.forEach(function(name){ %>
+ <li><%= name %></li>
+ <% }) %>
+ </ul>
+ <% } %>
+ </script>
+ <script>
+ onload = function(){
+ var users = document.getElementById('users').innerHTML;
+ var names = ['loki', 'tobi', 'jane'];
+ var html = ejs.render(users, { names: names });
+ document.body.innerHTML = html;
+ }
+ </script>
+ </head>
+ <body>
+ </body>
+</html> \ No newline at end of file
diff --git a/node_modules/ejs/examples/functions.ejs b/node_modules/ejs/examples/functions.ejs
new file mode 100644
index 0000000..bd5610e
--- /dev/null
+++ b/node_modules/ejs/examples/functions.ejs
@@ -0,0 +1,9 @@
+<h1>Users</h1>
+
+<% function user(user) { %>
+ <li><strong><%= user.name %></strong> is a <%= user.age %> year old <%= user.species %>.</li>
+<% } %>
+
+<ul>
+ <% users.map(user) %>
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/examples/functions.js b/node_modules/ejs/examples/functions.js
new file mode 100644
index 0000000..607833f
--- /dev/null
+++ b/node_modules/ejs/examples/functions.js
@@ -0,0 +1,22 @@
+
+/**
+ * Module dependencies.
+ */
+
+var ejs = require('../')
+ , fs = require('fs')
+ , path = __dirname + '/functions.ejs'
+ , str = fs.readFileSync(path, 'utf8');
+
+var users = [];
+
+users.push({ name: 'Tobi', age: 2, species: 'ferret' })
+users.push({ name: 'Loki', age: 2, species: 'ferret' })
+users.push({ name: 'Jane', age: 6, species: 'ferret' })
+
+var ret = ejs.render(str, {
+ users: users,
+ filename: path
+});
+
+console.log(ret); \ No newline at end of file
diff --git a/node_modules/ejs/examples/list.ejs b/node_modules/ejs/examples/list.ejs
new file mode 100644
index 0000000..d571330
--- /dev/null
+++ b/node_modules/ejs/examples/list.ejs
@@ -0,0 +1,7 @@
+<% if (names.length) { %>
+ <ul>
+ <% names.forEach(function(name){ %>
+ <li><%= name %></li>
+ <% }) %>
+ </ul>
+<% } %> \ No newline at end of file
diff --git a/node_modules/ejs/examples/list.js b/node_modules/ejs/examples/list.js
new file mode 100644
index 0000000..ec614ed
--- /dev/null
+++ b/node_modules/ejs/examples/list.js
@@ -0,0 +1,14 @@
+
+/**
+ * Module dependencies.
+ */
+
+var ejs = require('../')
+ , fs = require('fs')
+ , str = fs.readFileSync(__dirname + '/list.ejs', 'utf8');
+
+var ret = ejs.render(str, {
+ names: ['foo', 'bar', 'baz']
+});
+
+console.log(ret); \ No newline at end of file
diff --git a/node_modules/ejs/index.js b/node_modules/ejs/index.js
new file mode 100644
index 0000000..20bf71a
--- /dev/null
+++ b/node_modules/ejs/index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/ejs'); \ No newline at end of file
diff --git a/node_modules/ejs/lib/ejs.js b/node_modules/ejs/lib/ejs.js
new file mode 100644
index 0000000..8601b10
--- /dev/null
+++ b/node_modules/ejs/lib/ejs.js
@@ -0,0 +1,353 @@
+
+/*!
+ * EJS
+ * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils')
+ , path = require('path')
+ , basename = path.basename
+ , dirname = path.dirname
+ , extname = path.extname
+ , join = path.join
+ , fs = require('fs')
+ , read = fs.readFileSync;
+
+/**
+ * Filters.
+ *
+ * @type Object
+ */
+
+var filters = exports.filters = require('./filters');
+
+/**
+ * Intermediate js cache.
+ *
+ * @type Object
+ */
+
+var cache = {};
+
+/**
+ * Clear intermediate js cache.
+ *
+ * @api public
+ */
+
+exports.clearCache = function(){
+ cache = {};
+};
+
+/**
+ * Translate filtered code into function calls.
+ *
+ * @param {String} js
+ * @return {String}
+ * @api private
+ */
+
+function filtered(js) {
+ return js.substr(1).split('|').reduce(function(js, filter){
+ var parts = filter.split(':')
+ , name = parts.shift()
+ , args = parts.join(':') || '';
+ if (args) args = ', ' + args;
+ return 'filters.' + name + '(' + js + args + ')';
+ });
+};
+
+/**
+ * Re-throw the given `err` in context to the
+ * `str` of ejs, `filename`, and `lineno`.
+ *
+ * @param {Error} err
+ * @param {String} str
+ * @param {String} filename
+ * @param {String} lineno
+ * @api private
+ */
+
+function rethrow(err, str, filename, lineno){
+ var lines = str.split('\n')
+ , start = Math.max(lineno - 3, 0)
+ , end = Math.min(lines.length, lineno + 3);
+
+ // Error context
+ var context = lines.slice(start, end).map(function(line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' >> ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'ejs') + ':'
+ + lineno + '\n'
+ + context + '\n\n'
+ + err.message;
+
+ throw err;
+}
+
+/**
+ * Parse the given `str` of ejs, returning the function body.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api public
+ */
+
+var parse = exports.parse = function(str, options){
+ var options = options || {}
+ , open = options.open || exports.open || '<%'
+ , close = options.close || exports.close || '%>'
+ , filename = options.filename
+ , compileDebug = options.compileDebug !== false
+ , buf = [];
+
+ buf.push('var buf = [];');
+ if (false !== options._with) buf.push('\nwith (locals || {}) { (function(){ ');
+ buf.push('\n buf.push(\'');
+
+ var lineno = 1;
+
+ var consumeEOL = false;
+ for (var i = 0, len = str.length; i < len; ++i) {
+ if (str.slice(i, open.length + i) == open) {
+ i += open.length
+
+ var prefix, postfix, line = (compileDebug ? '__stack.lineno=' : '') + lineno;
+ switch (str.substr(i, 1)) {
+ case '=':
+ prefix = "', escape((" + line + ', ';
+ postfix = ")), '";
+ ++i;
+ break;
+ case '-':
+ prefix = "', (" + line + ', ';
+ postfix = "), '";
+ ++i;
+ break;
+ default:
+ prefix = "');" + line + ';';
+ postfix = "; buf.push('";
+ }
+
+ var end = str.indexOf(close, i)
+ , js = str.substring(i, end)
+ , start = i
+ , include = null
+ , n = 0;
+
+ if ('-' == js[js.length-1]){
+ js = js.substring(0, js.length - 2);
+ consumeEOL = true;
+ }
+
+ if (0 == js.trim().indexOf('include')) {
+ var name = js.trim().slice(7).trim();
+ if (!filename) throw new Error('filename option is required for includes');
+ var path = resolveInclude(name, filename);
+ include = read(path, 'utf8');
+ include = exports.parse(include, { filename: path, _with: false, open: open, close: close, compileDebug: compileDebug });
+ buf.push("' + (function(){" + include + "})() + '");
+ js = '';
+ }
+
+ while (~(n = js.indexOf("\n", n))) n++, lineno++;
+ if (js.substr(0, 1) == ':') js = filtered(js);
+ if (js) {
+ if (js.lastIndexOf('//') > js.lastIndexOf('\n')) js += '\n';
+ buf.push(prefix, js, postfix);
+ }
+ i += end - start + close.length - 1;
+
+ } else if (str.substr(i, 1) == "\\") {
+ buf.push("\\\\");
+ } else if (str.substr(i, 1) == "'") {
+ buf.push("\\'");
+ } else if (str.substr(i, 1) == "\r") {
+ // ignore
+ } else if (str.substr(i, 1) == "\n") {
+ if (consumeEOL) {
+ consumeEOL = false;
+ } else {
+ buf.push("\\n");
+ lineno++;
+ }
+ } else {
+ buf.push(str.substr(i, 1));
+ }
+ }
+
+ if (false !== options._with) buf.push("'); })();\n} \nreturn buf.join('');")
+ else buf.push("');\nreturn buf.join('');");
+
+ return buf.join('');
+};
+
+/**
+ * Compile the given `str` of ejs into a `Function`.
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+var compile = exports.compile = function(str, options){
+ options = options || {};
+ var escape = options.escape || utils.escape;
+
+ var input = JSON.stringify(str)
+ , compileDebug = options.compileDebug !== false
+ , client = options.client
+ , filename = options.filename
+ ? JSON.stringify(options.filename)
+ : 'undefined';
+
+ if (compileDebug) {
+ // Adds the fancy stack trace meta info
+ str = [
+ 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };',
+ rethrow.toString(),
+ 'try {',
+ exports.parse(str, options),
+ '} catch (err) {',
+ ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);',
+ '}'
+ ].join("\n");
+ } else {
+ str = exports.parse(str, options);
+ }
+
+ if (options.debug) console.log(str);
+ if (client) str = 'escape = escape || ' + escape.toString() + ';\n' + str;
+
+ try {
+ var fn = new Function('locals, filters, escape', str);
+ } catch (err) {
+ if ('SyntaxError' == err.name) {
+ err.message += options.filename
+ ? ' in ' + filename
+ : ' while compiling ejs';
+ }
+ throw err;
+ }
+
+ if (client) return fn;
+
+ return function(locals){
+ return fn.call(this, locals, filters, escape);
+ }
+};
+
+/**
+ * Render the given `str` of ejs.
+ *
+ * Options:
+ *
+ * - `locals` Local variables object
+ * - `cache` Compiled functions are cached, requires `filename`
+ * - `filename` Used by `cache` to key caches
+ * - `scope` Function execution context
+ * - `debug` Output generated function body
+ * - `open` Open tag, defaulting to "<%"
+ * - `close` Closing tag, defaulting to "%>"
+ *
+ * @param {String} str
+ * @param {Object} options
+ * @return {String}
+ * @api public
+ */
+
+exports.render = function(str, options){
+ var fn
+ , options = options || {};
+
+ if (options.cache) {
+ if (options.filename) {
+ fn = cache[options.filename] || (cache[options.filename] = compile(str, options));
+ } else {
+ throw new Error('"cache" option requires "filename".');
+ }
+ } else {
+ fn = compile(str, options);
+ }
+
+ options.__proto__ = options.locals;
+ return fn.call(options.scope, options);
+};
+
+/**
+ * Render an EJS file at the given `path` and callback `fn(err, str)`.
+ *
+ * @param {String} path
+ * @param {Object|Function} options or callback
+ * @param {Function} fn
+ * @api public
+ */
+
+exports.renderFile = function(path, options, fn){
+ var key = path + ':string';
+
+ if ('function' == typeof options) {
+ fn = options, options = {};
+ }
+
+ options.filename = path;
+
+ var str;
+ try {
+ str = options.cache
+ ? cache[key] || (cache[key] = read(path, 'utf8'))
+ : read(path, 'utf8');
+ } catch (err) {
+ fn(err);
+ return;
+ }
+ fn(null, exports.render(str, options));
+};
+
+/**
+ * Resolve include `name` relative to `filename`.
+ *
+ * @param {String} name
+ * @param {String} filename
+ * @return {String}
+ * @api private
+ */
+
+function resolveInclude(name, filename) {
+ var path = join(dirname(filename), name);
+ var ext = extname(name);
+ if (!ext) path += '.ejs';
+ return path;
+}
+
+// express support
+
+exports.__express = exports.renderFile;
+
+/**
+ * Expose to require().
+ */
+
+if (require.extensions) {
+ require.extensions['.ejs'] = function(module, filename) {
+ source = require('fs').readFileSync(filename, 'utf-8');
+ module._compile(compile(source, {}), filename);
+ };
+} else if (require.registerExtension) {
+ require.registerExtension('.ejs', function(src) {
+ return compile(src, {});
+ });
+}
diff --git a/node_modules/ejs/lib/filters.js b/node_modules/ejs/lib/filters.js
new file mode 100644
index 0000000..d425c8d
--- /dev/null
+++ b/node_modules/ejs/lib/filters.js
@@ -0,0 +1,198 @@
+
+/*!
+ * EJS - Filters
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * First element of the target `obj`.
+ */
+
+exports.first = function(obj) {
+ return obj[0];
+};
+
+/**
+ * Last element of the target `obj`.
+ */
+
+exports.last = function(obj) {
+ return obj[obj.length - 1];
+};
+
+/**
+ * Capitalize the first letter of the target `str`.
+ */
+
+exports.capitalize = function(str){
+ str = String(str);
+ return str[0].toUpperCase() + str.substr(1, str.length);
+};
+
+/**
+ * Downcase the target `str`.
+ */
+
+exports.downcase = function(str){
+ return String(str).toLowerCase();
+};
+
+/**
+ * Uppercase the target `str`.
+ */
+
+exports.upcase = function(str){
+ return String(str).toUpperCase();
+};
+
+/**
+ * Sort the target `obj`.
+ */
+
+exports.sort = function(obj){
+ return Object.create(obj).sort();
+};
+
+/**
+ * Sort the target `obj` by the given `prop` ascending.
+ */
+
+exports.sort_by = function(obj, prop){
+ return Object.create(obj).sort(function(a, b){
+ a = a[prop], b = b[prop];
+ if (a > b) return 1;
+ if (a < b) return -1;
+ return 0;
+ });
+};
+
+/**
+ * Size or length of the target `obj`.
+ */
+
+exports.size = exports.length = function(obj) {
+ return obj.length;
+};
+
+/**
+ * Add `a` and `b`.
+ */
+
+exports.plus = function(a, b){
+ return Number(a) + Number(b);
+};
+
+/**
+ * Subtract `b` from `a`.
+ */
+
+exports.minus = function(a, b){
+ return Number(a) - Number(b);
+};
+
+/**
+ * Multiply `a` by `b`.
+ */
+
+exports.times = function(a, b){
+ return Number(a) * Number(b);
+};
+
+/**
+ * Divide `a` by `b`.
+ */
+
+exports.divided_by = function(a, b){
+ return Number(a) / Number(b);
+};
+
+/**
+ * Join `obj` with the given `str`.
+ */
+
+exports.join = function(obj, str){
+ return obj.join(str || ', ');
+};
+
+/**
+ * Truncate `str` to `len`.
+ */
+
+exports.truncate = function(str, len){
+ str = String(str);
+ return str.substr(0, len);
+};
+
+/**
+ * Truncate `str` to `n` words.
+ */
+
+exports.truncate_words = function(str, n){
+ var str = String(str)
+ , words = str.split(/ +/);
+ return words.slice(0, n).join(' ');
+};
+
+/**
+ * Replace `pattern` with `substitution` in `str`.
+ */
+
+exports.replace = function(str, pattern, substitution){
+ return String(str).replace(pattern, substitution || '');
+};
+
+/**
+ * Prepend `val` to `obj`.
+ */
+
+exports.prepend = function(obj, val){
+ return Array.isArray(obj)
+ ? [val].concat(obj)
+ : val + obj;
+};
+
+/**
+ * Append `val` to `obj`.
+ */
+
+exports.append = function(obj, val){
+ return Array.isArray(obj)
+ ? obj.concat(val)
+ : obj + val;
+};
+
+/**
+ * Map the given `prop`.
+ */
+
+exports.map = function(arr, prop){
+ return arr.map(function(obj){
+ return obj[prop];
+ });
+};
+
+/**
+ * Reverse the given `obj`.
+ */
+
+exports.reverse = function(obj){
+ return Array.isArray(obj)
+ ? obj.reverse()
+ : String(obj).split('').reverse().join('');
+};
+
+/**
+ * Get `prop` of the given `obj`.
+ */
+
+exports.get = function(obj, prop){
+ return obj[prop];
+};
+
+/**
+ * Packs the given `obj` into json string
+ */
+exports.json = function(obj){
+ return JSON.stringify(obj);
+}; \ No newline at end of file
diff --git a/node_modules/ejs/lib/utils.js b/node_modules/ejs/lib/utils.js
new file mode 100644
index 0000000..8d569d6
--- /dev/null
+++ b/node_modules/ejs/lib/utils.js
@@ -0,0 +1,23 @@
+
+/*!
+ * EJS
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+};
+ \ No newline at end of file
diff --git a/node_modules/ejs/package.json b/node_modules/ejs/package.json
new file mode 100644
index 0000000..6cb631d
--- /dev/null
+++ b/node_modules/ejs/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "ejs",
+ "description": "Embedded JavaScript templates",
+ "version": "0.8.4",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "keywords": [
+ "template",
+ "engine",
+ "ejs"
+ ],
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "main": "./lib/ejs.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/ejs.git"
+ },
+ "scripts": {
+ "test": "mocha --require should --reporter spec"
+ },
+ "readme": "# EJS\n\nEmbedded JavaScript templates.\n\n[![Build Status](https://travis-ci.org/visionmedia/ejs.png)](https://travis-ci.org/visionmedia/ejs)\n\n## Installation\n\n $ npm install ejs\n\n## Features\n\n * Complies with the [Express](http://expressjs.com) view system\n * Static caching of intermediate JavaScript\n * Unbuffered code for conditionals etc `<% code %>`\n * Escapes html by default with `<%= code %>`\n * Unescaped buffering with `<%- code %>`\n * Supports tag customization\n * Filter support for designer-friendly templates\n * Includes\n * Client-side support\n * Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>`\n\n## Example\n\n <% if (user) { %>\n\t <h2><%= user.name %></h2>\n <% } %>\n \n## Try out a live example now\n\n<a href=\"https://runnable.com/ejs\" target=\"_blank\"><img src=\"https://runnable.com/external/styles/assets/runnablebtn.png\" style=\"width:67px;height:25px;\"></a>\n\n## Usage\n\n ejs.compile(str, options);\n // => Function\n\n ejs.render(str, options);\n // => str\n\n## Options\n\n - `cache` Compiled functions are cached, requires `filename`\n - `filename` Used by `cache` to key caches\n - `scope` Function execution context\n - `debug` Output generated function body\n - `compileDebug` When `false` no debug instrumentation is compiled\n - `client` Returns standalone compiled function\n - `open` Open tag, defaulting to \"<%\"\n - `close` Closing tag, defaulting to \"%>\"\n - * All others are template-local variables\n\n## Includes\n\n Includes are relative to the template with the `include` statement,\n for example if you have \"./views/users.ejs\" and \"./views/user/show.ejs\"\n you would use `<% include user/show %>`. The included file(s) are literally\n included into the template, _no_ IO is performed after compilation, thus\n local variables are available to these included templates.\n\n```\n<ul>\n <% users.forEach(function(user){ %>\n <% include user/show %>\n <% }) %>\n</ul>\n```\n\n## Custom delimiters\n\nCustom delimiters can also be applied globally:\n\n var ejs = require('ejs');\n ejs.open = '{{';\n ejs.close = '}}';\n\nWhich would make the following a valid template:\n\n <h1>{{= title }}</h1>\n\n## Filters\n\nEJS conditionally supports the concept of \"filters\". A \"filter chain\"\nis a designer friendly api for manipulating data, without writing JavaScript.\n\nFilters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:\n\nTemplate:\n\n <p><%=: users | map:'name' | join %></p>\n\nOutput:\n\n <p>Tj, Mape, Guillermo</p>\n\nRender call:\n\n ejs.render(str, {\n users: [\n { name: 'tj' },\n { name: 'mape' },\n { name: 'guillermo' }\n ]\n });\n\nOr perhaps capitalize the first user's name for display:\n\n <p><%=: users | first | capitalize %></p>\n\n## Filter list\n\nCurrently these filters are available:\n\n - first\n - last\n - capitalize\n - downcase\n - upcase\n - sort\n - sort_by:'prop'\n - size\n - length\n - plus:n\n - minus:n\n - times:n\n - divided_by:n\n - join:'val'\n - truncate:n\n - truncate_words:n\n - replace:pattern,substitution\n - prepend:val\n - append:val\n - map:'prop'\n - reverse\n - get:'prop'\n\n## Adding filters\n\n To add a filter simply add a method to the `.filters` object:\n \n```js\nejs.filters.last = function(obj) {\n return obj[obj.length - 1];\n};\n```\n\n## Layouts\n\n Currently EJS has no notion of blocks, only compile-time `include`s,\n however you may still utilize this feature to implement \"layouts\" by\n simply including a header and footer like so:\n\n```html\n<% include head %>\n<h1>Title</h1>\n<p>My page</p>\n<% include foot %>\n```\n\n## client-side support\n\n include `./ejs.js` or `./ejs.min.js` and `require(\"ejs\").compile(str)`.\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2009-2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/ejs/issues"
+ },
+ "_id": "ejs@0.8.4",
+ "_from": "ejs@"
+}
diff --git a/node_modules/ejs/support/compile.js b/node_modules/ejs/support/compile.js
new file mode 100644
index 0000000..497a1bb
--- /dev/null
+++ b/node_modules/ejs/support/compile.js
@@ -0,0 +1,176 @@
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs');
+
+/**
+ * Arguments.
+ */
+
+var args = process.argv.slice(2)
+ , pending = args.length
+ , files = {};
+
+console.log('');
+
+// parse arguments
+
+args.forEach(function(file){
+ var mod = file.replace('lib/', '');
+ fs.readFile(file, 'utf8', function(err, js){
+ if (err) throw err;
+ console.log(' \033[90mcompile : \033[0m\033[36m%s\033[0m', file);
+ files[file] = parse(js);
+ --pending || compile();
+ });
+});
+
+/**
+ * Parse the given `js`.
+ */
+
+function parse(js) {
+ return parseInheritance(parseConditionals(js));
+}
+
+/**
+ * Parse __proto__.
+ */
+
+function parseInheritance(js) {
+ return js
+ .replace(/^ *(\w+)\.prototype\.__proto__ * = *(\w+)\.prototype *;?/gm, function(_, child, parent){
+ return child + '.prototype = new ' + parent + ';\n'
+ + child + '.prototype.constructor = '+ child + ';\n';
+ });
+}
+
+/**
+ * Parse the given `js`, currently supporting:
+ *
+ * 'if' ['node' | 'browser']
+ * 'end'
+ *
+ */
+
+function parseConditionals(js) {
+ var lines = js.split('\n')
+ , len = lines.length
+ , buffer = true
+ , browser = false
+ , buf = []
+ , line
+ , cond;
+
+ for (var i = 0; i < len; ++i) {
+ line = lines[i];
+ if (/^ *\/\/ *if *(node|browser)/gm.exec(line)) {
+ cond = RegExp.$1;
+ buffer = browser = 'browser' == cond;
+ } else if (/^ *\/\/ *end/.test(line)) {
+ buffer = true;
+ browser = false;
+ } else if (browser) {
+ buf.push(line.replace(/^( *)\/\//, '$1'));
+ } else if (buffer) {
+ buf.push(line);
+ }
+ }
+
+ return buf.join('\n');
+}
+
+/**
+ * Compile the files.
+ */
+
+function compile() {
+ var buf = '';
+ buf += 'ejs = (function(){\n';
+ buf += '\n// CommonJS require()\n\n';
+ buf += browser.require + '\n\n';
+ buf += 'require.modules = {};\n\n';
+ buf += 'require.resolve = ' + browser.resolve + ';\n\n';
+ buf += 'require.register = ' + browser.register + ';\n\n';
+ buf += 'require.relative = ' + browser.relative + ';\n\n';
+ args.forEach(function(file){
+ var js = files[file];
+ file = file.replace('lib/', '');
+ buf += '\nrequire.register("' + file + '", function(module, exports, require){\n';
+ buf += js;
+ buf += '\n}); // module: ' + file + '\n';
+ });
+ buf += '\n return require("ejs");\n})();';
+ fs.writeFile('ejs.js', buf, function(err){
+ if (err) throw err;
+ console.log(' \033[90m create : \033[0m\033[36m%s\033[0m', 'ejs.js');
+ console.log();
+ });
+}
+
+// refactored version of weepy's
+// https://github.com/weepy/brequire/blob/master/browser/brequire.js
+
+var browser = {
+
+ /**
+ * Require a module.
+ */
+
+ require: function require(p){
+ if ('fs' == p) return {};
+ var path = require.resolve(p)
+ , mod = require.modules[path];
+ if (!mod) throw new Error('failed to require "' + p + '"');
+ if (!mod.exports) {
+ mod.exports = {};
+ mod.call(mod.exports, mod, mod.exports, require.relative(path));
+ }
+ return mod.exports;
+ },
+
+ /**
+ * Resolve module path.
+ */
+
+ resolve: function(path){
+ var orig = path
+ , reg = path + '.js'
+ , index = path + '/index.js';
+ return require.modules[reg] && reg
+ || require.modules[index] && index
+ || orig;
+ },
+
+ /**
+ * Return relative require().
+ */
+
+ relative: function(parent) {
+ return function(p){
+ if ('.' != p.substr(0, 1)) return require(p);
+
+ var path = parent.split('/')
+ , segs = p.split('/');
+ path.pop();
+
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i];
+ if ('..' == seg) path.pop();
+ else if ('.' != seg) path.push(seg);
+ }
+
+ return require(path.join('/'));
+ };
+ },
+
+ /**
+ * Register a module.
+ */
+
+ register: function(path, fn){
+ require.modules[path] = fn;
+ }
+}; \ No newline at end of file
diff --git a/node_modules/ejs/test/ejs.js b/node_modules/ejs/test/ejs.js
new file mode 100644
index 0000000..1c58c1c
--- /dev/null
+++ b/node_modules/ejs/test/ejs.js
@@ -0,0 +1,265 @@
+/**
+ * Module dependencies.
+ */
+
+var ejs = require('..')
+ , fs = require('fs')
+ , read = fs.readFileSync
+ , assert = require('should');
+
+/**
+ * Load fixture `name`.
+ */
+
+function fixture(name) {
+ return read('test/fixtures/' + name, 'utf8').replace(/\r/g, '');
+}
+
+/**
+ * User fixtures.
+ */
+
+var users = [];
+users.push({ name: 'tobi' });
+users.push({ name: 'loki' });
+users.push({ name: 'jane' });
+
+describe('ejs.compile(str, options)', function(){
+ it('should compile to a function', function(){
+ var fn = ejs.compile('<p>yay</p>');
+ fn().should.equal('<p>yay</p>');
+ })
+
+ it('should throw if there are syntax errors', function(){
+ try {
+ ejs.compile(fixture('fail.ejs'));
+ } catch (err) {
+ err.message.should.include('compiling ejs');
+
+ try {
+ ejs.compile(fixture('fail.ejs'), { filename: 'fail.ejs' });
+ } catch (err) {
+ err.message.should.include('fail.ejs');
+ return;
+ }
+ }
+
+ assert(false, 'compiling a file with invalid syntax should throw an exception');
+ })
+
+ it('should allow customizing delimiters', function(){
+ var fn = ejs.compile('<p>{= name }</p>', { open: '{', close: '}' });
+ fn({ name: 'tobi' }).should.equal('<p>tobi</p>');
+
+ var fn = ejs.compile('<p>::= name ::</p>', { open: '::', close: '::' });
+ fn({ name: 'tobi' }).should.equal('<p>tobi</p>');
+
+ var fn = ejs.compile('<p>(= name )</p>', { open: '(', close: ')' });
+ fn({ name: 'tobi' }).should.equal('<p>tobi</p>');
+ })
+
+ it('should default to using ejs.open and ejs.close', function(){
+ ejs.open = '{';
+ ejs.close = '}';
+ var fn = ejs.compile('<p>{= name }</p>');
+ fn({ name: 'tobi' }).should.equal('<p>tobi</p>');
+
+ var fn = ejs.compile('<p>|= name |</p>', { open: '|', close: '|' });
+ fn({ name: 'tobi' }).should.equal('<p>tobi</p>');
+ delete ejs.open;
+ delete ejs.close;
+ })
+
+ it('should have a working client option', function(){
+ var fn = ejs.compile('<p><%= foo %></p>', { client: true });
+ var str = fn.toString();
+ eval('var preFn = ' + str);
+ preFn({ foo: 'bar' }).should.equal('<p>bar</p>');
+ })
+})
+
+describe('ejs.render(str, options)', function(){
+ it('should render the template', function(){
+ ejs.render('<p>yay</p>')
+ .should.equal('<p>yay</p>');
+ })
+
+ it('should accept locals', function(){
+ ejs.render('<p><%= name %></p>', { name: 'tobi' })
+ .should.equal('<p>tobi</p>');
+ })
+})
+
+describe('ejs.renderFile(path, options, fn)', function(){
+ it('should render a file', function(done){
+ ejs.renderFile('test/fixtures/para.ejs', function(err, html){
+ if (err) return done(err);
+ html.should.equal('<p>hey</p>');
+ done();
+ });
+ })
+
+ it('should accept locals', function(done){
+ var options = { name: 'tj', open: '{', close: '}' };
+ ejs.renderFile('test/fixtures/user.ejs', options, function(err, html){
+ if (err) return done(err);
+ html.should.equal('<h1>tj</h1>');
+ done();
+ });
+ })
+
+ it('should not catch err threw by callback', function(done){
+ var options = { name: 'tj', open: '{', close: '}' };
+ var counter = 0;
+ try {
+ ejs.renderFile('test/fixtures/user.ejs', options, function(err, html){
+ counter++;
+ if (err) {
+ err.message.should.not.equal('Exception in callback');
+ return done(err);
+ }
+ throw new Error('Exception in callback');
+ });
+ } catch (err) {
+ counter.should.equal(1);
+ err.message.should.equal('Exception in callback');
+ done();
+ }
+ })
+})
+
+describe('<%=', function(){
+ it('should escape', function(){
+ ejs.render('<%= name %>', { name: '<script>' })
+ .should.equal('&lt;script&gt;');
+ })
+})
+
+describe('<%-', function(){
+ it('should not escape', function(){
+ ejs.render('<%- name %>', { name: '<script>' })
+ .should.equal('<script>');
+ })
+})
+
+describe('%>', function(){
+ it('should produce newlines', function(){
+ ejs.render(fixture('newlines.ejs'), { users: users })
+ .should.equal(fixture('newlines.html'));
+ })
+})
+
+describe('-%>', function(){
+ it('should not produce newlines', function(){
+ ejs.render(fixture('no.newlines.ejs'), { users: users })
+ .should.equal(fixture('no.newlines.html'));
+ })
+})
+
+describe('single quotes', function(){
+ it('should not mess up the constructed function', function(){
+ ejs.render(fixture('single-quote.ejs'))
+ .should.equal(fixture('single-quote.html'));
+ })
+})
+
+describe('double quotes', function(){
+ it('should not mess up the constructed function', function(){
+ ejs.render(fixture('double-quote.ejs'))
+ .should.equal(fixture('double-quote.html'));
+ })
+})
+
+describe('backslashes', function(){
+ it('should escape', function(){
+ ejs.render(fixture('backslash.ejs'))
+ .should.equal(fixture('backslash.html'));
+ })
+})
+
+describe('messed up whitespace', function(){
+ it('should work', function(){
+ ejs.render(fixture('messed.ejs'), { users: users })
+ .should.equal(fixture('messed.html'));
+ })
+})
+
+describe('filters', function(){
+ it('should work', function(){
+ var items = ['foo', 'bar', 'baz'];
+ ejs.render('<%=: items | reverse | first | reverse | capitalize %>', { items: items })
+ .should.equal('Zab');
+ })
+
+ it('should accept arguments', function(){
+ ejs.render('<%=: users | map:"name" | join:", " %>', { users: users })
+ .should.equal('tobi, loki, jane');
+ })
+
+ it('should accept arguments containing :', function(){
+ ejs.render('<%=: users | map:"name" | join:"::" %>', { users: users })
+ .should.equal('tobi::loki::jane');
+ })
+})
+
+describe('exceptions', function(){
+ it('should produce useful stack traces', function(done){
+ try {
+ ejs.render(fixture('error.ejs'), { filename: 'error.ejs' });
+ } catch (err) {
+ err.path.should.equal('error.ejs');
+ err.stack.split('\n').slice(0, 8).join('\n').should.equal(fixture('error.out'));
+ done();
+ }
+ })
+
+ it('should not include __stack if compileDebug is false', function() {
+ try {
+ ejs.render(fixture('error.ejs'), {
+ filename: 'error.ejs',
+ compileDebug: false
+ });
+ } catch (err) {
+ err.should.not.have.property('path');
+ err.stack.split('\n').slice(0, 8).join('\n').should.not.equal(fixture('error.out'));
+ }
+ });
+})
+
+describe('includes', function(){
+ it('should include ejs', function(){
+ var file = 'test/fixtures/include.ejs';
+ ejs.render(fixture('include.ejs'), { filename: file, pets: users, open: '[[', close: ']]' })
+ .should.equal(fixture('include.html'));
+ })
+
+ it('should work when nested', function(){
+ var file = 'test/fixtures/menu.ejs';
+ ejs.render(fixture('menu.ejs'), { filename: file, pets: users })
+ .should.equal(fixture('menu.html'));
+ })
+
+ it('should include arbitrary files as-is', function(){
+ var file = 'test/fixtures/include.css.ejs';
+ ejs.render(fixture('include.css.ejs'), { filename: file, pets: users })
+ .should.equal(fixture('include.css.html'));
+ })
+
+ it('should pass compileDebug to include', function(){
+ var file = 'test/fixtures/include.ejs';
+ var fn = ejs.compile(fixture('include.ejs'), { filename: file, open: '[[', close: ']]', compileDebug: false, client: true })
+ var str = fn.toString();
+ eval('var preFn = ' + str);
+ str.should.not.match(/__stack/);
+ (function() {
+ preFn({ pets: users });
+ }).should.not.throw();
+ })
+})
+
+describe('comments', function() {
+ it('should fully render with comments removed', function() {
+ ejs.render(fixture('comments.ejs'))
+ .should.equal(fixture('comments.html'));
+ })
+})
diff --git a/node_modules/ejs/test/fixtures/backslash.ejs b/node_modules/ejs/test/fixtures/backslash.ejs
new file mode 100644
index 0000000..eeb4a48
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/backslash.ejs
@@ -0,0 +1 @@
+\foo \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/backslash.html b/node_modules/ejs/test/fixtures/backslash.html
new file mode 100644
index 0000000..eeb4a48
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/backslash.html
@@ -0,0 +1 @@
+\foo \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/comments.ejs b/node_modules/ejs/test/fixtures/comments.ejs
new file mode 100644
index 0000000..ba34b0a
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/comments.ejs
@@ -0,0 +1,5 @@
+<li><a href="foo"><% // double-slash comment %>foo</li>
+<li><a href="bar"><% /* C-style comment */ %>bar</li>
+<li><a href="baz"><% // double-slash comment with newline
+ %>baz</li>
+<li><a href="qux"><% var x = 'qux'; // double-slash comment @ end of line %><%= x %></li> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/comments.html b/node_modules/ejs/test/fixtures/comments.html
new file mode 100644
index 0000000..f728923
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/comments.html
@@ -0,0 +1,4 @@
+<li><a href="foo">foo</li>
+<li><a href="bar">bar</li>
+<li><a href="baz">baz</li>
+<li><a href="qux">qux</li> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/double-quote.ejs b/node_modules/ejs/test/fixtures/double-quote.ejs
new file mode 100644
index 0000000..3bccdcf
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/double-quote.ejs
@@ -0,0 +1 @@
+<p><%= "lo" + 'ki' %>'s "wheelchair"</p> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/double-quote.html b/node_modules/ejs/test/fixtures/double-quote.html
new file mode 100644
index 0000000..6473979
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/double-quote.html
@@ -0,0 +1 @@
+<p>loki's "wheelchair"</p> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/error.ejs b/node_modules/ejs/test/fixtures/error.ejs
new file mode 100644
index 0000000..f032730
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/error.ejs
@@ -0,0 +1,5 @@
+<ul>
+ <% if (users) { %>
+ <p>Has users</p>
+ <% } %>
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/error.out b/node_modules/ejs/test/fixtures/error.out
new file mode 100644
index 0000000..a2c9108
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/error.out
@@ -0,0 +1,8 @@
+ReferenceError: error.ejs:2
+ 1| <ul>
+ >> 2| <% if (users) { %>
+ 3| <p>Has users</p>
+ 4| <% } %>
+ 5| </ul>
+
+users is not defined \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/fail.ejs b/node_modules/ejs/test/fixtures/fail.ejs
new file mode 100644
index 0000000..1a7a0f7
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/fail.ejs
@@ -0,0 +1 @@
+<% function foo() return 'foo'; %> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/include.css.ejs b/node_modules/ejs/test/fixtures/include.css.ejs
new file mode 100644
index 0000000..f47358b
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/include.css.ejs
@@ -0,0 +1 @@
+<style><% var value = 'bar' %><% include style.css %></style> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/include.css.html b/node_modules/ejs/test/fixtures/include.css.html
new file mode 100644
index 0000000..43343fe
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/include.css.html
@@ -0,0 +1,3 @@
+<style>body {
+ foo: 'bar';
+}</style> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/include.ejs b/node_modules/ejs/test/fixtures/include.ejs
new file mode 100644
index 0000000..8017337
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/include.ejs
@@ -0,0 +1,5 @@
+<ul>
+ [[ pets.forEach(function(pet){ ]]
+ [[ include pet ]]
+ [[ }) ]]
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/include.html b/node_modules/ejs/test/fixtures/include.html
new file mode 100644
index 0000000..ca3e298
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/include.html
@@ -0,0 +1,9 @@
+<ul>
+
+ <li>tobi</li>
+
+ <li>loki</li>
+
+ <li>jane</li>
+
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/includes/menu-item.ejs b/node_modules/ejs/test/fixtures/includes/menu-item.ejs
new file mode 100644
index 0000000..37cca5f
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/includes/menu-item.ejs
@@ -0,0 +1 @@
+<li><% include menu/item %></li> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/includes/menu/item.ejs b/node_modules/ejs/test/fixtures/includes/menu/item.ejs
new file mode 100644
index 0000000..8abc3fe
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/includes/menu/item.ejs
@@ -0,0 +1 @@
+<a href="/<%= url %>"><%= title %></a> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/menu.ejs b/node_modules/ejs/test/fixtures/menu.ejs
new file mode 100644
index 0000000..61fad41
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/menu.ejs
@@ -0,0 +1,11 @@
+<% var url = '/foo' -%>
+<% var title = 'Foo' -%>
+<% include includes/menu-item -%>
+
+<% var url = '/bar' -%>
+<% var title = 'Bar' -%>
+<% include includes/menu-item -%>
+
+<% var url = '/baz' -%>
+<% var title = 'Baz' -%>
+<% include includes/menu-item -%> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/menu.html b/node_modules/ejs/test/fixtures/menu.html
new file mode 100644
index 0000000..1f9e45f
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/menu.html
@@ -0,0 +1,3 @@
+<li><a href="//foo">Foo</a></li>
+<li><a href="//bar">Bar</a></li>
+<li><a href="//baz">Baz</a></li> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/messed.ejs b/node_modules/ejs/test/fixtures/messed.ejs
new file mode 100644
index 0000000..7d69033
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/messed.ejs
@@ -0,0 +1 @@
+<ul><%users.forEach(function(user){%><li><%=user.name%></li><%})%></ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/messed.html b/node_modules/ejs/test/fixtures/messed.html
new file mode 100644
index 0000000..1e49148
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/messed.html
@@ -0,0 +1 @@
+<ul><li>tobi</li><li>loki</li><li>jane</li></ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/newlines.ejs b/node_modules/ejs/test/fixtures/newlines.ejs
new file mode 100644
index 0000000..47401b2
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/newlines.ejs
@@ -0,0 +1,5 @@
+<ul>
+ <% users.forEach(function(user){ %>
+ <li><%= user.name %></li>
+ <% }) %>
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/newlines.html b/node_modules/ejs/test/fixtures/newlines.html
new file mode 100644
index 0000000..ca3e298
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/newlines.html
@@ -0,0 +1,9 @@
+<ul>
+
+ <li>tobi</li>
+
+ <li>loki</li>
+
+ <li>jane</li>
+
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/no.newlines.ejs b/node_modules/ejs/test/fixtures/no.newlines.ejs
new file mode 100644
index 0000000..029b461
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/no.newlines.ejs
@@ -0,0 +1,5 @@
+<ul>
+ <% users.forEach(function(user){ -%>
+ <li><%= user.name %></li>
+ <% }) -%>
+</ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/no.newlines.html b/node_modules/ejs/test/fixtures/no.newlines.html
new file mode 100644
index 0000000..6efee2c
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/no.newlines.html
@@ -0,0 +1,5 @@
+<ul>
+ <li>tobi</li>
+ <li>loki</li>
+ <li>jane</li>
+ </ul> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/para.ejs b/node_modules/ejs/test/fixtures/para.ejs
new file mode 100644
index 0000000..89da779
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/para.ejs
@@ -0,0 +1 @@
+<p>hey</p> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/pet.ejs b/node_modules/ejs/test/fixtures/pet.ejs
new file mode 100644
index 0000000..5788558
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/pet.ejs
@@ -0,0 +1 @@
+<li>[[= pet.name ]]</li> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/single-quote.ejs b/node_modules/ejs/test/fixtures/single-quote.ejs
new file mode 100644
index 0000000..1e35a95
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/single-quote.ejs
@@ -0,0 +1 @@
+<p><%= 'loki' %>'s wheelchair</p> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/single-quote.html b/node_modules/ejs/test/fixtures/single-quote.html
new file mode 100644
index 0000000..3125173
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/single-quote.html
@@ -0,0 +1 @@
+<p>loki's wheelchair</p> \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/style.css b/node_modules/ejs/test/fixtures/style.css
new file mode 100644
index 0000000..1630b8c
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/style.css
@@ -0,0 +1,3 @@
+body {
+ foo: '<%= value %>';
+} \ No newline at end of file
diff --git a/node_modules/ejs/test/fixtures/user.ejs b/node_modules/ejs/test/fixtures/user.ejs
new file mode 100644
index 0000000..b312b5d
--- /dev/null
+++ b/node_modules/ejs/test/fixtures/user.ejs
@@ -0,0 +1 @@
+<h1>{= name}</h1> \ No newline at end of file
diff --git a/node_modules/express/.npmignore b/node_modules/express/.npmignore
new file mode 100644
index 0000000..caf574d
--- /dev/null
+++ b/node_modules/express/.npmignore
@@ -0,0 +1,9 @@
+.git*
+docs/
+examples/
+support/
+test/
+testing.js
+.DS_Store
+coverage.html
+lib-cov
diff --git a/node_modules/express/.travis.yml b/node_modules/express/.travis.yml
new file mode 100644
index 0000000..cc4dba2
--- /dev/null
+++ b/node_modules/express/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.8"
+ - "0.10"
diff --git a/node_modules/express/History.md b/node_modules/express/History.md
new file mode 100644
index 0000000..1166646
--- /dev/null
+++ b/node_modules/express/History.md
@@ -0,0 +1,1183 @@
+
+3.3.4 / 2013-07-08
+==================
+
+ * update send and connect
+
+3.3.3 / 2013-07-04
+==================
+
+ * update connect
+
+3.3.2 / 2013-07-03
+==================
+
+ * update connect
+ * update send
+ * remove .version export
+
+3.3.1 / 2013-06-27
+==================
+
+ * update connect
+
+3.3.0 / 2013-06-26
+==================
+
+ * update connect
+ * add support for multiple X-Forwarded-Proto values. Closes #1646
+ * change: remove charset from json responses. Closes #1631
+ * change: return actual booleans from req.accept* functions
+ * fix jsonp callback array throw
+
+3.2.6 / 2013-06-02
+==================
+
+ * update connect
+
+3.2.5 / 2013-05-21
+==================
+
+ * update connect
+ * update node-cookie
+ * add: throw a meaningful error when there is no default engine
+ * change generation of ETags with res.send() to GET requests only. Closes #1619
+
+3.2.4 / 2013-05-09
+==================
+
+ * fix `req.subdomains` when no Host is present
+ * fix `req.host` when no Host is present, return undefined
+
+3.2.3 / 2013-05-07
+==================
+
+ * update connect / qs
+
+3.2.2 / 2013-05-03
+==================
+
+ * update qs
+
+3.2.1 / 2013-04-29
+==================
+
+ * add app.VERB() paths array deprecation warning
+ * update connect
+ * update qs and remove all ~ semver crap
+ * fix: accept number as value of Signed Cookie
+
+3.2.0 / 2013-04-15
+==================
+
+ * add "view" constructor setting to override view behaviour
+ * add req.acceptsEncoding(name)
+ * add req.acceptedEncodings
+ * revert cookie signature change causing session race conditions
+ * fix sorting of Accept values of the same quality
+
+3.1.2 / 2013-04-12
+==================
+
+ * add support for custom Accept parameters
+ * update cookie-signature
+
+3.1.1 / 2013-04-01
+==================
+
+ * add X-Forwarded-Host support to `req.host`
+ * fix relative redirects
+ * update mkdirp
+ * update buffer-crc32
+ * remove legacy app.configure() method from app template.
+
+3.1.0 / 2013-01-25
+==================
+
+ * add support for leading "." in "view engine" setting
+ * add array support to `res.set()`
+ * add node 0.8.x to travis.yml
+ * add "subdomain offset" setting for tweaking `req.subdomains`
+ * add `res.location(url)` implementing `res.redirect()`-like setting of Location
+ * use app.get() for x-powered-by setting for inheritance
+ * fix colons in passwords for `req.auth`
+
+3.0.6 / 2013-01-04
+==================
+
+ * add http verb methods to Router
+ * update connect
+ * fix mangling of the `res.cookie()` options object
+ * fix jsonp whitespace escape. Closes #1132
+
+3.0.5 / 2012-12-19
+==================
+
+ * add throwing when a non-function is passed to a route
+ * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses
+ * revert "add 'etag' option"
+
+3.0.4 / 2012-12-05
+==================
+
+ * add 'etag' option to disable `res.send()` Etags
+ * add escaping of urls in text/plain in `res.redirect()`
+ for old browsers interpreting as html
+ * change crc32 module for a more liberal license
+ * update connect
+
+3.0.3 / 2012-11-13
+==================
+
+ * update connect
+ * update cookie module
+ * fix cookie max-age
+
+3.0.2 / 2012-11-08
+==================
+
+ * add OPTIONS to cors example. Closes #1398
+ * fix route chaining regression. Closes #1397
+
+3.0.1 / 2012-11-01
+==================
+
+ * update connect
+
+3.0.0 / 2012-10-23
+==================
+
+ * add `make clean`
+ * add "Basic" check to req.auth
+ * add `req.auth` test coverage
+ * add cb && cb(payload) to `res.jsonp()`. Closes #1374
+ * add backwards compat for `res.redirect()` status. Closes #1336
+ * add support for `res.json()` to retain previously defined Content-Types. Closes #1349
+ * update connect
+ * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382
+ * remove non-primitive string support for `res.send()`
+ * fix view-locals example. Closes #1370
+ * fix route-separation example
+
+3.0.0rc5 / 2012-09-18
+==================
+
+ * update connect
+ * add redis search example
+ * add static-files example
+ * add "x-powered-by" setting (`app.disable('x-powered-by')`)
+ * add "application/octet-stream" redirect Accept test case. Closes #1317
+
+3.0.0rc4 / 2012-08-30
+==================
+
+ * add `res.jsonp()`. Closes #1307
+ * add "verbose errors" option to error-pages example
+ * add another route example to express(1) so people are not so confused
+ * add redis online user activity tracking example
+ * update connect dep
+ * fix etag quoting. Closes #1310
+ * fix error-pages 404 status
+ * fix jsonp callback char restrictions
+ * remove old OPTIONS default response
+
+3.0.0rc3 / 2012-08-13
+==================
+
+ * update connect dep
+ * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds]
+ * fix `res.render()` clobbering of "locals"
+
+3.0.0rc2 / 2012-08-03
+==================
+
+ * add CORS example
+ * update connect dep
+ * deprecate `.createServer()` & remove old stale examples
+ * fix: escape `res.redirect()` link
+ * fix vhost example
+
+3.0.0rc1 / 2012-07-24
+==================
+
+ * add more examples to view-locals
+ * add scheme-relative redirects (`res.redirect("//foo.com")`) support
+ * update cookie dep
+ * update connect dep
+ * update send dep
+ * fix `express(1)` -h flag, use -H for hogan. Closes #1245
+ * fix `res.sendfile()` socket error handling regression
+
+3.0.0beta7 / 2012-07-16
+==================
+
+ * update connect dep for `send()` root normalization regression
+
+3.0.0beta6 / 2012-07-13
+==================
+
+ * add `err.view` property for view errors. Closes #1226
+ * add "jsonp callback name" setting
+ * add support for "/foo/:bar*" non-greedy matches
+ * change `res.sendfile()` to use `send()` module
+ * change `res.send` to use "response-send" module
+ * remove `app.locals.use` and `res.locals.use`, use regular middleware
+
+3.0.0beta5 / 2012-07-03
+==================
+
+ * add "make check" support
+ * add route-map example
+ * add `res.json(obj, status)` support back for BC
+ * add "methods" dep, remove internal methods module
+ * update connect dep
+ * update auth example to utilize cores pbkdf2
+ * updated tests to use "supertest"
+
+3.0.0beta4 / 2012-06-25
+==================
+
+ * Added `req.auth`
+ * Added `req.range(size)`
+ * Added `res.links(obj)`
+ * Added `res.send(body, status)` support back for backwards compat
+ * Added `.default()` support to `res.format()`
+ * Added 2xx / 304 check to `req.fresh`
+ * Revert "Added + support to the router"
+ * Fixed `res.send()` freshness check, respect res.statusCode
+
+3.0.0beta3 / 2012-06-15
+==================
+
+ * Added hogan `--hjs` to express(1) [nullfirm]
+ * Added another example to content-negotiation
+ * Added `fresh` dep
+ * Changed: `res.send()` always checks freshness
+ * Fixed: expose connects mime module. Cloases #1165
+
+3.0.0beta2 / 2012-06-06
+==================
+
+ * Added `+` support to the router
+ * Added `req.host`
+ * Changed `req.param()` to check route first
+ * Update connect dep
+
+3.0.0beta1 / 2012-06-01
+==================
+
+ * Added `res.format()` callback to override default 406 behaviour
+ * Fixed `res.redirect()` 406. Closes #1154
+
+3.0.0alpha5 / 2012-05-30
+==================
+
+ * Added `req.ip`
+ * Added `{ signed: true }` option to `res.cookie()`
+ * Removed `res.signedCookie()`
+ * Changed: dont reverse `req.ips`
+ * Fixed "trust proxy" setting check for `req.ips`
+
+3.0.0alpha4 / 2012-05-09
+==================
+
+ * Added: allow `[]` in jsonp callback. Closes #1128
+ * Added `PORT` env var support in generated template. Closes #1118 [benatkin]
+ * Updated: connect 2.2.2
+
+3.0.0alpha3 / 2012-05-04
+==================
+
+ * Added public `app.routes`. Closes #887
+ * Added _view-locals_ example
+ * Added _mvc_ example
+ * Added `res.locals.use()`. Closes #1120
+ * Added conditional-GET support to `res.send()`
+ * Added: coerce `res.set()` values to strings
+ * Changed: moved `static()` in generated apps below router
+ * Changed: `res.send()` only set ETag when not previously set
+ * Changed connect 2.2.1 dep
+ * Changed: `make test` now runs unit / acceptance tests
+ * Fixed req/res proto inheritance
+
+3.0.0alpha2 / 2012-04-26
+==================
+
+ * Added `make benchmark` back
+ * Added `res.send()` support for `String` objects
+ * Added client-side data exposing example
+ * Added `res.header()` and `req.header()` aliases for BC
+ * Added `express.createServer()` for BC
+ * Perf: memoize parsed urls
+ * Perf: connect 2.2.0 dep
+ * Changed: make `expressInit()` middleware self-aware
+ * Fixed: use app.get() for all core settings
+ * Fixed redis session example
+ * Fixed session example. Closes #1105
+ * Fixed generated express dep. Closes #1078
+
+3.0.0alpha1 / 2012-04-15
+==================
+
+ * Added `app.locals.use(callback)`
+ * Added `app.locals` object
+ * Added `app.locals(obj)`
+ * Added `res.locals` object
+ * Added `res.locals(obj)`
+ * Added `res.format()` for content-negotiation
+ * Added `app.engine()`
+ * Added `res.cookie()` JSON cookie support
+ * Added "trust proxy" setting
+ * Added `req.subdomains`
+ * Added `req.protocol`
+ * Added `req.secure`
+ * Added `req.path`
+ * Added `req.ips`
+ * Added `req.fresh`
+ * Added `req.stale`
+ * Added comma-delmited / array support for `req.accepts()`
+ * Added debug instrumentation
+ * Added `res.set(obj)`
+ * Added `res.set(field, value)`
+ * Added `res.get(field)`
+ * Added `app.get(setting)`. Closes #842
+ * Added `req.acceptsLanguage()`
+ * Added `req.acceptsCharset()`
+ * Added `req.accepted`
+ * Added `req.acceptedLanguages`
+ * Added `req.acceptedCharsets`
+ * Added "json replacer" setting
+ * Added "json spaces" setting
+ * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92
+ * Added `--less` support to express(1)
+ * Added `express.response` prototype
+ * Added `express.request` prototype
+ * Added `express.application` prototype
+ * Added `app.path()`
+ * Added `app.render()`
+ * Added `res.type()` to replace `res.contentType()`
+ * Changed: `res.redirect()` to add relative support
+ * Changed: enable "jsonp callback" by default
+ * Changed: renamed "case sensitive routes" to "case sensitive routing"
+ * Rewrite of all tests with mocha
+ * Removed "root" setting
+ * Removed `res.redirect('home')` support
+ * Removed `req.notify()`
+ * Removed `app.register()`
+ * Removed `app.redirect()`
+ * Removed `app.is()`
+ * Removed `app.helpers()`
+ * Removed `app.dynamicHelpers()`
+ * Fixed `res.sendfile()` with non-GET. Closes #723
+ * Fixed express(1) public dir for windows. Closes #866
+
+2.5.9/ 2012-04-02
+==================
+
+ * Added support for PURGE request method [pbuyle]
+ * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki]
+
+2.5.8 / 2012-02-08
+==================
+
+ * Update mkdirp dep. Closes #991
+
+2.5.7 / 2012-02-06
+==================
+
+ * Fixed `app.all` duplicate DELETE requests [mscdex]
+
+2.5.6 / 2012-01-13
+==================
+
+ * Updated hamljs dev dep. Closes #953
+
+2.5.5 / 2012-01-08
+==================
+
+ * Fixed: set `filename` on cached templates [matthewleon]
+
+2.5.4 / 2012-01-02
+==================
+
+ * Fixed `express(1)` eol on 0.4.x. Closes #947
+
+2.5.3 / 2011-12-30
+==================
+
+ * Fixed `req.is()` when a charset is present
+
+2.5.2 / 2011-12-10
+==================
+
+ * Fixed: express(1) LF -> CRLF for windows
+
+2.5.1 / 2011-11-17
+==================
+
+ * Changed: updated connect to 1.8.x
+ * Removed sass.js support from express(1)
+
+2.5.0 / 2011-10-24
+==================
+
+ * Added ./routes dir for generated app by default
+ * Added npm install reminder to express(1) app gen
+ * Added 0.5.x support
+ * Removed `make test-cov` since it wont work with node 0.5.x
+ * Fixed express(1) public dir for windows. Closes #866
+
+2.4.7 / 2011-10-05
+==================
+
+ * Added mkdirp to express(1). Closes #795
+ * Added simple _json-config_ example
+ * Added shorthand for the parsed request's pathname via `req.path`
+ * Changed connect dep to 1.7.x to fix npm issue...
+ * Fixed `res.redirect()` __HEAD__ support. [reported by xerox]
+ * Fixed `req.flash()`, only escape args
+ * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie]
+
+2.4.6 / 2011-08-22
+==================
+
+ * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode]
+
+2.4.5 / 2011-08-19
+==================
+
+ * Added support for routes to handle errors. Closes #809
+ * Added `app.routes.all()`. Closes #803
+ * Added "basepath" setting to work in conjunction with reverse proxies etc.
+ * Refactored `Route` to use a single array of callbacks
+ * Added support for multiple callbacks for `app.param()`. Closes #801
+Closes #805
+ * Changed: removed .call(self) for route callbacks
+ * Dependency: `qs >= 0.3.1`
+ * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808
+
+2.4.4 / 2011-08-05
+==================
+
+ * Fixed `res.header()` intention of a set, even when `undefined`
+ * Fixed `*`, value no longer required
+ * Fixed `res.send(204)` support. Closes #771
+
+2.4.3 / 2011-07-14
+==================
+
+ * Added docs for `status` option special-case. Closes #739
+ * Fixed `options.filename`, exposing the view path to template engines
+
+2.4.2. / 2011-07-06
+==================
+
+ * Revert "removed jsonp stripping" for XSS
+
+2.4.1 / 2011-07-06
+==================
+
+ * Added `res.json()` JSONP support. Closes #737
+ * Added _extending-templates_ example. Closes #730
+ * Added "strict routing" setting for trailing slashes
+ * Added support for multiple envs in `app.configure()` calls. Closes #735
+ * Changed: `res.send()` using `res.json()`
+ * Changed: when cookie `path === null` don't default it
+ * Changed; default cookie path to "home" setting. Closes #731
+ * Removed _pids/logs_ creation from express(1)
+
+2.4.0 / 2011-06-28
+==================
+
+ * Added chainable `res.status(code)`
+ * Added `res.json()`, an explicit version of `res.send(obj)`
+ * Added simple web-service example
+
+2.3.12 / 2011-06-22
+==================
+
+ * \#express is now on freenode! come join!
+ * Added `req.get(field, param)`
+ * Added links to Japanese documentation, thanks @hideyukisaito!
+ * Added; the `express(1)` generated app outputs the env
+ * Added `content-negotiation` example
+ * Dependency: connect >= 1.5.1 < 2.0.0
+ * Fixed view layout bug. Closes #720
+ * Fixed; ignore body on 304. Closes #701
+
+2.3.11 / 2011-06-04
+==================
+
+ * Added `npm test`
+ * Removed generation of dummy test file from `express(1)`
+ * Fixed; `express(1)` adds express as a dep
+ * Fixed; prune on `prepublish`
+
+2.3.10 / 2011-05-27
+==================
+
+ * Added `req.route`, exposing the current route
+ * Added _package.json_ generation support to `express(1)`
+ * Fixed call to `app.param()` function for optional params. Closes #682
+
+2.3.9 / 2011-05-25
+==================
+
+ * Fixed bug-ish with `../' in `res.partial()` calls
+
+2.3.8 / 2011-05-24
+==================
+
+ * Fixed `app.options()`
+
+2.3.7 / 2011-05-23
+==================
+
+ * Added route `Collection`, ex: `app.get('/user/:id').remove();`
+ * Added support for `app.param(fn)` to define param logic
+ * Removed `app.param()` support for callback with return value
+ * Removed module.parent check from express(1) generated app. Closes #670
+ * Refactored router. Closes #639
+
+2.3.6 / 2011-05-20
+==================
+
+ * Changed; using devDependencies instead of git submodules
+ * Fixed redis session example
+ * Fixed markdown example
+ * Fixed view caching, should not be enabled in development
+
+2.3.5 / 2011-05-20
+==================
+
+ * Added export `.view` as alias for `.View`
+
+2.3.4 / 2011-05-08
+==================
+
+ * Added `./examples/say`
+ * Fixed `res.sendfile()` bug preventing the transfer of files with spaces
+
+2.3.3 / 2011-05-03
+==================
+
+ * Added "case sensitive routes" option.
+ * Changed; split methods supported per rfc [slaskis]
+ * Fixed route-specific middleware when using the same callback function several times
+
+2.3.2 / 2011-04-27
+==================
+
+ * Fixed view hints
+
+2.3.1 / 2011-04-26
+==================
+
+ * Added `app.match()` as `app.match.all()`
+ * Added `app.lookup()` as `app.lookup.all()`
+ * Added `app.remove()` for `app.remove.all()`
+ * Added `app.remove.VERB()`
+ * Fixed template caching collision issue. Closes #644
+ * Moved router over from connect and started refactor
+
+2.3.0 / 2011-04-25
+==================
+
+ * Added options support to `res.clearCookie()`
+ * Added `res.helpers()` as alias of `res.locals()`
+ * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0`
+ * Changed; auto set Content-Type in res.attachement [Aaron Heckmann]
+ * Renamed "cache views" to "view cache". Closes #628
+ * Fixed caching of views when using several apps. Closes #637
+ * Fixed gotcha invoking `app.param()` callbacks once per route middleware.
+Closes #638
+ * Fixed partial lookup precedence. Closes #631
+Shaw]
+
+2.2.2 / 2011-04-12
+==================
+
+ * Added second callback support for `res.download()` connection errors
+ * Fixed `filename` option passing to template engine
+
+2.2.1 / 2011-04-04
+==================
+
+ * Added `layout(path)` helper to change the layout within a view. Closes #610
+ * Fixed `partial()` collection object support.
+ Previously only anything with `.length` would work.
+ When `.length` is present one must still be aware of holes,
+ however now `{ collection: {foo: 'bar'}}` is valid, exposes
+ `keyInCollection` and `keysInCollection`.
+
+ * Performance improved with better view caching
+ * Removed `request` and `response` locals
+ * Changed; errorHandler page title is now `Express` instead of `Connect`
+
+2.2.0 / 2011-03-30
+==================
+
+ * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606
+ * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606
+ * Added `app.VERB(path)` as alias of `app.lookup.VERB()`.
+ * Dependency `connect >= 1.2.0`
+
+2.1.1 / 2011-03-29
+==================
+
+ * Added; expose `err.view` object when failing to locate a view
+ * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann]
+ * Fixed; `res.send(undefined)` responds with 204 [aheckmann]
+
+2.1.0 / 2011-03-24
+==================
+
+ * Added `<root>/_?<name>` partial lookup support. Closes #447
+ * Added `request`, `response`, and `app` local variables
+ * Added `settings` local variable, containing the app's settings
+ * Added `req.flash()` exception if `req.session` is not available
+ * Added `res.send(bool)` support (json response)
+ * Fixed stylus example for latest version
+ * Fixed; wrap try/catch around `res.render()`
+
+2.0.0 / 2011-03-17
+==================
+
+ * Fixed up index view path alternative.
+ * Changed; `res.locals()` without object returns the locals
+
+2.0.0rc3 / 2011-03-17
+==================
+
+ * Added `res.locals(obj)` to compliment `res.local(key, val)`
+ * Added `res.partial()` callback support
+ * Fixed recursive error reporting issue in `res.render()`
+
+2.0.0rc2 / 2011-03-17
+==================
+
+ * Changed; `partial()` "locals" are now optional
+ * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01]
+ * Fixed .filename view engine option [reported by drudge]
+ * Fixed blog example
+ * Fixed `{req,res}.app` reference when mounting [Ben Weaver]
+
+2.0.0rc / 2011-03-14
+==================
+
+ * Fixed; expose `HTTPSServer` constructor
+ * Fixed express(1) default test charset. Closes #579 [reported by secoif]
+ * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP]
+
+2.0.0beta3 / 2011-03-09
+==================
+
+ * Added support for `res.contentType()` literal
+ The original `res.contentType('.json')`,
+ `res.contentType('application/json')`, and `res.contentType('json')`
+ will work now.
+ * Added `res.render()` status option support back
+ * Added charset option for `res.render()`
+ * Added `.charset` support (via connect 1.0.4)
+ * Added view resolution hints when in development and a lookup fails
+ * Added layout lookup support relative to the page view.
+ For example while rendering `./views/user/index.jade` if you create
+ `./views/user/layout.jade` it will be used in favour of the root layout.
+ * Fixed `res.redirect()`. RFC states absolute url [reported by unlink]
+ * Fixed; default `res.send()` string charset to utf8
+ * Removed `Partial` constructor (not currently used)
+
+2.0.0beta2 / 2011-03-07
+==================
+
+ * Added res.render() `.locals` support back to aid in migration process
+ * Fixed flash example
+
+2.0.0beta / 2011-03-03
+==================
+
+ * Added HTTPS support
+ * Added `res.cookie()` maxAge support
+ * Added `req.header()` _Referrer_ / _Referer_ special-case, either works
+ * Added mount support for `res.redirect()`, now respects the mount-point
+ * Added `union()` util, taking place of `merge(clone())` combo
+ * Added stylus support to express(1) generated app
+ * Added secret to session middleware used in examples and generated app
+ * Added `res.local(name, val)` for progressive view locals
+ * Added default param support to `req.param(name, default)`
+ * Added `app.disabled()` and `app.enabled()`
+ * Added `app.register()` support for omitting leading ".", either works
+ * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539
+ * Added `app.param()` to map route params to async/sync logic
+ * Added; aliased `app.helpers()` as `app.locals()`. Closes #481
+ * Added extname with no leading "." support to `res.contentType()`
+ * Added `cache views` setting, defaulting to enabled in "production" env
+ * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_.
+ * Added `req.accepts()` support for extensions
+ * Changed; `res.download()` and `res.sendfile()` now utilize Connect's
+ static file server `connect.static.send()`.
+ * Changed; replaced `connect.utils.mime()` with npm _mime_ module
+ * Changed; allow `req.query` to be pre-defined (via middleware or other parent
+ * Changed view partial resolution, now relative to parent view
+ * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`.
+ * Fixed `req.param()` bug returning Array.prototype methods. Closes #552
+ * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()`
+ * Fixed; using _qs_ module instead of _querystring_
+ * Fixed; strip unsafe chars from jsonp callbacks
+ * Removed "stream threshold" setting
+
+1.0.8 / 2011-03-01
+==================
+
+ * Allow `req.query` to be pre-defined (via middleware or other parent app)
+ * "connect": ">= 0.5.0 < 1.0.0". Closes #547
+ * Removed the long deprecated __EXPRESS_ENV__ support
+
+1.0.7 / 2011-02-07
+==================
+
+ * Fixed `render()` setting inheritance.
+ Mounted apps would not inherit "view engine"
+
+1.0.6 / 2011-02-07
+==================
+
+ * Fixed `view engine` setting bug when period is in dirname
+
+1.0.5 / 2011-02-05
+==================
+
+ * Added secret to generated app `session()` call
+
+1.0.4 / 2011-02-05
+==================
+
+ * Added `qs` dependency to _package.json_
+ * Fixed namespaced `require()`s for latest connect support
+
+1.0.3 / 2011-01-13
+==================
+
+ * Remove unsafe characters from JSONP callback names [Ryan Grove]
+
+1.0.2 / 2011-01-10
+==================
+
+ * Removed nested require, using `connect.router`
+
+1.0.1 / 2010-12-29
+==================
+
+ * Fixed for middleware stacked via `createServer()`
+ previously the `foo` middleware passed to `createServer(foo)`
+ would not have access to Express methods such as `res.send()`
+ or props like `req.query` etc.
+
+1.0.0 / 2010-11-16
+==================
+
+ * Added; deduce partial object names from the last segment.
+ For example by default `partial('forum/post', postObject)` will
+ give you the _post_ object, providing a meaningful default.
+ * Added http status code string representation to `res.redirect()` body
+ * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__.
+ * Added `req.is()` to aid in content negotiation
+ * Added partial local inheritance [suggested by masylum]. Closes #102
+ providing access to parent template locals.
+ * Added _-s, --session[s]_ flag to express(1) to add session related middleware
+ * Added _--template_ flag to express(1) to specify the
+ template engine to use.
+ * Added _--css_ flag to express(1) to specify the
+ stylesheet engine to use (or just plain css by default).
+ * Added `app.all()` support [thanks aheckmann]
+ * Added partial direct object support.
+ You may now `partial('user', user)` providing the "user" local,
+ vs previously `partial('user', { object: user })`.
+ * Added _route-separation_ example since many people question ways
+ to do this with CommonJS modules. Also view the _blog_ example for
+ an alternative.
+ * Performance; caching view path derived partial object names
+ * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454
+ * Fixed jsonp support; _text/javascript_ as per mailinglist discussion
+
+1.0.0rc4 / 2010-10-14
+==================
+
+ * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0
+ * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware))
+ * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass]
+ * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass]
+ * Added `partial()` support for array-like collections. Closes #434
+ * Added support for swappable querystring parsers
+ * Added session usage docs. Closes #443
+ * Added dynamic helper caching. Closes #439 [suggested by maritz]
+ * Added authentication example
+ * Added basic Range support to `res.sendfile()` (and `res.download()` etc)
+ * Changed; `express(1)` generated app using 2 spaces instead of 4
+ * Default env to "development" again [aheckmann]
+ * Removed _context_ option is no more, use "scope"
+ * Fixed; exposing _./support_ libs to examples so they can run without installs
+ * Fixed mvc example
+
+1.0.0rc3 / 2010-09-20
+==================
+
+ * Added confirmation for `express(1)` app generation. Closes #391
+ * Added extending of flash formatters via `app.flashFormatters`
+ * Added flash formatter support. Closes #411
+ * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold"
+ * Added _stream threshold_ setting for `res.sendfile()`
+ * Added `res.send()` __HEAD__ support
+ * Added `res.clearCookie()`
+ * Added `res.cookie()`
+ * Added `res.render()` headers option
+ * Added `res.redirect()` response bodies
+ * Added `res.render()` status option support. Closes #425 [thanks aheckmann]
+ * Fixed `res.sendfile()` responding with 403 on malicious path
+ * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_
+ * Fixed; mounted apps settings now inherit from parent app [aheckmann]
+ * Fixed; stripping Content-Length / Content-Type when 204
+ * Fixed `res.send()` 204. Closes #419
+ * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402
+ * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo]
+
+
+1.0.0rc2 / 2010-08-17
+==================
+
+ * Added `app.register()` for template engine mapping. Closes #390
+ * Added `res.render()` callback support as second argument (no options)
+ * Added callback support to `res.download()`
+ * Added callback support for `res.sendfile()`
+ * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()`
+ * Added "partials" setting to docs
+ * Added default expresso tests to `express(1)` generated app. Closes #384
+ * Fixed `res.sendfile()` error handling, defer via `next()`
+ * Fixed `res.render()` callback when a layout is used [thanks guillermo]
+ * Fixed; `make install` creating ~/.node_libraries when not present
+ * Fixed issue preventing error handlers from being defined anywhere. Closes #387
+
+1.0.0rc / 2010-07-28
+==================
+
+ * Added mounted hook. Closes #369
+ * Added connect dependency to _package.json_
+
+ * Removed "reload views" setting and support code
+ development env never caches, production always caches.
+
+ * Removed _param_ in route callbacks, signature is now
+ simply (req, res, next), previously (req, res, params, next).
+ Use _req.params_ for path captures, _req.query_ for GET params.
+
+ * Fixed "home" setting
+ * Fixed middleware/router precedence issue. Closes #366
+ * Fixed; _configure()_ callbacks called immediately. Closes #368
+
+1.0.0beta2 / 2010-07-23
+==================
+
+ * Added more examples
+ * Added; exporting `Server` constructor
+ * Added `Server#helpers()` for view locals
+ * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349
+ * Added support for absolute view paths
+ * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363
+ * Added Guillermo Rauch to the contributor list
+ * Added support for "as" for non-collection partials. Closes #341
+ * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf]
+ * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo]
+ * Fixed instanceof `Array` checks, now `Array.isArray()`
+ * Fixed express(1) expansion of public dirs. Closes #348
+ * Fixed middleware precedence. Closes #345
+ * Fixed view watcher, now async [thanks aheckmann]
+
+1.0.0beta / 2010-07-15
+==================
+
+ * Re-write
+ - much faster
+ - much lighter
+ - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs
+
+0.14.0 / 2010-06-15
+==================
+
+ * Utilize relative requires
+ * Added Static bufferSize option [aheckmann]
+ * Fixed caching of view and partial subdirectories [aheckmann]
+ * Fixed mime.type() comments now that ".ext" is not supported
+ * Updated haml submodule
+ * Updated class submodule
+ * Removed bin/express
+
+0.13.0 / 2010-06-01
+==================
+
+ * Added node v0.1.97 compatibility
+ * Added support for deleting cookies via Request#cookie('key', null)
+ * Updated haml submodule
+ * Fixed not-found page, now using using charset utf-8
+ * Fixed show-exceptions page, now using using charset utf-8
+ * Fixed view support due to fs.readFile Buffers
+ * Changed; mime.type() no longer accepts ".type" due to node extname() changes
+
+0.12.0 / 2010-05-22
+==================
+
+ * Added node v0.1.96 compatibility
+ * Added view `helpers` export which act as additional local variables
+ * Updated haml submodule
+ * Changed ETag; removed inode, modified time only
+ * Fixed LF to CRLF for setting multiple cookies
+ * Fixed cookie complation; values are now urlencoded
+ * Fixed cookies parsing; accepts quoted values and url escaped cookies
+
+0.11.0 / 2010-05-06
+==================
+
+ * Added support for layouts using different engines
+ - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' })
+ - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml'
+ - this.render('page.html.haml', { layout: false }) // no layout
+ * Updated ext submodule
+ * Updated haml submodule
+ * Fixed EJS partial support by passing along the context. Issue #307
+
+0.10.1 / 2010-05-03
+==================
+
+ * Fixed binary uploads.
+
+0.10.0 / 2010-04-30
+==================
+
+ * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s
+ encoding is set to 'utf8' or 'utf-8'.
+ * Added "encoding" option to Request#render(). Closes #299
+ * Added "dump exceptions" setting, which is enabled by default.
+ * Added simple ejs template engine support
+ * Added error reponse support for text/plain, application/json. Closes #297
+ * Added callback function param to Request#error()
+ * Added Request#sendHead()
+ * Added Request#stream()
+ * Added support for Request#respond(304, null) for empty response bodies
+ * Added ETag support to Request#sendfile()
+ * Added options to Request#sendfile(), passed to fs.createReadStream()
+ * Added filename arg to Request#download()
+ * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request
+ * Performance enhanced by preventing several calls to toLowerCase() in Router#match()
+ * Changed; Request#sendfile() now streams
+ * Changed; Renamed Request#halt() to Request#respond(). Closes #289
+ * Changed; Using sys.inspect() instead of JSON.encode() for error output
+ * Changed; run() returns the http.Server instance. Closes #298
+ * Changed; Defaulting Server#host to null (INADDR_ANY)
+ * Changed; Logger "common" format scale of 0.4f
+ * Removed Logger "request" format
+ * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found
+ * Fixed several issues with http client
+ * Fixed Logger Content-Length output
+ * Fixed bug preventing Opera from retaining the generated session id. Closes #292
+
+0.9.0 / 2010-04-14
+==================
+
+ * Added DSL level error() route support
+ * Added DSL level notFound() route support
+ * Added Request#error()
+ * Added Request#notFound()
+ * Added Request#render() callback function. Closes #258
+ * Added "max upload size" setting
+ * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254
+ * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js
+ * Added callback function support to Request#halt() as 3rd/4th arg
+ * Added preprocessing of route param wildcards using param(). Closes #251
+ * Added view partial support (with collections etc)
+ * Fixed bug preventing falsey params (such as ?page=0). Closes #286
+ * Fixed setting of multiple cookies. Closes #199
+ * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml)
+ * Changed; session cookie is now httpOnly
+ * Changed; Request is no longer global
+ * Changed; Event is no longer global
+ * Changed; "sys" module is no longer global
+ * Changed; moved Request#download to Static plugin where it belongs
+ * Changed; Request instance created before body parsing. Closes #262
+ * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253
+ * Changed; Pre-caching view partials in memory when "cache view partials" is enabled
+ * Updated support to node --version 0.1.90
+ * Updated dependencies
+ * Removed set("session cookie") in favour of use(Session, { cookie: { ... }})
+ * Removed utils.mixin(); use Object#mergeDeep()
+
+0.8.0 / 2010-03-19
+==================
+
+ * Added coffeescript example app. Closes #242
+ * Changed; cache api now async friendly. Closes #240
+ * Removed deprecated 'express/static' support. Use 'express/plugins/static'
+
+0.7.6 / 2010-03-19
+==================
+
+ * Added Request#isXHR. Closes #229
+ * Added `make install` (for the executable)
+ * Added `express` executable for setting up simple app templates
+ * Added "GET /public/*" to Static plugin, defaulting to <root>/public
+ * Added Static plugin
+ * Fixed; Request#render() only calls cache.get() once
+ * Fixed; Namespacing View caches with "view:"
+ * Fixed; Namespacing Static caches with "static:"
+ * Fixed; Both example apps now use the Static plugin
+ * Fixed set("views"). Closes #239
+ * Fixed missing space for combined log format
+ * Deprecated Request#sendfile() and 'express/static'
+ * Removed Server#running
+
+0.7.5 / 2010-03-16
+==================
+
+ * Added Request#flash() support without args, now returns all flashes
+ * Updated ext submodule
+
+0.7.4 / 2010-03-16
+==================
+
+ * Fixed session reaper
+ * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft)
+
+0.7.3 / 2010-03-16
+==================
+
+ * Added package.json
+ * Fixed requiring of haml / sass due to kiwi removal
+
+0.7.2 / 2010-03-16
+==================
+
+ * Fixed GIT submodules (HAH!)
+
+0.7.1 / 2010-03-16
+==================
+
+ * Changed; Express now using submodules again until a PM is adopted
+ * Changed; chat example using millisecond conversions from ext
+
+0.7.0 / 2010-03-15
+==================
+
+ * Added Request#pass() support (finds the next matching route, or the given path)
+ * Added Logger plugin (default "common" format replaces CommonLogger)
+ * Removed Profiler plugin
+ * Removed CommonLogger plugin
+
+0.6.0 / 2010-03-11
+==================
+
+ * Added seed.yml for kiwi package management support
+ * Added HTTP client query string support when method is GET. Closes #205
+
+ * Added support for arbitrary view engines.
+ For example "foo.engine.html" will now require('engine'),
+ the exports from this module are cached after the first require().
+
+ * Added async plugin support
+
+ * Removed usage of RESTful route funcs as http client
+ get() etc, use http.get() and friends
+
+ * Removed custom exceptions
+
+0.5.0 / 2010-03-10
+==================
+
+ * Added ext dependency (library of js extensions)
+ * Removed extname() / basename() utils. Use path module
+ * Removed toArray() util. Use arguments.values
+ * Removed escapeRegexp() util. Use RegExp.escape()
+ * Removed process.mixin() dependency. Use utils.mixin()
+ * Removed Collection
+ * Removed ElementCollection
+ * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;)
+
+0.4.0 / 2010-02-11
+==================
+
+ * Added flash() example to sample upload app
+ * Added high level restful http client module (express/http)
+ * Changed; RESTful route functions double as HTTP clients. Closes #69
+ * Changed; throwing error when routes are added at runtime
+ * Changed; defaulting render() context to the current Request. Closes #197
+ * Updated haml submodule
+
+0.3.0 / 2010-02-11
+==================
+
+ * Updated haml / sass submodules. Closes #200
+ * Added flash message support. Closes #64
+ * Added accepts() now allows multiple args. fixes #117
+ * Added support for plugins to halt. Closes #189
+ * Added alternate layout support. Closes #119
+ * Removed Route#run(). Closes #188
+ * Fixed broken specs due to use(Cookie) missing
+
+0.2.1 / 2010-02-05
+==================
+
+ * Added "plot" format option for Profiler (for gnuplot processing)
+ * Added request number to Profiler plugin
+ * Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8
+ * Fixed issue with routes not firing when not files are present. Closes #184
+ * Fixed process.Promise -> events.Promise
+
+0.2.0 / 2010-02-03
+==================
+
+ * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180
+ * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174
+ * Added expiration support to cache api with reaper. Closes #133
+ * Added cache Store.Memory#reap()
+ * Added Cache; cache api now uses first class Cache instances
+ * Added abstract session Store. Closes #172
+ * Changed; cache Memory.Store#get() utilizing Collection
+ * Renamed MemoryStore -> Store.Memory
+ * Fixed use() of the same plugin several time will always use latest options. Closes #176
+
+0.1.0 / 2010-02-03
+==================
+
+ * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context
+ * Updated node support to 0.1.27 Closes #169
+ * Updated dirname(__filename) -> __dirname
+ * Updated libxmljs support to v0.2.0
+ * Added session support with memory store / reaping
+ * Added quick uid() helper
+ * Added multi-part upload support
+ * Added Sass.js support / submodule
+ * Added production env caching view contents and static files
+ * Added static file caching. Closes #136
+ * Added cache plugin with memory stores
+ * Added support to StaticFile so that it works with non-textual files.
+ * Removed dirname() helper
+ * Removed several globals (now their modules must be required)
+
+0.0.2 / 2010-01-10
+==================
+
+ * Added view benchmarks; currently haml vs ejs
+ * Added Request#attachment() specs. Closes #116
+ * Added use of node's parseQuery() util. Closes #123
+ * Added `make init` for submodules
+ * Updated Haml
+ * Updated sample chat app to show messages on load
+ * Updated libxmljs parseString -> parseHtmlString
+ * Fixed `make init` to work with older versions of git
+ * Fixed specs can now run independant specs for those who cant build deps. Closes #127
+ * Fixed issues introduced by the node url module changes. Closes 126.
+ * Fixed two assertions failing due to Collection#keys() returning strings
+ * Fixed faulty Collection#toArray() spec due to keys() returning strings
+ * Fixed `make test` now builds libxmljs.node before testing
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/LICENSE b/node_modules/express/LICENSE
new file mode 100644
index 0000000..36075a3
--- /dev/null
+++ b/node_modules/express/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2009-2011 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/Makefile b/node_modules/express/Makefile
new file mode 100644
index 0000000..228f299
--- /dev/null
+++ b/node_modules/express/Makefile
@@ -0,0 +1,33 @@
+
+MOCHA_OPTS= --check-leaks
+REPORTER = dot
+
+check: test
+
+test: test-unit test-acceptance
+
+test-unit:
+ @NODE_ENV=test ./node_modules/.bin/mocha \
+ --reporter $(REPORTER) \
+ $(MOCHA_OPTS)
+
+test-acceptance:
+ @NODE_ENV=test ./node_modules/.bin/mocha \
+ --reporter $(REPORTER) \
+ --bail \
+ test/acceptance/*.js
+
+test-cov: lib-cov
+ @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
+
+lib-cov:
+ @jscoverage lib lib-cov
+
+benchmark:
+ @./support/bench
+
+clean:
+ rm -f coverage.html
+ rm -fr lib-cov
+
+.PHONY: test test-unit test-acceptance benchmark clean
diff --git a/node_modules/express/Readme.md b/node_modules/express/Readme.md
new file mode 100644
index 0000000..00158b8
--- /dev/null
+++ b/node_modules/express/Readme.md
@@ -0,0 +1,179 @@
+![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)
+
+ Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express)
+
+```js
+var express = require('express');
+var app = express();
+
+app.get('/', function(req, res){
+ res.send('Hello World');
+});
+
+app.listen(3000);
+```
+
+## Installation
+
+ $ npm install -g express
+
+## Quick Start
+
+ The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
+
+ Create the app:
+
+ $ npm install -g express
+ $ express /tmp/foo && cd /tmp/foo
+
+ Install dependencies:
+
+ $ npm install
+
+ Start the server:
+
+ $ node app
+
+## Features
+
+ * Built on [Connect](http://github.com/senchalabs/connect)
+ * Robust routing
+ * HTTP helpers (redirection, caching, etc)
+ * View system supporting 14+ template engines
+ * Content negotiation
+ * Focus on high performance
+ * Environment based configuration
+ * Executable for generating applications quickly
+ * High test coverage
+
+## Philosophy
+
+ The Express philosophy is to provide small, robust tooling for HTTP servers. Making
+ it a great solution for single page applications, web sites, hybrids, or public
+ HTTP APIs.
+
+ Built on Connect you can use _only_ what you need, and nothing more, applications
+ can be as big or as small as you like, even a single file. Express does
+ not force you to use any specific ORM or template engine. With support for over
+ 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)
+ you can quickly craft your perfect framework.
+
+## More Information
+
+ * Join #express on freenode
+ * [Google Group](http://groups.google.com/group/express-js) for discussion
+ * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
+ * Visit the [Wiki](http://github.com/visionmedia/express/wiki)
+ * [Русскоязычная документация](http://jsman.ru/express/)
+ * Run express examples [online](https://runnable.com/express)
+
+## Viewing Examples
+
+Clone the Express repo, then install the dev dependencies to install all the example / test suite deps:
+
+ $ git clone git://github.com/visionmedia/express.git --depth 1
+ $ cd express
+ $ npm install
+
+then run whichever tests you want:
+
+ $ node examples/content-negotiation
+
+## Running Tests
+
+To run the test suite first invoke the following command within the repo, installing the development dependencies:
+
+ $ npm install
+
+then run the tests:
+
+ $ make test
+
+## Contributors
+
+```
+project: express
+commits: 3559
+active : 468 days
+files : 237
+authors:
+ 1891 Tj Holowaychuk 53.1%
+ 1285 visionmedia 36.1%
+ 182 TJ Holowaychuk 5.1%
+ 54 Aaron Heckmann 1.5%
+ 34 csausdev 1.0%
+ 26 ciaranj 0.7%
+ 21 Robert Sköld 0.6%
+ 6 Guillermo Rauch 0.2%
+ 3 Dav Glass 0.1%
+ 3 Nick Poulden 0.1%
+ 2 Randy Merrill 0.1%
+ 2 Benny Wong 0.1%
+ 2 Hunter Loftis 0.1%
+ 2 Jake Gordon 0.1%
+ 2 Brian McKinney 0.1%
+ 2 Roman Shtylman 0.1%
+ 2 Ben Weaver 0.1%
+ 2 Dave Hoover 0.1%
+ 2 Eivind Fjeldstad 0.1%
+ 2 Daniel Shaw 0.1%
+ 1 Matt Colyer 0.0%
+ 1 Pau Ramon 0.0%
+ 1 Pero Pejovic 0.0%
+ 1 Peter Rekdal Sunde 0.0%
+ 1 Raynos 0.0%
+ 1 Teng Siong Ong 0.0%
+ 1 Viktor Kelemen 0.0%
+ 1 ctide 0.0%
+ 1 8bitDesigner 0.0%
+ 1 isaacs 0.0%
+ 1 mgutz 0.0%
+ 1 pikeas 0.0%
+ 1 shuwatto 0.0%
+ 1 tstrimple 0.0%
+ 1 ewoudj 0.0%
+ 1 Adam Sanderson 0.0%
+ 1 Andrii Kostenko 0.0%
+ 1 Andy Hiew 0.0%
+ 1 Arpad Borsos 0.0%
+ 1 Ashwin Purohit 0.0%
+ 1 Benjen 0.0%
+ 1 Darren Torpey 0.0%
+ 1 Greg Ritter 0.0%
+ 1 Gregory Ritter 0.0%
+ 1 James Herdman 0.0%
+ 1 Jim Snodgrass 0.0%
+ 1 Joe McCann 0.0%
+ 1 Jonathan Dumaine 0.0%
+ 1 Jonathan Palardy 0.0%
+ 1 Jonathan Zacsh 0.0%
+ 1 Justin Lilly 0.0%
+ 1 Ken Sato 0.0%
+ 1 Maciej Małecki 0.0%
+ 1 Masahiro Hayashi 0.0%
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/bin/express b/node_modules/express/bin/express
new file mode 100644
index 0000000..b2b98c8
--- /dev/null
+++ b/node_modules/express/bin/express
@@ -0,0 +1,422 @@
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var exec = require('child_process').exec
+ , program = require('commander')
+ , mkdirp = require('mkdirp')
+ , pkg = require('../package.json')
+ , version = pkg.version
+ , os = require('os')
+ , fs = require('fs');
+
+// CLI
+
+program
+ .version(version)
+ .option('-s, --sessions', 'add session support')
+ .option('-e, --ejs', 'add ejs engine support (defaults to jade)')
+ .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
+ .option('-H, --hogan', 'add hogan.js engine support')
+ .option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
+ .option('-f, --force', 'force on non-empty directory')
+ .parse(process.argv);
+
+// Path
+
+var path = program.args.shift() || '.';
+
+// end-of-line code
+
+var eol = os.EOL
+
+// Template engine
+
+program.template = 'jade';
+if (program.ejs) program.template = 'ejs';
+if (program.jshtml) program.template = 'jshtml';
+if (program.hogan) program.template = 'hjs';
+
+/**
+ * Routes index template.
+ */
+
+var index = [
+ ''
+ , '/*'
+ , ' * GET home page.'
+ , ' */'
+ , ''
+ , 'exports.index = function(req, res){'
+ , ' res.render(\'index\', { title: \'Express\' });'
+ , '};'
+].join(eol);
+
+/**
+ * Routes users template.
+ */
+
+var users = [
+ ''
+ , '/*'
+ , ' * GET users listing.'
+ , ' */'
+ , ''
+ , 'exports.list = function(req, res){'
+ , ' res.send("respond with a resource");'
+ , '};'
+].join(eol);
+
+/**
+ * Jade layout template.
+ */
+
+var jadeLayout = [
+ 'doctype 5'
+ , 'html'
+ , ' head'
+ , ' title= title'
+ , ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'
+ , ' body'
+ , ' block content'
+].join(eol);
+
+/**
+ * Jade index template.
+ */
+
+var jadeIndex = [
+ 'extends layout'
+ , ''
+ , 'block content'
+ , ' h1= title'
+ , ' p Welcome to #{title}'
+].join(eol);
+
+/**
+ * EJS index template.
+ */
+
+var ejsIndex = [
+ '<!DOCTYPE html>'
+ , '<html>'
+ , ' <head>'
+ , ' <title><%= title %></title>'
+ , ' <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+ , ' </head>'
+ , ' <body>'
+ , ' <h1><%= title %></h1>'
+ , ' <p>Welcome to <%= title %></p>'
+ , ' </body>'
+ , '</html>'
+].join(eol);
+
+/**
+ * JSHTML layout template.
+ */
+
+var jshtmlLayout = [
+ '<!DOCTYPE html>'
+ , '<html>'
+ , ' <head>'
+ , ' <title> @write(title) </title>'
+ , ' <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+ , ' </head>'
+ , ' <body>'
+ , ' @write(body)'
+ , ' </body>'
+ , '</html>'
+].join(eol);
+
+/**
+ * JSHTML index template.
+ */
+
+var jshtmlIndex = [
+ '<h1>@write(title)</h1>'
+ , '<p>Welcome to @write(title)</p>'
+].join(eol);
+
+/**
+ * Hogan.js index template.
+ */
+var hoganIndex = [
+ '<!DOCTYPE html>'
+ , '<html>'
+ , ' <head>'
+ , ' <title>{{ title }}</title>'
+ , ' <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+ , ' </head>'
+ , ' <body>'
+ , ' <h1>{{ title }}</h1>'
+ , ' <p>Welcome to {{ title }}</p>'
+ , ' </body>'
+ , '</html>'
+].join(eol);
+
+/**
+ * Default css template.
+ */
+
+var css = [
+ 'body {'
+ , ' padding: 50px;'
+ , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+ , '}'
+ , ''
+ , 'a {'
+ , ' color: #00B7FF;'
+ , '}'
+].join(eol);
+
+/**
+ * Default less template.
+ */
+
+var less = [
+ 'body {'
+ , ' padding: 50px;'
+ , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+ , '}'
+ , ''
+ , 'a {'
+ , ' color: #00B7FF;'
+ , '}'
+].join(eol);
+
+/**
+ * Default stylus template.
+ */
+
+var stylus = [
+ 'body'
+ , ' padding: 50px'
+ , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif'
+ , 'a'
+ , ' color: #00B7FF'
+].join(eol);
+
+/**
+ * App template.
+ */
+
+var app = [
+ ''
+ , '/**'
+ , ' * Module dependencies.'
+ , ' */'
+ , ''
+ , 'var express = require(\'express\')'
+ , ' , routes = require(\'./routes\')'
+ , ' , user = require(\'./routes/user\')'
+ , ' , http = require(\'http\')'
+ , ' , path = require(\'path\');'
+ , ''
+ , 'var app = express();'
+ , ''
+ , '// all environments'
+ , 'app.set(\'port\', process.env.PORT || 3000);'
+ , 'app.set(\'views\', __dirname + \'/views\');'
+ , 'app.set(\'view engine\', \':TEMPLATE\');'
+ , 'app.use(express.favicon());'
+ , 'app.use(express.logger(\'dev\'));'
+ , 'app.use(express.bodyParser());'
+ , 'app.use(express.methodOverride());{sess}'
+ , 'app.use(app.router);{css}'
+ , 'app.use(express.static(path.join(__dirname, \'public\')));'
+ , ''
+ , '// development only'
+ , 'if (\'development\' == app.get(\'env\')) {'
+ , ' app.use(express.errorHandler());'
+ , '}'
+ , ''
+ , 'app.get(\'/\', routes.index);'
+ , 'app.get(\'/users\', user.list);'
+ , ''
+ , 'http.createServer(app).listen(app.get(\'port\'), function(){'
+ , ' console.log(\'Express server listening on port \' + app.get(\'port\'));'
+ , '});'
+ , ''
+].join(eol);
+
+// Generate application
+
+(function createApplication(path) {
+ emptyDirectory(path, function(empty){
+ if (empty || program.force) {
+ createApplicationAt(path);
+ } else {
+ program.confirm('destination is not empty, continue? ', function(ok){
+ if (ok) {
+ process.stdin.destroy();
+ createApplicationAt(path);
+ } else {
+ abort('aborting');
+ }
+ });
+ }
+ });
+})(path);
+
+/**
+ * Create application at the given directory `path`.
+ *
+ * @param {String} path
+ */
+
+function createApplicationAt(path) {
+ console.log();
+ process.on('exit', function(){
+ console.log();
+ console.log(' install dependencies:');
+ console.log(' $ cd %s && npm install', path);
+ console.log();
+ console.log(' run the app:');
+ console.log(' $ node app');
+ console.log();
+ });
+
+ mkdir(path, function(){
+ mkdir(path + '/public');
+ mkdir(path + '/public/javascripts');
+ mkdir(path + '/public/images');
+ mkdir(path + '/public/stylesheets', function(){
+ switch (program.css) {
+ case 'less':
+ write(path + '/public/stylesheets/style.less', less);
+ break;
+ case 'stylus':
+ write(path + '/public/stylesheets/style.styl', stylus);
+ break;
+ default:
+ write(path + '/public/stylesheets/style.css', css);
+ }
+ });
+
+ mkdir(path + '/routes', function(){
+ write(path + '/routes/index.js', index);
+ write(path + '/routes/user.js', users);
+ });
+
+ mkdir(path + '/views', function(){
+ switch (program.template) {
+ case 'ejs':
+ write(path + '/views/index.ejs', ejsIndex);
+ break;
+ case 'jade':
+ write(path + '/views/layout.jade', jadeLayout);
+ write(path + '/views/index.jade', jadeIndex);
+ break;
+ case 'jshtml':
+ write(path + '/views/layout.jshtml', jshtmlLayout);
+ write(path + '/views/index.jshtml', jshtmlIndex);
+ break;
+ case 'hjs':
+ write(path + '/views/index.hjs', hoganIndex);
+ break;
+
+ }
+ });
+
+ // CSS Engine support
+ switch (program.css) {
+ case 'less':
+ app = app.replace('{css}', eol + 'app.use(require(\'less-middleware\')({ src: __dirname + \'/public\' }));');
+ break;
+ case 'stylus':
+ app = app.replace('{css}', eol + 'app.use(require(\'stylus\').middleware(__dirname + \'/public\'));');
+ break;
+ default:
+ app = app.replace('{css}', '');
+ }
+
+ // Session support
+ app = app.replace('{sess}', program.sessions
+ ? eol + 'app.use(express.cookieParser(\'your secret here\'));' + eol + 'app.use(express.session());'
+ : '');
+
+ // Template support
+ app = app.replace(':TEMPLATE', program.template);
+
+ // package.json
+ var pkg = {
+ name: 'application-name'
+ , version: '0.0.1'
+ , private: true
+ , scripts: { start: 'node app.js' }
+ , dependencies: {
+ express: version
+ }
+ }
+
+ if (program.template) pkg.dependencies[program.template] = '*';
+
+ // CSS Engine support
+ switch (program.css) {
+ case 'less':
+ pkg.dependencies['less-middleware'] = '*';
+ break;
+ default:
+ if (program.css) {
+ pkg.dependencies[program.css] = '*';
+ }
+ }
+
+ write(path + '/package.json', JSON.stringify(pkg, null, 2));
+ write(path + '/app.js', app);
+ });
+}
+
+/**
+ * Check if the given directory `path` is empty.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function emptyDirectory(path, fn) {
+ fs.readdir(path, function(err, files){
+ if (err && 'ENOENT' != err.code) throw err;
+ fn(!files || !files.length);
+ });
+}
+
+/**
+ * echo str > path.
+ *
+ * @param {String} path
+ * @param {String} str
+ */
+
+function write(path, str) {
+ fs.writeFile(path, str);
+ console.log(' \x1b[36mcreate\x1b[0m : ' + path);
+}
+
+/**
+ * Mkdir -p.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function mkdir(path, fn) {
+ mkdirp(path, 0755, function(err){
+ if (err) throw err;
+ console.log(' \033[36mcreate\033[0m : ' + path);
+ fn && fn();
+ });
+}
+
+/**
+ * Exit with the given `str`.
+ *
+ * @param {String} str
+ */
+
+function abort(str) {
+ console.error(str);
+ process.exit(1);
+}
diff --git a/node_modules/express/index.js b/node_modules/express/index.js
new file mode 100644
index 0000000..bfe9934
--- /dev/null
+++ b/node_modules/express/index.js
@@ -0,0 +1,4 @@
+
+module.exports = process.env.EXPRESS_COV
+ ? require('./lib-cov/express')
+ : require('./lib/express'); \ No newline at end of file
diff --git a/node_modules/express/lib/application.js b/node_modules/express/lib/application.js
new file mode 100644
index 0000000..5500655
--- /dev/null
+++ b/node_modules/express/lib/application.js
@@ -0,0 +1,535 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+ , Router = require('./router')
+ , methods = require('methods')
+ , middleware = require('./middleware')
+ , debug = require('debug')('express:application')
+ , locals = require('./utils').locals
+ , View = require('./view')
+ , utils = connect.utils
+ , path = require('path')
+ , http = require('http')
+ , join = path.join;
+
+/**
+ * Application prototype.
+ */
+
+var app = exports = module.exports = {};
+
+/**
+ * Initialize the server.
+ *
+ * - setup default configuration
+ * - setup default middleware
+ * - setup route reflection methods
+ *
+ * @api private
+ */
+
+app.init = function(){
+ this.cache = {};
+ this.settings = {};
+ this.engines = {};
+ this.defaultConfiguration();
+};
+
+/**
+ * Initialize application configuration.
+ *
+ * @api private
+ */
+
+app.defaultConfiguration = function(){
+ // default settings
+ this.enable('x-powered-by');
+ this.set('env', process.env.NODE_ENV || 'development');
+ this.set('subdomain offset', 2);
+ debug('booting in %s mode', this.get('env'));
+
+ // implicit middleware
+ this.use(connect.query());
+ this.use(middleware.init(this));
+
+ // inherit protos
+ this.on('mount', function(parent){
+ this.request.__proto__ = parent.request;
+ this.response.__proto__ = parent.response;
+ this.engines.__proto__ = parent.engines;
+ this.settings.__proto__ = parent.settings;
+ });
+
+ // router
+ this._router = new Router(this);
+ this.routes = this._router.map;
+ this.__defineGetter__('router', function(){
+ this._usedRouter = true;
+ this._router.caseSensitive = this.enabled('case sensitive routing');
+ this._router.strict = this.enabled('strict routing');
+ return this._router.middleware;
+ });
+
+ // setup locals
+ this.locals = locals(this);
+
+ // default locals
+ this.locals.settings = this.settings;
+
+ // default configuration
+ this.set('view', View);
+ this.set('views', process.cwd() + '/views');
+ this.set('jsonp callback name', 'callback');
+
+ this.configure('development', function(){
+ this.set('json spaces', 2);
+ });
+
+ this.configure('production', function(){
+ this.enable('view cache');
+ });
+};
+
+/**
+ * Proxy `connect#use()` to apply settings to
+ * mounted applications.
+ *
+ * @param {String|Function|Server} route
+ * @param {Function|Server} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+ var app;
+
+ // default route to '/'
+ if ('string' != typeof route) fn = route, route = '/';
+
+ // express app
+ if (fn.handle && fn.set) app = fn;
+
+ // restore .app property on req and res
+ if (app) {
+ app.route = route;
+ fn = function(req, res, next) {
+ var orig = req.app;
+ app.handle(req, res, function(err){
+ req.__proto__ = orig.request;
+ res.__proto__ = orig.response;
+ next(err);
+ });
+ };
+ }
+
+ connect.proto.use.call(this, route, fn);
+
+ // mounted an app
+ if (app) {
+ app.parent = this;
+ app.emit('mount', this);
+ }
+
+ return this;
+};
+
+/**
+ * Register the given template engine callback `fn`
+ * as `ext`.
+ *
+ * By default will `require()` the engine based on the
+ * file extension. For example if you try to render
+ * a "foo.jade" file Express will invoke the following internally:
+ *
+ * app.engine('jade', require('jade').__express);
+ *
+ * For engines that do not provide `.__express` out of the box,
+ * or if you wish to "map" a different extension to the template engine
+ * you may use this method. For example mapping the EJS template engine to
+ * ".html" files:
+ *
+ * app.engine('html', require('ejs').renderFile);
+ *
+ * In this case EJS provides a `.renderFile()` method with
+ * the same signature that Express expects: `(path, options, callback)`,
+ * though note that it aliases this method as `ejs.__express` internally
+ * so if you're using ".ejs" extensions you dont need to do anything.
+ *
+ * Some template engines do not follow this convention, the
+ * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
+ * library was created to map all of node's popular template
+ * engines to follow this convention, thus allowing them to
+ * work seamlessly within Express.
+ *
+ * @param {String} ext
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.engine = function(ext, fn){
+ if ('function' != typeof fn) throw new Error('callback function required');
+ if ('.' != ext[0]) ext = '.' + ext;
+ this.engines[ext] = fn;
+ return this;
+};
+
+/**
+ * Map the given param placeholder `name`(s) to the given callback(s).
+ *
+ * Parameter mapping is used to provide pre-conditions to routes
+ * which use normalized placeholders. For example a _:user_id_ parameter
+ * could automatically load a user's information from the database without
+ * any additional code,
+ *
+ * The callback uses the samesignature as middleware, the only differencing
+ * being that the value of the placeholder is passed, in this case the _id_
+ * of the user. Once the `next()` function is invoked, just like middleware
+ * it will continue on to execute the route, or subsequent parameter functions.
+ *
+ * app.param('user_id', function(req, res, next, id){
+ * User.find(id, function(err, user){
+ * if (err) {
+ * next(err);
+ * } else if (user) {
+ * req.user = user;
+ * next();
+ * } else {
+ * next(new Error('failed to load user'));
+ * }
+ * });
+ * });
+ *
+ * @param {String|Array} name
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.param = function(name, fn){
+ var self = this
+ , fns = [].slice.call(arguments, 1);
+
+ // array
+ if (Array.isArray(name)) {
+ name.forEach(function(name){
+ fns.forEach(function(fn){
+ self.param(name, fn);
+ });
+ });
+ // param logic
+ } else if ('function' == typeof name) {
+ this._router.param(name);
+ // single
+ } else {
+ if (':' == name[0]) name = name.substr(1);
+ fns.forEach(function(fn){
+ self._router.param(name, fn);
+ });
+ }
+
+ return this;
+};
+
+/**
+ * Assign `setting` to `val`, or return `setting`'s value.
+ *
+ * app.set('foo', 'bar');
+ * app.get('foo');
+ * // => "bar"
+ *
+ * Mounted servers inherit their parent server's settings.
+ *
+ * @param {String} setting
+ * @param {String} val
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.set = function(setting, val){
+ if (1 == arguments.length) {
+ return this.settings[setting];
+ } else {
+ this.settings[setting] = val;
+ return this;
+ }
+};
+
+/**
+ * Return the app's absolute pathname
+ * based on the parent(s) that have
+ * mounted it.
+ *
+ * For example if the application was
+ * mounted as "/admin", which itself
+ * was mounted as "/blog" then the
+ * return value would be "/blog/admin".
+ *
+ * @return {String}
+ * @api private
+ */
+
+app.path = function(){
+ return this.parent
+ ? this.parent.path() + this.route
+ : '';
+};
+
+/**
+ * Check if `setting` is enabled (truthy).
+ *
+ * app.enabled('foo')
+ * // => false
+ *
+ * app.enable('foo')
+ * app.enabled('foo')
+ * // => true
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.enabled = function(setting){
+ return !!this.set(setting);
+};
+
+/**
+ * Check if `setting` is disabled.
+ *
+ * app.disabled('foo')
+ * // => true
+ *
+ * app.enable('foo')
+ * app.disabled('foo')
+ * // => false
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.disabled = function(setting){
+ return !this.set(setting);
+};
+
+/**
+ * Enable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.enable = function(setting){
+ return this.set(setting, true);
+};
+
+/**
+ * Disable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.disable = function(setting){
+ return this.set(setting, false);
+};
+
+/**
+ * Configure callback for zero or more envs,
+ * when no `env` is specified that callback will
+ * be invoked for all environments. Any combination
+ * can be used multiple times, in any order desired.
+ *
+ * Examples:
+ *
+ * app.configure(function(){
+ * // executed for all envs
+ * });
+ *
+ * app.configure('stage', function(){
+ * // executed staging env
+ * });
+ *
+ * app.configure('stage', 'production', function(){
+ * // executed for stage and production
+ * });
+ *
+ * Note:
+ *
+ * These callbacks are invoked immediately, and
+ * are effectively sugar for the following:
+ *
+ * var env = process.env.NODE_ENV || 'development';
+ *
+ * switch (env) {
+ * case 'development':
+ * ...
+ * break;
+ * case 'stage':
+ * ...
+ * break;
+ * case 'production':
+ * ...
+ * break;
+ * }
+ *
+ * @param {String} env...
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.configure = function(env, fn){
+ var envs = 'all'
+ , args = [].slice.call(arguments);
+ fn = args.pop();
+ if (args.length) envs = args;
+ if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);
+ return this;
+};
+
+/**
+ * Delegate `.VERB(...)` calls to `router.VERB(...)`.
+ */
+
+methods.forEach(function(method){
+ app[method] = function(path){
+ if ('get' == method && 1 == arguments.length) return this.set(path);
+
+ // deprecated
+ if (Array.isArray(path)) {
+ console.trace('passing an array to app.VERB() is deprecated and will be removed in 4.0');
+ }
+
+ // if no router attached yet, attach the router
+ if (!this._usedRouter) this.use(this.router);
+
+ // setup route
+ this._router[method].apply(this._router, arguments);
+ return this;
+ };
+});
+
+/**
+ * Special-cased "all" method, applying the given route `path`,
+ * middleware, and callback to _every_ HTTP method.
+ *
+ * @param {String} path
+ * @param {Function} ...
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.all = function(path){
+ var args = arguments;
+ methods.forEach(function(method){
+ app[method].apply(this, args);
+ }, this);
+ return this;
+};
+
+// del -> delete alias
+
+app.del = app.delete;
+
+/**
+ * Render the given view `name` name with `options`
+ * and a callback accepting an error and the
+ * rendered template string.
+ *
+ * Example:
+ *
+ * app.render('email', { name: 'Tobi' }, function(err, html){
+ * // ...
+ * })
+ *
+ * @param {String} name
+ * @param {String|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+app.render = function(name, options, fn){
+ var opts = {}
+ , cache = this.cache
+ , engines = this.engines
+ , view;
+
+ // support callback function as second arg
+ if ('function' == typeof options) {
+ fn = options, options = {};
+ }
+
+ // merge app.locals
+ utils.merge(opts, this.locals);
+
+ // merge options._locals
+ if (options._locals) utils.merge(opts, options._locals);
+
+ // merge options
+ utils.merge(opts, options);
+
+ // set .cache unless explicitly provided
+ opts.cache = null == opts.cache
+ ? this.enabled('view cache')
+ : opts.cache;
+
+ // primed cache
+ if (opts.cache) view = cache[name];
+
+ // view
+ if (!view) {
+ view = new (this.get('view'))(name, {
+ defaultEngine: this.get('view engine'),
+ root: this.get('views'),
+ engines: engines
+ });
+
+ if (!view.path) {
+ var err = new Error('Failed to lookup view "' + name + '"');
+ err.view = view;
+ return fn(err);
+ }
+
+ // prime the cache
+ if (opts.cache) cache[name] = view;
+ }
+
+ // render
+ try {
+ view.render(opts, fn);
+ } catch (err) {
+ fn(err);
+ }
+};
+
+/**
+ * Listen for connections.
+ *
+ * A node `http.Server` is returned, with this
+ * application (which is a `Function`) as its
+ * callback. If you wish to create both an HTTP
+ * and HTTPS server you may do so with the "http"
+ * and "https" modules as shown here:
+ *
+ * var http = require('http')
+ * , https = require('https')
+ * , express = require('express')
+ * , app = express();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer({ ... }, app).listen(443);
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+ var server = http.createServer(this);
+ return server.listen.apply(server, arguments);
+};
diff --git a/node_modules/express/lib/express.js b/node_modules/express/lib/express.js
new file mode 100644
index 0000000..c204849
--- /dev/null
+++ b/node_modules/express/lib/express.js
@@ -0,0 +1,86 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+ , proto = require('./application')
+ , Route = require('./router/route')
+ , Router = require('./router')
+ , req = require('./request')
+ , res = require('./response')
+ , utils = connect.utils;
+
+/**
+ * Expose `createApplication()`.
+ */
+
+exports = module.exports = createApplication;
+
+/**
+ * Expose mime.
+ */
+
+exports.mime = connect.mime;
+
+/**
+ * Create an express application.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createApplication() {
+ var app = connect();
+ utils.merge(app, proto);
+ app.request = { __proto__: req, app: app };
+ app.response = { __proto__: res, app: app };
+ app.init();
+ return app;
+}
+
+/**
+ * Expose connect.middleware as express.*
+ * for example `express.logger` etc.
+ */
+
+for (var key in connect.middleware) {
+ Object.defineProperty(
+ exports
+ , key
+ , Object.getOwnPropertyDescriptor(connect.middleware, key));
+}
+
+/**
+ * Error on createServer().
+ */
+
+exports.createServer = function(){
+ console.warn('Warning: express.createServer() is deprecated, express');
+ console.warn('applications no longer inherit from http.Server,');
+ console.warn('please use:');
+ console.warn('');
+ console.warn(' var express = require("express");');
+ console.warn(' var app = express();');
+ console.warn('');
+ return createApplication();
+};
+
+/**
+ * Expose the prototypes.
+ */
+
+exports.application = proto;
+exports.request = req;
+exports.response = res;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Route = Route;
+exports.Router = Router;
+
+// Error handler title
+
+exports.errorHandler.title = 'Express';
+
diff --git a/node_modules/express/lib/middleware.js b/node_modules/express/lib/middleware.js
new file mode 100644
index 0000000..e07dd4c
--- /dev/null
+++ b/node_modules/express/lib/middleware.js
@@ -0,0 +1,32 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils');
+
+/**
+ * Initialization middleware, exposing the
+ * request and response to eachother, as well
+ * as defaulting the X-Powered-By header field.
+ *
+ * @param {Function} app
+ * @return {Function}
+ * @api private
+ */
+
+exports.init = function(app){
+ return function expressInit(req, res, next){
+ if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');
+ req.res = res;
+ res.req = req;
+ req.next = next;
+
+ req.__proto__ = app.request;
+ res.__proto__ = app.response;
+
+ res.locals = res.locals || utils.locals(res);
+
+ next();
+ }
+};
diff --git a/node_modules/express/lib/request.js b/node_modules/express/lib/request.js
new file mode 100644
index 0000000..6fc09ee
--- /dev/null
+++ b/node_modules/express/lib/request.js
@@ -0,0 +1,526 @@
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , utils = require('./utils')
+ , connect = require('connect')
+ , fresh = require('fresh')
+ , parseRange = require('range-parser')
+ , parse = connect.utils.parseUrl
+ , mime = connect.mime;
+
+/**
+ * Request prototype.
+ */
+
+var req = exports = module.exports = {
+ __proto__: http.IncomingMessage.prototype
+};
+
+/**
+ * Return request header.
+ *
+ * The `Referrer` header field is special-cased,
+ * both `Referrer` and `Referer` are interchangeable.
+ *
+ * Examples:
+ *
+ * req.get('Content-Type');
+ * // => "text/plain"
+ *
+ * req.get('content-type');
+ * // => "text/plain"
+ *
+ * req.get('Something');
+ * // => undefined
+ *
+ * Aliased as `req.header()`.
+ *
+ * @param {String} name
+ * @return {String}
+ * @api public
+ */
+
+req.get =
+req.header = function(name){
+ switch (name = name.toLowerCase()) {
+ case 'referer':
+ case 'referrer':
+ return this.headers.referrer
+ || this.headers.referer;
+ default:
+ return this.headers[name];
+ }
+};
+
+/**
+ * Check if the given `type(s)` is acceptable, returning
+ * the best match when true, otherwise `undefined`, in which
+ * case you should respond with 406 "Not Acceptable".
+ *
+ * The `type` value may be a single mime type string
+ * such as "application/json", the extension name
+ * such as "json", a comma-delimted list such as "json, html, text/plain",
+ * or an array `["json", "html", "text/plain"]`. When a list
+ * or array is given the _best_ match, if any is returned.
+ *
+ * Examples:
+ *
+ * // Accept: text/html
+ * req.accepts('html');
+ * // => "html"
+ *
+ * // Accept: text/*, application/json
+ * req.accepts('html');
+ * // => "html"
+ * req.accepts('text/html');
+ * // => "text/html"
+ * req.accepts('json, text');
+ * // => "json"
+ * req.accepts('application/json');
+ * // => "application/json"
+ *
+ * // Accept: text/*, application/json
+ * req.accepts('image/png');
+ * req.accepts('png');
+ * // => undefined
+ *
+ * // Accept: text/*;q=.5, application/json
+ * req.accepts(['html', 'json']);
+ * req.accepts('html, json');
+ * // => "json"
+ *
+ * @param {String|Array} type(s)
+ * @return {String}
+ * @api public
+ */
+
+req.accepts = function(type){
+ return utils.accepts(type, this.get('Accept'));
+};
+
+/**
+ * Check if the given `encoding` is accepted.
+ *
+ * @param {String} encoding
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsEncoding = function(encoding){
+ return !! ~this.acceptedEncodings.indexOf(encoding);
+};
+
+/**
+ * Check if the given `charset` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} charset
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsCharset = function(charset){
+ var accepted = this.acceptedCharsets;
+ return accepted.length
+ ? !! ~accepted.indexOf(charset)
+ : true;
+};
+
+/**
+ * Check if the given `lang` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} lang
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsLanguage = function(lang){
+ var accepted = this.acceptedLanguages;
+ return accepted.length
+ ? !! ~accepted.indexOf(lang)
+ : true;
+};
+
+/**
+ * Parse Range header field,
+ * capping to the given `size`.
+ *
+ * Unspecified ranges such as "0-" require
+ * knowledge of your resource length. In
+ * the case of a byte range this is of course
+ * the total number of bytes. If the Range
+ * header field is not given `null` is returned,
+ * `-1` when unsatisfiable, `-2` when syntactically invalid.
+ *
+ * NOTE: remember that ranges are inclusive, so
+ * for example "Range: users=0-3" should respond
+ * with 4 users when available, not 3.
+ *
+ * @param {Number} size
+ * @return {Array}
+ * @api public
+ */
+
+req.range = function(size){
+ var range = this.get('Range');
+ if (!range) return;
+ return parseRange(size, range);
+};
+
+/**
+ * Return an array of encodings.
+ *
+ * Examples:
+ *
+ * ['gzip', 'deflate']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedEncodings', function(){
+ var accept = this.get('Accept-Encoding');
+ return accept
+ ? accept.trim().split(/ *, */)
+ : [];
+});
+
+/**
+ * Return an array of Accepted media types
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ * [ { value: 'application/json',
+ * quality: 1,
+ * type: 'application',
+ * subtype: 'json' },
+ * { value: 'text/html',
+ * quality: 0.5,
+ * type: 'text',
+ * subtype: 'html' } ]
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('accepted', function(){
+ var accept = this.get('Accept');
+ return accept
+ ? utils.parseAccept(accept)
+ : [];
+});
+
+/**
+ * Return an array of Accepted languages
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ * Accept-Language: en;q=.5, en-us
+ * ['en-us', 'en']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedLanguages', function(){
+ var accept = this.get('Accept-Language');
+ return accept
+ ? utils
+ .parseParams(accept)
+ .map(function(obj){
+ return obj.value;
+ })
+ : [];
+});
+
+/**
+ * Return an array of Accepted charsets
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ * Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8
+ * ['unicode-1-1', 'iso-8859-5']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedCharsets', function(){
+ var accept = this.get('Accept-Charset');
+ return accept
+ ? utils
+ .parseParams(accept)
+ .map(function(obj){
+ return obj.value;
+ })
+ : [];
+});
+
+/**
+ * Return the value of param `name` when present or `defaultValue`.
+ *
+ * - Checks route placeholders, ex: _/user/:id_
+ * - Checks body params, ex: id=12, {"id":12}
+ * - Checks query string params, ex: ?id=12
+ *
+ * To utilize request bodies, `req.body`
+ * should be an object. This can be done by using
+ * the `connect.bodyParser()` middleware.
+ *
+ * @param {String} name
+ * @param {Mixed} [defaultValue]
+ * @return {String}
+ * @api public
+ */
+
+req.param = function(name, defaultValue){
+ var params = this.params || {};
+ var body = this.body || {};
+ var query = this.query || {};
+ if (null != params[name] && params.hasOwnProperty(name)) return params[name];
+ if (null != body[name]) return body[name];
+ if (null != query[name]) return query[name];
+ return defaultValue;
+};
+
+/**
+ * Check if the incoming request contains the "Content-Type"
+ * header field, and it contains the give mime `type`.
+ *
+ * Examples:
+ *
+ * // With Content-Type: text/html; charset=utf-8
+ * req.is('html');
+ * req.is('text/html');
+ * req.is('text/*');
+ * // => true
+ *
+ * // When Content-Type is application/json
+ * req.is('json');
+ * req.is('application/json');
+ * req.is('application/*');
+ * // => true
+ *
+ * req.is('html');
+ * // => false
+ *
+ * @param {String} type
+ * @return {Boolean}
+ * @api public
+ */
+
+req.is = function(type){
+ var ct = this.get('Content-Type');
+ if (!ct) return false;
+ ct = ct.split(';')[0];
+ if (!~type.indexOf('/')) type = mime.lookup(type);
+ if (~type.indexOf('*')) {
+ type = type.split('/');
+ ct = ct.split('/');
+ if ('*' == type[0] && type[1] == ct[1]) return true;
+ if ('*' == type[1] && type[0] == ct[0]) return true;
+ return false;
+ }
+ return !! ~ct.indexOf(type);
+};
+
+/**
+ * Return the protocol string "http" or "https"
+ * when requested with TLS. When the "trust proxy"
+ * setting is enabled the "X-Forwarded-Proto" header
+ * field will be trusted. If you're running behind
+ * a reverse proxy that supplies https for you this
+ * may be enabled.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('protocol', function(){
+ var trustProxy = this.app.get('trust proxy');
+ if (this.connection.encrypted) return 'https';
+ if (!trustProxy) return 'http';
+ var proto = this.get('X-Forwarded-Proto') || 'http';
+ return proto.split(/\s*,\s*/)[0];
+});
+
+/**
+ * Short-hand for:
+ *
+ * req.protocol == 'https'
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('secure', function(){
+ return 'https' == this.protocol;
+});
+
+/**
+ * Return the remote address, or when
+ * "trust proxy" is `true` return
+ * the upstream addr.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('ip', function(){
+ return this.ips[0] || this.connection.remoteAddress;
+});
+
+/**
+ * When "trust proxy" is `true`, parse
+ * the "X-Forwarded-For" ip address list.
+ *
+ * For example if the value were "client, proxy1, proxy2"
+ * you would receive the array `["client", "proxy1", "proxy2"]`
+ * where "proxy2" is the furthest down-stream.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('ips', function(){
+ var trustProxy = this.app.get('trust proxy');
+ var val = this.get('X-Forwarded-For');
+ return trustProxy && val
+ ? val.split(/ *, */)
+ : [];
+});
+
+/**
+ * Return basic auth credentials.
+ *
+ * Examples:
+ *
+ * // http://tobi:hello@example.com
+ * req.auth
+ * // => { username: 'tobi', password: 'hello' }
+ *
+ * @return {Object} or undefined
+ * @api public
+ */
+
+req.__defineGetter__('auth', function(){
+ // missing
+ var auth = this.get('Authorization');
+ if (!auth) return;
+
+ // malformed
+ var parts = auth.split(' ');
+ if ('basic' != parts[0].toLowerCase()) return;
+ if (!parts[1]) return;
+ auth = parts[1];
+
+ // credentials
+ auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/);
+ if (!auth) return;
+ return { username: auth[1], password: auth[2] };
+});
+
+/**
+ * Return subdomains as an array.
+ *
+ * Subdomains are the dot-separated parts of the host before the main domain of
+ * the app. By default, the domain of the app is assumed to be the last two
+ * parts of the host. This can be changed by setting "subdomain offset".
+ *
+ * For example, if the domain is "tobi.ferrets.example.com":
+ * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
+ * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('subdomains', function(){
+ var offset = this.app.get('subdomain offset');
+ return (this.host || '')
+ .split('.')
+ .reverse()
+ .slice(offset);
+});
+
+/**
+ * Short-hand for `url.parse(req.url).pathname`.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('path', function(){
+ return parse(this).pathname;
+});
+
+/**
+ * Parse the "Host" header field hostname.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('host', function(){
+ var trustProxy = this.app.get('trust proxy');
+ var host = trustProxy && this.get('X-Forwarded-Host');
+ host = host || this.get('Host');
+ if (!host) return;
+ return host.split(':')[0];
+});
+
+/**
+ * Check if the request is fresh, aka
+ * Last-Modified and/or the ETag
+ * still match.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('fresh', function(){
+ var method = this.method;
+ var s = this.res.statusCode;
+
+ // GET or HEAD for weak freshness validation only
+ if ('GET' != method && 'HEAD' != method) return false;
+
+ // 2xx or 304 as per rfc2616 14.26
+ if ((s >= 200 && s < 300) || 304 == s) {
+ return fresh(this.headers, this.res._headers);
+ }
+
+ return false;
+});
+
+/**
+ * Check if the request is stale, aka
+ * "Last-Modified" and / or the "ETag" for the
+ * resource has changed.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('stale', function(){
+ return !this.fresh;
+});
+
+/**
+ * Check if the request was an _XMLHttpRequest_.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('xhr', function(){
+ var val = this.get('X-Requested-With') || '';
+ return 'xmlhttprequest' == val.toLowerCase();
+});
diff --git a/node_modules/express/lib/response.js b/node_modules/express/lib/response.js
new file mode 100644
index 0000000..f6b7144
--- /dev/null
+++ b/node_modules/express/lib/response.js
@@ -0,0 +1,757 @@
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , path = require('path')
+ , connect = require('connect')
+ , utils = connect.utils
+ , sign = require('cookie-signature').sign
+ , normalizeType = require('./utils').normalizeType
+ , normalizeTypes = require('./utils').normalizeTypes
+ , etag = require('./utils').etag
+ , statusCodes = http.STATUS_CODES
+ , cookie = require('cookie')
+ , send = require('send')
+ , mime = connect.mime
+ , basename = path.basename
+ , extname = path.extname
+ , join = path.join;
+
+/**
+ * Response prototype.
+ */
+
+var res = module.exports = {
+ __proto__: http.ServerResponse.prototype
+};
+
+/**
+ * Set status `code`.
+ *
+ * @param {Number} code
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.status = function(code){
+ this.statusCode = code;
+ return this;
+};
+
+/**
+ * Set Link header field with the given `links`.
+ *
+ * Examples:
+ *
+ * res.links({
+ * next: 'http://api.example.com/users?page=2',
+ * last: 'http://api.example.com/users?page=5'
+ * });
+ *
+ * @param {Object} links
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.links = function(links){
+ return this.set('Link', Object.keys(links).map(function(rel){
+ return '<' + links[rel] + '>; rel="' + rel + '"';
+ }).join(', '));
+};
+
+/**
+ * Send a response.
+ *
+ * Examples:
+ *
+ * res.send(new Buffer('wahoo'));
+ * res.send({ some: 'json' });
+ * res.send('<p>some html</p>');
+ * res.send(404, 'Sorry, cant find that');
+ * res.send(404);
+ *
+ * @param {Mixed} body or status
+ * @param {Mixed} body
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.send = function(body){
+ var req = this.req;
+ var head = 'HEAD' == req.method;
+ var len;
+
+ // allow status / body
+ if (2 == arguments.length) {
+ // res.send(body, status) backwards compat
+ if ('number' != typeof body && 'number' == typeof arguments[1]) {
+ this.statusCode = arguments[1];
+ } else {
+ this.statusCode = body;
+ body = arguments[1];
+ }
+ }
+
+ switch (typeof body) {
+ // response status
+ case 'number':
+ this.get('Content-Type') || this.type('txt');
+ this.statusCode = body;
+ body = http.STATUS_CODES[body];
+ break;
+ // string defaulting to html
+ case 'string':
+ if (!this.get('Content-Type')) {
+ this.charset = this.charset || 'utf-8';
+ this.type('html');
+ }
+ break;
+ case 'boolean':
+ case 'object':
+ if (null == body) {
+ body = '';
+ } else if (Buffer.isBuffer(body)) {
+ this.get('Content-Type') || this.type('bin');
+ } else {
+ return this.json(body);
+ }
+ break;
+ }
+
+ // populate Content-Length
+ if (undefined !== body && !this.get('Content-Length')) {
+ this.set('Content-Length', len = Buffer.isBuffer(body)
+ ? body.length
+ : Buffer.byteLength(body));
+ }
+
+ // ETag support
+ // TODO: W/ support
+ if (len > 1024 && 'GET' == req.method) {
+ if (!this.get('ETag')) {
+ this.set('ETag', etag(body));
+ }
+ }
+
+ // freshness
+ if (req.fresh) this.statusCode = 304;
+
+ // strip irrelevant headers
+ if (204 == this.statusCode || 304 == this.statusCode) {
+ this.removeHeader('Content-Type');
+ this.removeHeader('Content-Length');
+ this.removeHeader('Transfer-Encoding');
+ body = '';
+ }
+
+ // respond
+ this.end(head ? null : body);
+ return this;
+};
+
+/**
+ * Send JSON response.
+ *
+ * Examples:
+ *
+ * res.json(null);
+ * res.json({ user: 'tj' });
+ * res.json(500, 'oh noes!');
+ * res.json(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.json = function(obj){
+ // allow status / body
+ if (2 == arguments.length) {
+ // res.json(body, status) backwards compat
+ if ('number' == typeof arguments[1]) {
+ this.statusCode = arguments[1];
+ } else {
+ this.statusCode = obj;
+ obj = arguments[1];
+ }
+ }
+
+ // settings
+ var app = this.app;
+ var replacer = app.get('json replacer');
+ var spaces = app.get('json spaces');
+ var body = JSON.stringify(obj, replacer, spaces);
+
+ // content-type
+ this.get('Content-Type') || this.set('Content-Type', 'application/json');
+
+ return this.send(body);
+};
+
+/**
+ * Send JSON response with JSONP callback support.
+ *
+ * Examples:
+ *
+ * res.jsonp(null);
+ * res.jsonp({ user: 'tj' });
+ * res.jsonp(500, 'oh noes!');
+ * res.jsonp(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.jsonp = function(obj){
+ // allow status / body
+ if (2 == arguments.length) {
+ // res.json(body, status) backwards compat
+ if ('number' == typeof arguments[1]) {
+ this.statusCode = arguments[1];
+ } else {
+ this.statusCode = obj;
+ obj = arguments[1];
+ }
+ }
+
+ // settings
+ var app = this.app;
+ var replacer = app.get('json replacer');
+ var spaces = app.get('json spaces');
+ var body = JSON.stringify(obj, replacer, spaces)
+ .replace(/\u2028/g, '\\u2028')
+ .replace(/\u2029/g, '\\u2029');
+ var callback = this.req.query[app.get('jsonp callback name')];
+
+ // content-type
+ this.charset = this.charset || 'utf-8';
+ this.set('Content-Type', 'application/json');
+
+ // jsonp
+ if (callback) {
+ if (callback instanceof Array) callback = callback[0];
+ this.set('Content-Type', 'text/javascript');
+ var cb = callback.replace(/[^\[\]\w$.]/g, '');
+ body = cb + ' && ' + cb + '(' + body + ');';
+ }
+
+ return this.send(body);
+};
+
+/**
+ * Transfer the file at the given `path`.
+ *
+ * Automatically sets the _Content-Type_ response header field.
+ * The callback `fn(err)` is invoked when the transfer is complete
+ * or when an error occurs. Be sure to check `res.sentHeader`
+ * if you wish to attempt responding, as the header and some data
+ * may have already been transferred.
+ *
+ * Options:
+ *
+ * - `maxAge` defaulting to 0
+ * - `root` root directory for relative filenames
+ *
+ * Examples:
+ *
+ * The following example illustrates how `res.sendfile()` may
+ * be used as an alternative for the `static()` middleware for
+ * dynamic situations. The code backing `res.sendfile()` is actually
+ * the same code, so HTTP cache support etc is identical.
+ *
+ * app.get('/user/:uid/photos/:file', function(req, res){
+ * var uid = req.params.uid
+ * , file = req.params.file;
+ *
+ * req.user.mayViewFilesFrom(uid, function(yes){
+ * if (yes) {
+ * res.sendfile('/uploads/' + uid + '/' + file);
+ * } else {
+ * res.send(403, 'Sorry! you cant see that.');
+ * }
+ * });
+ * });
+ *
+ * @param {String} path
+ * @param {Object|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.sendfile = function(path, options, fn){
+ var self = this
+ , req = self.req
+ , next = this.req.next
+ , options = options || {}
+ , done;
+
+ // support function as second arg
+ if ('function' == typeof options) {
+ fn = options;
+ options = {};
+ }
+
+ // socket errors
+ req.socket.on('error', error);
+
+ // errors
+ function error(err) {
+ if (done) return;
+ done = true;
+
+ // clean up
+ cleanup();
+ if (!self.headerSent) self.removeHeader('Content-Disposition');
+
+ // callback available
+ if (fn) return fn(err);
+
+ // list in limbo if there's no callback
+ if (self.headerSent) return;
+
+ // delegate
+ next(err);
+ }
+
+ // streaming
+ function stream() {
+ if (done) return;
+ cleanup();
+ if (fn) self.on('finish', fn);
+ }
+
+ // cleanup
+ function cleanup() {
+ req.socket.removeListener('error', error);
+ }
+
+ // transfer
+ var file = send(req, path);
+ if (options.root) file.root(options.root);
+ file.maxage(options.maxAge || 0);
+ file.on('error', error);
+ file.on('directory', next);
+ file.on('stream', stream);
+ file.pipe(this);
+ this.on('finish', cleanup);
+};
+
+/**
+ * Transfer the file at the given `path` as an attachment.
+ *
+ * Optionally providing an alternate attachment `filename`,
+ * and optional callback `fn(err)`. The callback is invoked
+ * when the data transfer is complete, or when an error has
+ * ocurred. Be sure to check `res.headerSent` if you plan to respond.
+ *
+ * This method uses `res.sendfile()`.
+ *
+ * @param {String} path
+ * @param {String|Function} filename or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.download = function(path, filename, fn){
+ // support function as second arg
+ if ('function' == typeof filename) {
+ fn = filename;
+ filename = null;
+ }
+
+ filename = filename || path;
+ this.set('Content-Disposition', 'attachment; filename="' + basename(filename) + '"');
+ return this.sendfile(path, fn);
+};
+
+/**
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
+ *
+ * Examples:
+ *
+ * res.type('.html');
+ * res.type('html');
+ * res.type('json');
+ * res.type('application/json');
+ * res.type('png');
+ *
+ * @param {String} type
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.contentType =
+res.type = function(type){
+ return this.set('Content-Type', ~type.indexOf('/')
+ ? type
+ : mime.lookup(type));
+};
+
+/**
+ * Respond to the Acceptable formats using an `obj`
+ * of mime-type callbacks.
+ *
+ * This method uses `req.accepted`, an array of
+ * acceptable types ordered by their quality values.
+ * When "Accept" is not present the _first_ callback
+ * is invoked, otherwise the first match is used. When
+ * no match is performed the server responds with
+ * 406 "Not Acceptable".
+ *
+ * Content-Type is set for you, however if you choose
+ * you may alter this within the callback using `res.type()`
+ * or `res.set('Content-Type', ...)`.
+ *
+ * res.format({
+ * 'text/plain': function(){
+ * res.send('hey');
+ * },
+ *
+ * 'text/html': function(){
+ * res.send('<p>hey</p>');
+ * },
+ *
+ * 'appliation/json': function(){
+ * res.send({ message: 'hey' });
+ * }
+ * });
+ *
+ * In addition to canonicalized MIME types you may
+ * also use extnames mapped to these types:
+ *
+ * res.format({
+ * text: function(){
+ * res.send('hey');
+ * },
+ *
+ * html: function(){
+ * res.send('<p>hey</p>');
+ * },
+ *
+ * json: function(){
+ * res.send({ message: 'hey' });
+ * }
+ * });
+ *
+ * By default Express passes an `Error`
+ * with a `.status` of 406 to `next(err)`
+ * if a match is not made. If you provide
+ * a `.default` callback it will be invoked
+ * instead.
+ *
+ * @param {Object} obj
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.format = function(obj){
+ var req = this.req
+ , next = req.next;
+
+ var fn = obj.default;
+ if (fn) delete obj.default;
+ var keys = Object.keys(obj);
+
+ var key = req.accepts(keys);
+
+ this.set('Vary', 'Accept');
+
+ if (key) {
+ this.set('Content-Type', normalizeType(key).value);
+ obj[key](req, this, next);
+ } else if (fn) {
+ fn();
+ } else {
+ var err = new Error('Not Acceptable');
+ err.status = 406;
+ err.types = normalizeTypes(keys).map(function(o){ return o.value });
+ next(err);
+ }
+
+ return this;
+};
+
+/**
+ * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
+ *
+ * @param {String} filename
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.attachment = function(filename){
+ if (filename) this.type(extname(filename));
+ this.set('Content-Disposition', filename
+ ? 'attachment; filename="' + basename(filename) + '"'
+ : 'attachment');
+ return this;
+};
+
+/**
+ * Set header `field` to `val`, or pass
+ * an object of header fields.
+ *
+ * Examples:
+ *
+ * res.set('Foo', ['bar', 'baz']);
+ * res.set('Accept', 'application/json');
+ * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
+ *
+ * Aliased as `res.header()`.
+ *
+ * @param {String|Object|Array} field
+ * @param {String} val
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.set =
+res.header = function(field, val){
+ if (2 == arguments.length) {
+ if (Array.isArray(val)) val = val.map(String);
+ else val = String(val);
+ this.setHeader(field, val);
+ } else {
+ for (var key in field) {
+ this.set(key, field[key]);
+ }
+ }
+ return this;
+};
+
+/**
+ * Get value for header `field`.
+ *
+ * @param {String} field
+ * @return {String}
+ * @api public
+ */
+
+res.get = function(field){
+ return this.getHeader(field);
+};
+
+/**
+ * Clear cookie `name`.
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @param {ServerResponse} for chaining
+ * @api public
+ */
+
+res.clearCookie = function(name, options){
+ var opts = { expires: new Date(1), path: '/' };
+ return this.cookie(name, '', options
+ ? utils.merge(opts, options)
+ : opts);
+};
+
+/**
+ * Set cookie `name` to `val`, with the given `options`.
+ *
+ * Options:
+ *
+ * - `maxAge` max-age in milliseconds, converted to `expires`
+ * - `signed` sign the cookie
+ * - `path` defaults to "/"
+ *
+ * Examples:
+ *
+ * // "Remember Me" for 15 minutes
+ * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
+ *
+ * // save as above
+ * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
+ *
+ * @param {String} name
+ * @param {String|Object} val
+ * @param {Options} options
+ * @api public
+ */
+
+res.cookie = function(name, val, options){
+ options = utils.merge({}, options);
+ var secret = this.req.secret;
+ var signed = options.signed;
+ if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies');
+ if ('number' == typeof val) val = val.toString();
+ if ('object' == typeof val) val = 'j:' + JSON.stringify(val);
+ if (signed) val = 's:' + sign(val, secret);
+ if ('maxAge' in options) {
+ options.expires = new Date(Date.now() + options.maxAge);
+ options.maxAge /= 1000;
+ }
+ if (null == options.path) options.path = '/';
+ this.set('Set-Cookie', cookie.serialize(name, String(val), options));
+ return this;
+};
+
+
+/**
+ * Set the location header to `url`.
+ *
+ * The given `url` can also be the name of a mapped url, for
+ * example by default express supports "back" which redirects
+ * to the _Referrer_ or _Referer_ headers or "/".
+ *
+ * Examples:
+ *
+ * res.location('/foo/bar').;
+ * res.location('http://example.com');
+ * res.location('../login'); // /blog/post/1 -> /blog/login
+ *
+ * Mounting:
+ *
+ * When an application is mounted and `res.location()`
+ * is given a path that does _not_ lead with "/" it becomes
+ * relative to the mount-point. For example if the application
+ * is mounted at "/blog", the following would become "/blog/login".
+ *
+ * res.location('login');
+ *
+ * While the leading slash would result in a location of "/login":
+ *
+ * res.location('/login');
+ *
+ * @param {String} url
+ * @api public
+ */
+
+res.location = function(url){
+ var app = this.app
+ , req = this.req;
+
+ // setup redirect map
+ var map = { back: req.get('Referrer') || '/' };
+
+ // perform redirect
+ url = map[url] || url;
+
+ // relative
+ if (!~url.indexOf('://') && 0 != url.indexOf('//')) {
+ var path
+
+ // relative to path
+ if ('.' == url[0]) {
+ path = req.originalUrl.split('?')[0]
+ url = path + ('/' == path[path.length - 1] ? '' : '/') + url;
+ // relative to mount-point
+ } else if ('/' != url[0]) {
+ path = app.path();
+ url = path + '/' + url;
+ }
+ }
+
+ // Respond
+ this.set('Location', url);
+ return this;
+};
+
+/**
+ * Redirect to the given `url` with optional response `status`
+ * defaulting to 302.
+ *
+ * The resulting `url` is determined by `res.location()`, so
+ * it will play nicely with mounted apps, relative paths,
+ * `"back"` etc.
+ *
+ * Examples:
+ *
+ * res.redirect('/foo/bar');
+ * res.redirect('http://example.com');
+ * res.redirect(301, 'http://example.com');
+ * res.redirect('http://example.com', 301);
+ * res.redirect('../login'); // /blog/post/1 -> /blog/login
+ *
+ * @param {String} url
+ * @param {Number} code
+ * @api public
+ */
+
+res.redirect = function(url){
+ var app = this.app
+ , head = 'HEAD' == this.req.method
+ , status = 302
+ , body;
+
+ // allow status / url
+ if (2 == arguments.length) {
+ if ('number' == typeof url) {
+ status = url;
+ url = arguments[1];
+ } else {
+ status = arguments[1];
+ }
+ }
+
+ // Set location header
+ this.location(url);
+ url = this.get('Location');
+
+ // Support text/{plain,html} by default
+ this.format({
+ text: function(){
+ body = statusCodes[status] + '. Redirecting to ' + encodeURI(url);
+ },
+
+ html: function(){
+ var u = utils.escape(url);
+ body = '<p>' + statusCodes[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>';
+ },
+
+ default: function(){
+ body = '';
+ }
+ });
+
+ // Respond
+ this.statusCode = status;
+ this.set('Content-Length', Buffer.byteLength(body));
+ this.end(head ? null : body);
+};
+
+/**
+ * Render `view` with the given `options` and optional callback `fn`.
+ * When a callback function is given a response will _not_ be made
+ * automatically, otherwise a response of _200_ and _text/html_ is given.
+ *
+ * Options:
+ *
+ * - `cache` boolean hinting to the engine it should cache
+ * - `filename` filename of the view being rendered
+ *
+ * @param {String} view
+ * @param {Object|Function} options or callback function
+ * @param {Function} fn
+ * @api public
+ */
+
+res.render = function(view, options, fn){
+ var self = this
+ , options = options || {}
+ , req = this.req
+ , app = req.app;
+
+ // support callback function as second arg
+ if ('function' == typeof options) {
+ fn = options, options = {};
+ }
+
+ // merge res.locals
+ options._locals = self.locals;
+
+ // default callback to respond
+ fn = fn || function(err, str){
+ if (err) return req.next(err);
+ self.send(str);
+ };
+
+ // render
+ app.render(view, options, fn);
+};
diff --git a/node_modules/express/lib/router/index.js b/node_modules/express/lib/router/index.js
new file mode 100644
index 0000000..662dc29
--- /dev/null
+++ b/node_modules/express/lib/router/index.js
@@ -0,0 +1,273 @@
+/**
+ * Module dependencies.
+ */
+
+var Route = require('./route')
+ , utils = require('../utils')
+ , methods = require('methods')
+ , debug = require('debug')('express:router')
+ , parse = require('connect').utils.parseUrl;
+
+/**
+ * Expose `Router` constructor.
+ */
+
+exports = module.exports = Router;
+
+/**
+ * Initialize a new `Router` with the given `options`.
+ *
+ * @param {Object} options
+ * @api private
+ */
+
+function Router(options) {
+ options = options || {};
+ var self = this;
+ this.map = {};
+ this.params = {};
+ this._params = [];
+ this.caseSensitive = options.caseSensitive;
+ this.strict = options.strict;
+ this.middleware = function router(req, res, next){
+ self._dispatch(req, res, next);
+ };
+}
+
+/**
+ * Register a param callback `fn` for the given `name`.
+ *
+ * @param {String|Function} name
+ * @param {Function} fn
+ * @return {Router} for chaining
+ * @api public
+ */
+
+Router.prototype.param = function(name, fn){
+ // param logic
+ if ('function' == typeof name) {
+ this._params.push(name);
+ return;
+ }
+
+ // apply param functions
+ var params = this._params
+ , len = params.length
+ , ret;
+
+ for (var i = 0; i < len; ++i) {
+ if (ret = params[i](name, fn)) {
+ fn = ret;
+ }
+ }
+
+ // ensure we end up with a
+ // middleware function
+ if ('function' != typeof fn) {
+ throw new Error('invalid param() call for ' + name + ', got ' + fn);
+ }
+
+ (this.params[name] = this.params[name] || []).push(fn);
+ return this;
+};
+
+/**
+ * Route dispatcher aka the route "middleware".
+ *
+ * @param {IncomingMessage} req
+ * @param {ServerResponse} res
+ * @param {Function} next
+ * @api private
+ */
+
+Router.prototype._dispatch = function(req, res, next){
+ var params = this.params
+ , self = this;
+
+ debug('dispatching %s %s (%s)', req.method, req.url, req.originalUrl);
+
+ // route dispatch
+ (function pass(i, err){
+ var paramCallbacks
+ , paramIndex = 0
+ , paramVal
+ , route
+ , keys
+ , key;
+
+ // match next route
+ function nextRoute(err) {
+ pass(req._route_index + 1, err);
+ }
+
+ // match route
+ req.route = route = self.matchRequest(req, i);
+
+ // no route
+ if (!route) return next(err);
+ debug('matched %s %s', route.method, route.path);
+
+ // we have a route
+ // start at param 0
+ req.params = route.params;
+ keys = route.keys;
+ i = 0;
+
+ // param callbacks
+ function param(err) {
+ paramIndex = 0;
+ key = keys[i++];
+ paramVal = key && req.params[key.name];
+ paramCallbacks = key && params[key.name];
+
+ try {
+ if ('route' == err) {
+ nextRoute();
+ } else if (err) {
+ i = 0;
+ callbacks(err);
+ } else if (paramCallbacks && undefined !== paramVal) {
+ paramCallback();
+ } else if (key) {
+ param();
+ } else {
+ i = 0;
+ callbacks();
+ }
+ } catch (err) {
+ param(err);
+ }
+ };
+
+ param(err);
+
+ // single param callbacks
+ function paramCallback(err) {
+ var fn = paramCallbacks[paramIndex++];
+ if (err || !fn) return param(err);
+ fn(req, res, paramCallback, paramVal, key.name);
+ }
+
+ // invoke route callbacks
+ function callbacks(err) {
+ var fn = route.callbacks[i++];
+ try {
+ if ('route' == err) {
+ nextRoute();
+ } else if (err && fn) {
+ if (fn.length < 4) return callbacks(err);
+ fn(err, req, res, callbacks);
+ } else if (fn) {
+ if (fn.length < 4) return fn(req, res, callbacks);
+ callbacks();
+ } else {
+ nextRoute(err);
+ }
+ } catch (err) {
+ callbacks(err);
+ }
+ }
+ })(0);
+};
+
+/**
+ * Attempt to match a route for `req`
+ * with optional starting index of `i`
+ * defaulting to 0.
+ *
+ * @param {IncomingMessage} req
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.matchRequest = function(req, i, head){
+ var method = req.method.toLowerCase()
+ , url = parse(req)
+ , path = url.pathname
+ , routes = this.map
+ , i = i || 0
+ , route;
+
+ // HEAD support
+ if (!head && 'head' == method) {
+ route = this.matchRequest(req, i, true);
+ if (route) return route;
+ method = 'get';
+ }
+
+ // routes for this method
+ if (routes = routes[method]) {
+
+ // matching routes
+ for (var len = routes.length; i < len; ++i) {
+ route = routes[i];
+ if (route.match(path)) {
+ req._route_index = i;
+ return route;
+ }
+ }
+ }
+};
+
+/**
+ * Attempt to match a route for `method`
+ * and `url` with optional starting
+ * index of `i` defaulting to 0.
+ *
+ * @param {String} method
+ * @param {String} url
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.match = function(method, url, i, head){
+ var req = { method: method, url: url };
+ return this.matchRequest(req, i, head);
+};
+
+/**
+ * Route `method`, `path`, and one or more callbacks.
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Function} callback...
+ * @return {Router} for chaining
+ * @api private
+ */
+
+Router.prototype.route = function(method, path, callbacks){
+ var method = method.toLowerCase()
+ , callbacks = utils.flatten([].slice.call(arguments, 2));
+
+ // ensure path was given
+ if (!path) throw new Error('Router#' + method + '() requires a path');
+
+ // ensure all callbacks are functions
+ callbacks.forEach(function(fn, i){
+ if ('function' == typeof fn) return;
+ var type = {}.toString.call(fn);
+ var msg = '.' + method + '() requires callback functions but got a ' + type;
+ throw new Error(msg);
+ });
+
+ // create the route
+ debug('defined %s %s', method, path);
+ var route = new Route(method, path, callbacks, {
+ sensitive: this.caseSensitive,
+ strict: this.strict
+ });
+
+ // add it
+ (this.map[method] = this.map[method] || []).push(route);
+ return this;
+};
+
+methods.forEach(function(method){
+ Router.prototype[method] = function(path){
+ var args = [method].concat([].slice.call(arguments));
+ this.route.apply(this, args);
+ return this;
+ };
+});
diff --git a/node_modules/express/lib/router/route.js b/node_modules/express/lib/router/route.js
new file mode 100644
index 0000000..c1a0b5e
--- /dev/null
+++ b/node_modules/express/lib/router/route.js
@@ -0,0 +1,72 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Expose `Route`.
+ */
+
+module.exports = Route;
+
+/**
+ * Initialize `Route` with the given HTTP `method`, `path`,
+ * and an array of `callbacks` and `options`.
+ *
+ * Options:
+ *
+ * - `sensitive` enable case-sensitive routes
+ * - `strict` enable strict matching for trailing slashes
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Array} callbacks
+ * @param {Object} options.
+ * @api private
+ */
+
+function Route(method, path, callbacks, options) {
+ options = options || {};
+ this.path = path;
+ this.method = method;
+ this.callbacks = callbacks;
+ this.regexp = utils.pathRegexp(path
+ , this.keys = []
+ , options.sensitive
+ , options.strict);
+}
+
+/**
+ * Check if this route matches `path`, if so
+ * populate `.params`.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+Route.prototype.match = function(path){
+ var keys = this.keys
+ , params = this.params = []
+ , m = this.regexp.exec(path);
+
+ if (!m) return false;
+
+ for (var i = 1, len = m.length; i < len; ++i) {
+ var key = keys[i - 1];
+
+ var val = 'string' == typeof m[i]
+ ? decodeURIComponent(m[i])
+ : m[i];
+
+ if (key) {
+ params[key.name] = val;
+ } else {
+ params.push(val);
+ }
+ }
+
+ return true;
+};
diff --git a/node_modules/express/lib/utils.js b/node_modules/express/lib/utils.js
new file mode 100644
index 0000000..fd245a8
--- /dev/null
+++ b/node_modules/express/lib/utils.js
@@ -0,0 +1,313 @@
+
+/**
+ * Module dependencies.
+ */
+
+var mime = require('connect').mime
+ , crc32 = require('buffer-crc32');
+
+/**
+ * toString ref.
+ */
+
+var toString = {}.toString;
+
+/**
+ * Return ETag for `body`.
+ *
+ * @param {String|Buffer} body
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(body){
+ return '"' + crc32.signed(body) + '"';
+};
+
+/**
+ * Make `locals()` bound to the given `obj`.
+ *
+ * This is used for `app.locals` and `res.locals`.
+ *
+ * @param {Object} obj
+ * @return {Function}
+ * @api private
+ */
+
+exports.locals = function(obj){
+ function locals(obj){
+ for (var key in obj) locals[key] = obj[key];
+ return obj;
+ };
+
+ return locals;
+};
+
+/**
+ * Check if `path` looks absolute.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.isAbsolute = function(path){
+ if ('/' == path[0]) return true;
+ if (':' == path[1] && '\\' == path[2]) return true;
+};
+
+/**
+ * Flatten the given `arr`.
+ *
+ * @param {Array} arr
+ * @return {Array}
+ * @api private
+ */
+
+exports.flatten = function(arr, ret){
+ var ret = ret || []
+ , len = arr.length;
+ for (var i = 0; i < len; ++i) {
+ if (Array.isArray(arr[i])) {
+ exports.flatten(arr[i], ret);
+ } else {
+ ret.push(arr[i]);
+ }
+ }
+ return ret;
+};
+
+/**
+ * Normalize the given `type`, for example "html" becomes "text/html".
+ *
+ * @param {String} type
+ * @return {Object}
+ * @api private
+ */
+
+exports.normalizeType = function(type){
+ return ~type.indexOf('/')
+ ? acceptParams(type)
+ : { value: mime.lookup(type), params: {} };
+};
+
+/**
+ * Normalize `types`, for example "html" becomes "text/html".
+ *
+ * @param {Array} types
+ * @return {Array}
+ * @api private
+ */
+
+exports.normalizeTypes = function(types){
+ var ret = [];
+
+ for (var i = 0; i < types.length; ++i) {
+ ret.push(exports.normalizeType(types[i]));
+ }
+
+ return ret;
+};
+
+/**
+ * Return the acceptable type in `types`, if any.
+ *
+ * @param {Array} types
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+exports.acceptsArray = function(types, str){
+ // accept anything when Accept is not present
+ if (!str) return types[0];
+
+ // parse
+ var accepted = exports.parseAccept(str)
+ , normalized = exports.normalizeTypes(types)
+ , len = accepted.length;
+
+ for (var i = 0; i < len; ++i) {
+ for (var j = 0, jlen = types.length; j < jlen; ++j) {
+ if (exports.accept(normalized[j], accepted[i])) {
+ return types[j];
+ }
+ }
+ }
+};
+
+/**
+ * Check if `type(s)` are acceptable based on
+ * the given `str`.
+ *
+ * @param {String|Array} type(s)
+ * @param {String} str
+ * @return {Boolean|String}
+ * @api private
+ */
+
+exports.accepts = function(type, str){
+ if ('string' == typeof type) type = type.split(/ *, */);
+ return exports.acceptsArray(type, str);
+};
+
+/**
+ * Check if `type` array is acceptable for `other`.
+ *
+ * @param {Object} type
+ * @param {Object} other
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.accept = function(type, other){
+ var t = type.value.split('/');
+ return (t[0] == other.type || '*' == other.type)
+ && (t[1] == other.subtype || '*' == other.subtype)
+ && paramsEqual(type.params, other.params);
+};
+
+/**
+ * Check if accept params are equal.
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Boolean}
+ * @api private
+ */
+
+function paramsEqual(a, b){
+ return !Object.keys(a).some(function(k) {
+ return a[k] != b[k];
+ });
+}
+
+/**
+ * Parse accept `str`, returning
+ * an array objects containing
+ * `.type` and `.subtype` along
+ * with the values provided by
+ * `parseQuality()`.
+ *
+ * @param {Type} name
+ * @return {Type}
+ * @api private
+ */
+
+exports.parseAccept = function(str){
+ return exports
+ .parseParams(str)
+ .map(function(obj){
+ var parts = obj.value.split('/');
+ obj.type = parts[0];
+ obj.subtype = parts[1];
+ return obj;
+ });
+};
+
+/**
+ * Parse quality `str`, returning an
+ * array of objects with `.value`,
+ * `.quality` and optional `.params`
+ *
+ * @param {String} str
+ * @return {Array}
+ * @api private
+ */
+
+exports.parseParams = function(str){
+ return str
+ .split(/ *, */)
+ .map(acceptParams)
+ .filter(function(obj){
+ return obj.quality;
+ })
+ .sort(function(a, b){
+ if (a.quality === b.quality) {
+ return a.originalIndex - b.originalIndex;
+ } else {
+ return b.quality - a.quality;
+ }
+ });
+};
+
+/**
+ * Parse accept params `str` returning an
+ * object with `.value`, `.quality` and `.params`.
+ * also includes `.originalIndex` for stable sorting
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api private
+ */
+
+function acceptParams(str, index) {
+ var parts = str.split(/ *; */);
+ var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };
+
+ for (var i = 1; i < parts.length; ++i) {
+ var pms = parts[i].split(/ *= */);
+ if ('q' == pms[0]) {
+ ret.quality = parseFloat(pms[1]);
+ } else {
+ ret.params[pms[0]] = pms[1];
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Escape special characters in the given string of html.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html) {
+ return String(html)
+ .replace(/&/g, '&amp;')
+ .replace(/"/g, '&quot;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;');
+};
+
+/**
+ * Normalize the given path string,
+ * returning a regular expression.
+ *
+ * An empty array should be passed,
+ * which will contain the placeholder
+ * key names. For example "/user/:id" will
+ * then contain ["id"].
+ *
+ * @param {String|RegExp|Array} path
+ * @param {Array} keys
+ * @param {Boolean} sensitive
+ * @param {Boolean} strict
+ * @return {RegExp}
+ * @api private
+ */
+
+exports.pathRegexp = function(path, keys, sensitive, strict) {
+ if (toString.call(path) == '[object RegExp]') return path;
+ if (Array.isArray(path)) path = '(' + path.join('|') + ')';
+ path = path
+ .concat(strict ? '' : '/?')
+ .replace(/\/\(/g, '(?:/')
+ .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){
+ keys.push({ name: key, optional: !! optional });
+ slash = slash || '';
+ return ''
+ + (optional ? '' : slash)
+ + '(?:'
+ + (optional ? slash : '')
+ + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')'
+ + (optional || '')
+ + (star ? '(/*)?' : '');
+ })
+ .replace(/([\/.])/g, '\\$1')
+ .replace(/\*/g, '(.*)');
+ return new RegExp('^' + path + '$', sensitive ? '' : 'i');
+}
diff --git a/node_modules/express/lib/view.js b/node_modules/express/lib/view.js
new file mode 100644
index 0000000..b9dc69e
--- /dev/null
+++ b/node_modules/express/lib/view.js
@@ -0,0 +1,77 @@
+/**
+ * Module dependencies.
+ */
+
+var path = require('path')
+ , fs = require('fs')
+ , utils = require('./utils')
+ , dirname = path.dirname
+ , basename = path.basename
+ , extname = path.extname
+ , exists = fs.existsSync || path.existsSync
+ , join = path.join;
+
+/**
+ * Expose `View`.
+ */
+
+module.exports = View;
+
+/**
+ * Initialize a new `View` with the given `name`.
+ *
+ * Options:
+ *
+ * - `defaultEngine` the default template engine name
+ * - `engines` template engine require() cache
+ * - `root` root path for view lookup
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @api private
+ */
+
+function View(name, options) {
+ options = options || {};
+ this.name = name;
+ this.root = options.root;
+ var engines = options.engines;
+ this.defaultEngine = options.defaultEngine;
+ var ext = this.ext = extname(name);
+ if (!ext && !this.defaultEngine) throw new Error('No default engine was specified and no extension was provided.');
+ if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine);
+ this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express);
+ this.path = this.lookup(name);
+}
+
+/**
+ * Lookup view by the given `path`
+ *
+ * @param {String} path
+ * @return {String}
+ * @api private
+ */
+
+View.prototype.lookup = function(path){
+ var ext = this.ext;
+
+ // <path>.<engine>
+ if (!utils.isAbsolute(path)) path = join(this.root, path);
+ if (exists(path)) return path;
+
+ // <path>/index.<engine>
+ path = join(dirname(path), basename(path, ext), 'index' + ext);
+ if (exists(path)) return path;
+};
+
+/**
+ * Render with the given `options` and callback `fn(err, str)`.
+ *
+ * @param {Object} options
+ * @param {Function} fn
+ * @api private
+ */
+
+View.prototype.render = function(options, fn){
+ this.engine(this.path, options, fn);
+};
diff --git a/node_modules/express/node_modules/buffer-crc32/.npmignore b/node_modules/express/node_modules/buffer-crc32/.npmignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/.npmignore
@@ -0,0 +1 @@
+node_modules \ No newline at end of file
diff --git a/node_modules/express/node_modules/buffer-crc32/.travis.yml b/node_modules/express/node_modules/buffer-crc32/.travis.yml
new file mode 100644
index 0000000..7a902e8
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/.travis.yml
@@ -0,0 +1,8 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
+notifications:
+ email:
+ recipients:
+ - brianloveswords@gmail.com \ No newline at end of file
diff --git a/node_modules/express/node_modules/buffer-crc32/README.md b/node_modules/express/node_modules/buffer-crc32/README.md
new file mode 100644
index 0000000..0d9d8b8
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/README.md
@@ -0,0 +1,47 @@
+# buffer-crc32
+
+[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)
+
+crc32 that works with binary data and fancy character sets, outputs
+buffer, signed or unsigned data and has tests.
+
+Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
+
+# install
+```
+npm install buffer-crc32
+```
+
+# example
+```js
+var crc32 = require('buffer-crc32');
+// works with buffers
+var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
+crc32(buf) // -> <Buffer 94 5a ab 4a>
+
+// has convenience methods for getting signed or unsigned ints
+crc32.signed(buf) // -> -1805997238
+crc32.unsigned(buf) // -> 2488970058
+
+// will cast to buffer if given a string, so you can
+// directly use foreign characters safely
+crc32('自動販売機') // -> <Buffer cb 03 1a c5>
+
+// and works in append mode too
+var partialCrc = crc32('hey');
+var partialCrc = crc32(' ', partialCrc);
+var partialCrc = crc32('sup', partialCrc);
+var partialCrc = crc32(' ', partialCrc);
+var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
+```
+
+# tests
+This was tested against the output of zlib's crc32 method. You can run
+the tests with`npm test` (requires tap)
+
+# see also
+https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
+supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
+
+# license
+MIT/X11
diff --git a/node_modules/express/node_modules/buffer-crc32/index.js b/node_modules/express/node_modules/buffer-crc32/index.js
new file mode 100644
index 0000000..e29ce3e
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/index.js
@@ -0,0 +1,88 @@
+var Buffer = require('buffer').Buffer;
+
+var CRC_TABLE = [
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+ 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+ 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+ 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+ 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+ 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+ 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+ 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+ 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+ 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+ 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+ 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+ 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+ 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+ 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+ 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+ 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+ 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+ 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+ 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+ 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+ 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+ 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+ 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+ 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+ 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+ 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+ 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+ 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+ 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+ 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+ 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+ 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+ 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+ 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+ 0x2d02ef8d
+];
+
+function bufferizeInt(num) {
+ var tmp = Buffer(4);
+ tmp.writeInt32BE(num, 0);
+ return tmp;
+}
+
+function _crc32(buf, previous) {
+ if (!Buffer.isBuffer(buf)) {
+ buf = Buffer(buf);
+ }
+ if (Buffer.isBuffer(previous)) {
+ previous = previous.readUInt32BE(0);
+ }
+ var crc = ~~previous ^ -1;
+ for (var n = 0; n < buf.length; n++) {
+ crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
+ }
+ return (crc ^ -1);
+}
+
+function crc32() {
+ return bufferizeInt(_crc32.apply(null, arguments));
+}
+crc32.signed = function () {
+ return _crc32.apply(null, arguments);
+};
+crc32.unsigned = function () {
+ return _crc32.apply(null, arguments) >>> 0;
+};
+
+module.exports = crc32;
diff --git a/node_modules/express/node_modules/buffer-crc32/package.json b/node_modules/express/node_modules/buffer-crc32/package.json
new file mode 100644
index 0000000..d69dfe6
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/package.json
@@ -0,0 +1,43 @@
+{
+ "author": {
+ "name": "Brian J. Brennan",
+ "email": "brianloveswords@gmail.com",
+ "url": "http://bjb.io"
+ },
+ "name": "buffer-crc32",
+ "description": "A pure javascript CRC32 algorithm that plays nice with binary data",
+ "version": "0.2.1",
+ "contributors": [
+ {
+ "name": "Vladimir Kuznetsov"
+ }
+ ],
+ "homepage": "https://github.com/brianloveswords/buffer-crc32",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/brianloveswords/buffer-crc32.git"
+ },
+ "main": "index.js",
+ "scripts": {
+ "test": "./node_modules/.bin/tap tests/*.test.js"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "optionalDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> <Buffer 94 5a ab 4a>\n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> <Buffer cb 03 1a c5>\n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>\n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/brianloveswords/buffer-crc32/issues"
+ },
+ "_id": "buffer-crc32@0.2.1",
+ "dist": {
+ "shasum": "d9653fc3342edeeb958c855c00da6396866821cc"
+ },
+ "_from": "buffer-crc32@0.2.1",
+ "_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz"
+}
diff --git a/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js
new file mode 100644
index 0000000..bb0f9ef
--- /dev/null
+++ b/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js
@@ -0,0 +1,89 @@
+var crc32 = require('..');
+var test = require('tap').test;
+
+test('simple crc32 is no problem', function (t) {
+ var input = Buffer('hey sup bros');
+ var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+ t.same(crc32(input), expected);
+ t.end();
+});
+
+test('another simple one', function (t) {
+ var input = Buffer('IEND');
+ var expected = Buffer([0xae, 0x42, 0x60, 0x82]);
+ t.same(crc32(input), expected);
+ t.end();
+});
+
+test('slightly more complex', function (t) {
+ var input = Buffer([0x00, 0x00, 0x00]);
+ var expected = Buffer([0xff, 0x41, 0xd9, 0x12]);
+ t.same(crc32(input), expected);
+ t.end();
+});
+
+test('complex crc32 gets calculated like a champ', function (t) {
+ var input = Buffer('शीर्षक');
+ var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+ t.same(crc32(input), expected);
+ t.end();
+});
+
+test('casts to buffer if necessary', function (t) {
+ var input = 'शीर्षक';
+ var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+ t.same(crc32(input), expected);
+ t.end();
+});
+
+test('can do signed', function (t) {
+ var input = 'ham sandwich';
+ var expected = -1891873021;
+ t.same(crc32.signed(input), expected);
+ t.end();
+});
+
+test('can do unsigned', function (t) {
+ var input = 'bear sandwich';
+ var expected = 3711466352;
+ t.same(crc32.unsigned(input), expected);
+ t.end();
+});
+
+
+test('simple crc32 in append mode', function (t) {
+ var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')];
+ var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+ for (var crc = 0, i = 0; i < input.length; i++) {
+ crc = crc32(input[i], crc);
+ }
+ t.same(crc, expected);
+ t.end();
+});
+
+
+test('can do signed in append mode', function (t) {
+ var input1 = 'ham';
+ var input2 = ' ';
+ var input3 = 'sandwich';
+ var expected = -1891873021;
+
+ var crc = crc32.signed(input1);
+ crc = crc32.signed(input2, crc);
+ crc = crc32.signed(input3, crc);
+
+ t.same(crc, expected);
+ t.end();
+});
+
+test('can do unsigned in append mode', function (t) {
+ var input1 = 'bear san';
+ var input2 = 'dwich';
+ var expected = 3711466352;
+
+ var crc = crc32.unsigned(input1);
+ crc = crc32.unsigned(input2, crc);
+ t.same(crc, expected);
+ t.end();
+});
+
diff --git a/node_modules/express/node_modules/commander/History.md b/node_modules/express/node_modules/commander/History.md
new file mode 100644
index 0000000..7cda70f
--- /dev/null
+++ b/node_modules/express/node_modules/commander/History.md
@@ -0,0 +1,158 @@
+
+1.2.0 / 2013-06-13
+==================
+
+ * allow "-" hyphen as an option argument
+ * support for RegExp coercion
+
+1.1.1 / 2012-11-20
+==================
+
+ * add more sub-command padding
+ * fix .usage() when args are present. Closes #106
+
+1.1.0 / 2012-11-16
+==================
+
+ * add git-style executable subcommand support. Closes #94
+
+1.0.5 / 2012-10-09
+==================
+
+ * fix `--name` clobbering. Closes #92
+ * fix examples/help. Closes #89
+
+1.0.4 / 2012-09-03
+==================
+
+ * add `outputHelp()` method.
+
+1.0.3 / 2012-08-30
+==================
+
+ * remove invalid .version() defaulting
+
+1.0.2 / 2012-08-24
+==================
+
+ * add `--foo=bar` support [arv]
+ * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
+
+1.0.1 / 2012-08-03
+==================
+
+ * fix issue #56
+ * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
+
+1.0.0 / 2012-07-05
+==================
+
+ * add support for optional option descriptions
+ * add defaulting of `.version()` to package.json's version
+
+0.6.1 / 2012-06-01
+==================
+
+ * Added: append (yes or no) on confirmation
+ * Added: allow node.js v0.7.x
+
+0.6.0 / 2012-04-10
+==================
+
+ * Added `.prompt(obj, callback)` support. Closes #49
+ * Added default support to .choose(). Closes #41
+ * Fixed the choice example
+
+0.5.1 / 2011-12-20
+==================
+
+ * Fixed `password()` for recent nodes. Closes #36
+
+0.5.0 / 2011-12-04
+==================
+
+ * Added sub-command option support [itay]
+
+0.4.3 / 2011-12-04
+==================
+
+ * Fixed custom help ordering. Closes #32
+
+0.4.2 / 2011-11-24
+==================
+
+ * Added travis support
+ * Fixed: line-buffered input automatically trimmed. Closes #31
+
+0.4.1 / 2011-11-18
+==================
+
+ * Removed listening for "close" on --help
+
+0.4.0 / 2011-11-15
+==================
+
+ * Added support for `--`. Closes #24
+
+0.3.3 / 2011-11-14
+==================
+
+ * Fixed: wait for close event when writing help info [Jerry Hamlet]
+
+0.3.2 / 2011-11-01
+==================
+
+ * Fixed long flag definitions with values [felixge]
+
+0.3.1 / 2011-10-31
+==================
+
+ * Changed `--version` short flag to `-V` from `-v`
+ * Changed `.version()` so it's configurable [felixge]
+
+0.3.0 / 2011-10-31
+==================
+
+ * Added support for long flags only. Closes #18
+
+0.2.1 / 2011-10-24
+==================
+
+ * "node": ">= 0.4.x < 0.7.0". Closes #20
+
+0.2.0 / 2011-09-26
+==================
+
+ * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
+
+0.1.0 / 2011-08-24
+==================
+
+ * Added support for custom `--help` output
+
+0.0.5 / 2011-08-18
+==================
+
+ * Changed: when the user enters nothing prompt for password again
+ * Fixed issue with passwords beginning with numbers [NuckChorris]
+
+0.0.4 / 2011-08-15
+==================
+
+ * Fixed `Commander#args`
+
+0.0.3 / 2011-08-15
+==================
+
+ * Added default option value support
+
+0.0.2 / 2011-08-15
+==================
+
+ * Added mask support to `Command#password(str[, mask], fn)`
+ * Added `Command#password(str, fn)`
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/commander/Readme.md b/node_modules/express/node_modules/commander/Readme.md
new file mode 100644
index 0000000..107932a
--- /dev/null
+++ b/node_modules/express/node_modules/commander/Readme.md
@@ -0,0 +1,276 @@
+# Commander.js
+
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+ $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+ .version('0.0.1')
+ .option('-p, --peppers', 'Add peppers')
+ .option('-P, --pineapple', 'Add pineapple')
+ .option('-b, --bbq', 'Add bbq sauce')
+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log(' - peppers');
+if (program.pineapple) console.log(' - pineappe');
+if (program.bbq) console.log(' - bbq');
+console.log(' - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```
+ $ ./examples/pizza --help
+
+ Usage: pizza [options]
+
+ Options:
+
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineappe
+ -b, --bbq Add bbq sauce
+ -c, --cheese <type> Add the specified type of cheese [marble]
+ -h, --help output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+ return val.split('..').map(Number);
+}
+
+function list(val) {
+ return val.split(',');
+}
+
+program
+ .version('0.0.1')
+ .usage('[options] <file ...>')
+ .option('-i, --integer <n>', 'An integer argument', parseInt)
+ .option('-f, --float <n>', 'A float argument', parseFloat)
+ .option('-r, --range <a>..<b>', 'A range', range)
+ .option('-l, --list <items>', 'A list', list)
+ .option('-o, --optional [value]', 'An optional value')
+ .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+ return val.split(',').map(Number);
+}
+
+program
+ .version('0.0.1')
+ .option('-f, --foo', 'enable some foo')
+ .option('-b, --bar', 'enable some bar')
+ .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+ console.log(' Examples:');
+ console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
+ console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+ -h, --help output usage information
+ -V, --version output the version number
+ -f, --foo enable some foo
+ -b, --bar enable some bar
+ -B, --baz enable some baz
+
+Examples:
+
+ $ custom-help --help
+ $ custom-help -h
+
+```
+
+## .prompt(msg, fn)
+
+ Single-line prompt:
+
+```js
+program.prompt('name: ', function(name){
+ console.log('hi %s', name);
+});
+```
+
+ Multi-line prompt:
+
+```js
+program.prompt('description:', function(name){
+ console.log('hi %s', name);
+});
+```
+
+ Coercion:
+
+```js
+program.prompt('Age: ', Number, function(age){
+ console.log('age: %j', age);
+});
+```
+
+```js
+program.prompt('Birthdate: ', Date, function(date){
+ console.log('date: %s', date);
+});
+```
+
+```js
+program.prompt('Email: ', /^.+@.+\..+$/, function(email){
+ console.log('email: %j', email);
+});
+```
+
+## .password(msg[, mask], fn)
+
+Prompt for password without echoing:
+
+```js
+program.password('Password: ', function(pass){
+ console.log('got "%s"', pass);
+ process.stdin.destroy();
+});
+```
+
+Prompt for password with mask char "*":
+
+```js
+program.password('Password: ', '*', function(pass){
+ console.log('got "%s"', pass);
+ process.stdin.destroy();
+});
+```
+
+## .confirm(msg, fn)
+
+ Confirm with the given `msg`:
+
+```js
+program.confirm('continue? ', function(ok){
+ console.log(' got %j', ok);
+});
+```
+
+## .choose(list, fn)
+
+ Let the user choose from a `list`:
+
+```js
+var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+
+console.log('Choose the coolest pet:');
+program.choose(list, function(i){
+ console.log('you chose %d "%s"', i, list[i]);
+});
+```
+
+## .outputHelp()
+
+ Output help information without exiting.
+
+## .help()
+
+ Output help information and exit immediately.
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/commander/index.js b/node_modules/express/node_modules/commander/index.js
new file mode 100644
index 0000000..0ceaf18
--- /dev/null
+++ b/node_modules/express/node_modules/commander/index.js
@@ -0,0 +1,1152 @@
+/*!
+ * commander
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , spawn = require('child_process').spawn
+ , keypress = require('keypress')
+ , fs = require('fs')
+ , exists = fs.existsSync
+ , path = require('path')
+ , tty = require('tty')
+ , dirname = path.dirname
+ , basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+ this.flags = flags;
+ this.required = ~flags.indexOf('<');
+ this.optional = ~flags.indexOf('[');
+ this.bool = !~flags.indexOf('-no-');
+ flags = flags.split(/[ ,|]+/);
+ if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+ this.long = flags.shift();
+ this.description = description || '';
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+ return this.long
+ .replace('--', '')
+ .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+ return arg == this.short
+ || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+ this.commands = [];
+ this.options = [];
+ this._args = [];
+ this._name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ * program
+ * .version('0.0.1')
+ * .option('-C, --chdir <path>', 'change the working directory')
+ * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ * .option('-T, --no-tests', 'ignore test hook')
+ *
+ * program
+ * .command('setup')
+ * .description('run remote setup commands')
+ * .action(function(){
+ * console.log('setup');
+ * });
+ *
+ * program
+ * .command('exec <cmd>')
+ * .description('run the given remote command')
+ * .action(function(cmd){
+ * console.log('exec "%s"', cmd);
+ * });
+ *
+ * program
+ * .command('*')
+ * .description('deploy the given env')
+ * .action(function(env){
+ * console.log('deploying "%s"', env);
+ * });
+ *
+ * program.parse(process.argv);
+ *
+ * @param {String} name
+ * @param {String} [desc]
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name, desc){
+ var args = name.split(/ +/);
+ var cmd = new Command(args.shift());
+ if (desc) cmd.description(desc);
+ if (desc) this.executables = true;
+ this.commands.push(cmd);
+ cmd.parseExpectedArgs(args);
+ cmd.parent = this;
+ if (desc) return this;
+ return cmd;
+};
+
+/**
+ * Add an implicit `help [cmd]` subcommand
+ * which invokes `--help` for the given command.
+ *
+ * @api private
+ */
+
+Command.prototype.addImplicitHelpCommand = function() {
+ this.command('help [cmd]', 'display help for [cmd]');
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+ if (!args.length) return;
+ var self = this;
+ args.forEach(function(arg){
+ switch (arg[0]) {
+ case '<':
+ self._args.push({ required: true, name: arg.slice(1, -1) });
+ break;
+ case '[':
+ self._args.push({ required: false, name: arg.slice(1, -1) });
+ break;
+ }
+ });
+ return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ * program
+ * .command('help')
+ * .description('display verbose help')
+ * .action(function(){
+ * // output help here
+ * });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+ var self = this;
+ this.parent.on(this._name, function(args, unknown){
+ // Parse any so-far unknown options
+ unknown = unknown || [];
+ var parsed = self.parseOptions(unknown);
+
+ // Output help if necessary
+ outputHelpIfNecessary(self, parsed.unknown);
+
+ // If there are still any unknown options, then we simply
+ // die, unless someone asked for help, in which case we give it
+ // to them, and then we die.
+ if (parsed.unknown.length > 0) {
+ self.unknownOption(parsed.unknown[0]);
+ }
+
+ // Leftover arguments need to be pushed back. Fixes issue #56
+ if (parsed.args.length) args = parsed.args.concat(args);
+
+ self._args.forEach(function(arg, i){
+ if (arg.required && null == args[i]) {
+ self.missingArgument(arg.name);
+ }
+ });
+
+ // Always append ourselves to the end of the arguments,
+ // to make sure we match the number of arguments the user
+ // expects
+ if (self._args.length) {
+ args[self._args.length] = self;
+ } else {
+ args.push(self);
+ }
+
+ fn.apply(this, args);
+ });
+ return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`.
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ * "-p, --pepper"
+ * "-p|--pepper"
+ * "-p --pepper"
+ *
+ * Examples:
+ *
+ * // simple boolean defaulting to false
+ * program.option('-p, --pepper', 'add pepper');
+ *
+ * --pepper
+ * program.pepper
+ * // => Boolean
+ *
+ * // simple boolean defaulting to false
+ * program.option('-C, --no-cheese', 'remove cheese');
+ *
+ * program.cheese
+ * // => true
+ *
+ * --no-cheese
+ * program.cheese
+ * // => true
+ *
+ * // required argument
+ * program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ * --chdir /tmp
+ * program.chdir
+ * // => "/tmp"
+ *
+ * // optional argument
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+ var self = this
+ , option = new Option(flags, description)
+ , oname = option.name()
+ , name = camelcase(oname);
+
+ // default as 3rd arg
+ if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+ // preassign default value only for --no-*, [optional], or <required>
+ if (false == option.bool || option.optional || option.required) {
+ // when --no-* we make sure default is true
+ if (false == option.bool) defaultValue = true;
+ // preassign only if we have a default
+ if (undefined !== defaultValue) self[name] = defaultValue;
+ }
+
+ // register the option
+ this.options.push(option);
+
+ // when it's passed assign the value
+ // and conditionally invoke the callback
+ this.on(oname, function(val){
+ // coercion
+ if (null != val && fn) val = fn(val);
+
+ // unassigned or bool
+ if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ // if no value, bool true, and we have a default, then use it!
+ if (null == val) {
+ self[name] = option.bool
+ ? defaultValue || true
+ : false;
+ } else {
+ self[name] = val;
+ }
+ } else if (null !== val) {
+ // reassign
+ self[name] = val;
+ }
+ });
+
+ return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+ // implicit help
+ if (this.executables) this.addImplicitHelpCommand();
+
+ // store raw args
+ this.rawArgs = argv;
+
+ // guess name
+ this._name = this._name || basename(argv[1]);
+
+ // process argv
+ var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+ var args = this.args = parsed.args;
+
+ // executable sub-commands, skip .parseArgs()
+ if (this.executables) return this.executeSubCommand(argv, args, parsed.unknown);
+
+ return this.parseArgs(this.args, parsed.unknown);
+};
+
+/**
+ * Execute a sub-command executable.
+ *
+ * @param {Array} argv
+ * @param {Array} args
+ * @param {Array} unknown
+ * @api private
+ */
+
+Command.prototype.executeSubCommand = function(argv, args, unknown) {
+ args = args.concat(unknown);
+
+ if (!args.length) this.help();
+ if ('help' == args[0] && 1 == args.length) this.help();
+
+ // <cmd> --help
+ if ('help' == args[0]) {
+ args[0] = args[1];
+ args[1] = '--help';
+ }
+
+ // executable
+ var dir = dirname(argv[1]);
+ var bin = basename(argv[1]) + '-' + args[0];
+
+ // check for ./<bin> first
+ var local = path.join(dir, bin);
+ if (exists(local)) bin = local;
+
+ // run it
+ args = args.slice(1);
+ var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
+ proc.on('exit', function(code){
+ if (code == 127) {
+ console.error('\n %s(1) does not exist\n', bin);
+ }
+ });
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ * This also normalizes equal sign and splits "--abc=def" into "--abc def".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+ var ret = []
+ , arg
+ , index;
+
+ for (var i = 0, len = args.length; i < len; ++i) {
+ arg = args[i];
+ if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ arg.slice(1).split('').forEach(function(c){
+ ret.push('-' + c);
+ });
+ } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
+ ret.push(arg.slice(0, index), arg.slice(index + 1));
+ } else {
+ ret.push(arg);
+ }
+ }
+
+ return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+ var cmds = this.commands
+ , len = cmds.length
+ , name;
+
+ if (args.length) {
+ name = args[0];
+ if (this.listeners(name).length) {
+ this.emit(args.shift(), args, unknown);
+ } else {
+ this.emit('*', args);
+ }
+ } else {
+ outputHelpIfNecessary(this, unknown);
+
+ // If there were no args and we have unknown options,
+ // then they are extraneous and we need to error.
+ if (unknown.length > 0) {
+ this.unknownOption(unknown[0]);
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+ for (var i = 0, len = this.options.length; i < len; ++i) {
+ if (this.options[i].is(arg)) {
+ return this.options[i];
+ }
+ }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+ var args = []
+ , len = argv.length
+ , literal
+ , option
+ , arg;
+
+ var unknownOptions = [];
+
+ // parse options
+ for (var i = 0; i < len; ++i) {
+ arg = argv[i];
+
+ // literal args after --
+ if ('--' == arg) {
+ literal = true;
+ continue;
+ }
+
+ if (literal) {
+ args.push(arg);
+ continue;
+ }
+
+ // find matching Option
+ option = this.optionFor(arg);
+
+ // option is defined
+ if (option) {
+ // requires arg
+ if (option.required) {
+ arg = argv[++i];
+ if (null == arg) return this.optionMissingArgument(option);
+ if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);
+ this.emit(option.name(), arg);
+ // optional arg
+ } else if (option.optional) {
+ arg = argv[i+1];
+ if (null == arg || ('-' == arg[0] && '-' != arg)) {
+ arg = null;
+ } else {
+ ++i;
+ }
+ this.emit(option.name(), arg);
+ // bool
+ } else {
+ this.emit(option.name());
+ }
+ continue;
+ }
+
+ // looks like an option
+ if (arg.length > 1 && '-' == arg[0]) {
+ unknownOptions.push(arg);
+
+ // If the next argument looks like it might be
+ // an argument for this option, we pass it on.
+ // If it isn't, then it'll simply be ignored
+ if (argv[i+1] && '-' != argv[i+1][0]) {
+ unknownOptions.push(argv[++i]);
+ }
+ continue;
+ }
+
+ // arg
+ args.push(arg);
+ }
+
+ return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+ console.error();
+ console.error(" error: missing required argument `%s'", name);
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+ console.error();
+ if (flag) {
+ console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
+ } else {
+ console.error(" error: option `%s' argument missing", option.flags);
+ }
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+ console.error();
+ console.error(" error: unknown option `%s'", flag);
+ console.error();
+ process.exit(1);
+};
+
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+ if (0 == arguments.length) return this._version;
+ this._version = str;
+ flags = flags || '-V, --version';
+ this.option(flags, 'output the version number');
+ this.on('version', function(){
+ console.log(str);
+ process.exit(0);
+ });
+ return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+ if (0 == arguments.length) return this._description;
+ this._description = str;
+ return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+ var args = this._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ });
+
+ var usage = '[options'
+ + (this.commands.length ? '] [command' : '')
+ + ']'
+ + (this._args.length ? ' ' + args : '');
+
+ if (0 == arguments.length) return this._usage || usage;
+ this._usage = str;
+
+ return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+ return this.options.reduce(function(max, option){
+ return Math.max(max, option.flags.length);
+ }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+ var width = this.largestOptionLength();
+
+ // Prepend the help information
+ return [pad('-h, --help', width) + ' ' + 'output usage information']
+ .concat(this.options.map(function(option){
+ return pad(option.flags, width)
+ + ' ' + option.description;
+ }))
+ .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+ if (!this.commands.length) return '';
+ return [
+ ''
+ , ' Commands:'
+ , ''
+ , this.commands.map(function(cmd){
+ var args = cmd._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ }).join(' ');
+
+ return pad(cmd._name
+ + (cmd.options.length
+ ? ' [options]'
+ : '') + ' ' + args, 22)
+ + (cmd.description()
+ ? ' ' + cmd.description()
+ : '');
+ }).join('\n').replace(/^/gm, ' ')
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+ return [
+ ''
+ , ' Usage: ' + this._name + ' ' + this.usage()
+ , '' + this.commandHelp()
+ , ' Options:'
+ , ''
+ , '' + this.optionHelp().replace(/^/gm, ' ')
+ , ''
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Prompt for a `Number`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForNumber = function(str, fn){
+ var self = this;
+ this.promptSingleLine(str, function parseNumber(val){
+ val = Number(val);
+ if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
+ fn(val);
+ });
+};
+
+/**
+ * Prompt for a `Date`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForDate = function(str, fn){
+ var self = this;
+ this.promptSingleLine(str, function parseDate(val){
+ val = new Date(val);
+ if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
+ fn(val);
+ });
+};
+
+
+/**
+ * Prompt for a `Regular Expression`.
+ *
+ * @param {String} str
+ * @param {Object} pattern regular expression object to test
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForRegexp = function(str, pattern, fn){
+ var self = this;
+ this.promptSingleLine(str, function parseRegexp(val){
+ if(!pattern.test(val)) return self.promptSingleLine(str + '(regular expression mismatch) ', parseRegexp);
+ fn(val);
+ });
+};
+
+
+/**
+ * Single-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptSingleLine = function(str, fn){
+ // determine if the 2nd argument is a regular expression
+ if (arguments[1].global !== undefined && arguments[1].multiline !== undefined) {
+ return this.promptForRegexp(str, arguments[1], arguments[2]);
+ } else if ('function' == typeof arguments[2]) {
+ return this['promptFor' + (fn.name || fn)](str, arguments[2]);
+ }
+
+ process.stdout.write(str);
+ process.stdin.setEncoding('utf8');
+ process.stdin.once('data', function(val){
+ fn(val.trim());
+ }).resume();
+};
+
+/**
+ * Multi-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptMultiLine = function(str, fn){
+ var buf = [];
+ console.log(str);
+ process.stdin.setEncoding('utf8');
+ process.stdin.on('data', function(val){
+ if ('\n' == val || '\r\n' == val) {
+ process.stdin.removeAllListeners('data');
+ fn(buf.join('\n'));
+ } else {
+ buf.push(val.trimRight());
+ }
+ }).resume();
+};
+
+/**
+ * Prompt `str` and callback `fn(val)`
+ *
+ * Commander supports single-line and multi-line prompts.
+ * To issue a single-line prompt simply add white-space
+ * to the end of `str`, something like "name: ", whereas
+ * for a multi-line prompt omit this "description:".
+ *
+ *
+ * Examples:
+ *
+ * program.prompt('Username: ', function(name){
+ * console.log('hi %s', name);
+ * });
+ *
+ * program.prompt('Description:', function(desc){
+ * console.log('description was "%s"', desc.trim());
+ * });
+ *
+ * @param {String|Object} str
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.prompt = function(str, fn){
+ var self = this;
+ if ('string' == typeof str) {
+ if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
+ this.promptMultiLine(str, fn);
+ } else {
+ var keys = Object.keys(str)
+ , obj = {};
+
+ function next() {
+ var key = keys.shift()
+ , label = str[key];
+
+ if (!key) return fn(obj);
+ self.prompt(label, function(val){
+ obj[key] = val;
+ next();
+ });
+ }
+
+ next();
+ }
+};
+
+/**
+ * Prompt for password with `str`, `mask` char and callback `fn(val)`.
+ *
+ * The mask string defaults to '', aka no output is
+ * written while typing, you may want to use "*" etc.
+ *
+ * Examples:
+ *
+ * program.password('Password: ', function(pass){
+ * console.log('got "%s"', pass);
+ * process.stdin.destroy();
+ * });
+ *
+ * program.password('Password: ', '*', function(pass){
+ * console.log('got "%s"', pass);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {String} str
+ * @param {String} mask
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.password = function(str, mask, fn){
+ var self = this
+ , buf = '';
+
+ // default mask
+ if ('function' == typeof mask) {
+ fn = mask;
+ mask = '';
+ }
+
+ keypress(process.stdin);
+
+ function setRawMode(mode) {
+ if (process.stdin.setRawMode) {
+ process.stdin.setRawMode(mode);
+ } else {
+ tty.setRawMode(mode);
+ }
+ };
+ setRawMode(true);
+ process.stdout.write(str);
+
+ // keypress
+ process.stdin.on('keypress', function(c, key){
+ if (key && 'enter' == key.name) {
+ console.log();
+ process.stdin.pause();
+ process.stdin.removeAllListeners('keypress');
+ setRawMode(false);
+ if (!buf.trim().length) return self.password(str, mask, fn);
+ fn(buf);
+ return;
+ }
+
+ if (key && key.ctrl && 'c' == key.name) {
+ console.log('%s', buf);
+ process.exit();
+ }
+
+ process.stdout.write(mask);
+ buf += c;
+ }).resume();
+};
+
+/**
+ * Confirmation prompt with `str` and callback `fn(bool)`
+ *
+ * Examples:
+ *
+ * program.confirm('continue? ', function(ok){
+ * console.log(' got %j', ok);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api public
+ */
+
+
+Command.prototype.confirm = function(str, fn, verbose){
+ var self = this;
+ this.prompt(str, function(ok){
+ if (!ok.trim()) {
+ if (!verbose) str += '(yes or no) ';
+ return self.confirm(str, fn, true);
+ }
+ fn(parseBool(ok));
+ });
+};
+
+/**
+ * Choice prompt with `list` of items and callback `fn(index, item)`
+ *
+ * Examples:
+ *
+ * var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+ *
+ * console.log('Choose the coolest pet:');
+ * program.choose(list, function(i){
+ * console.log('you chose %d "%s"', i, list[i]);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {Array} list
+ * @param {Number|Function} index or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.choose = function(list, index, fn){
+ var self = this
+ , hasDefault = 'number' == typeof index;
+
+ if (!hasDefault) {
+ fn = index;
+ index = null;
+ }
+
+ list.forEach(function(item, i){
+ if (hasDefault && i == index) {
+ console.log('* %d) %s', i + 1, item);
+ } else {
+ console.log(' %d) %s', i + 1, item);
+ }
+ });
+
+ function again() {
+ self.prompt(' : ', function(val){
+ val = parseInt(val, 10) - 1;
+ if (hasDefault && isNaN(val)) val = index;
+
+ if (null == list[val]) {
+ again();
+ } else {
+ fn(val, list[val]);
+ }
+ });
+ }
+
+ again();
+};
+
+
+/**
+ * Output help information for this command
+ *
+ * @api public
+ */
+
+Command.prototype.outputHelp = function(){
+ process.stdout.write(this.helpInformation());
+ this.emit('--help');
+};
+
+/**
+ * Output help information and exit.
+ *
+ * @api public
+ */
+
+Command.prototype.help = function(){
+ this.outputHelp();
+ process.exit();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+ return flag.split('-').reduce(function(str, word){
+ return str + word[0].toUpperCase() + word.slice(1);
+ });
+}
+
+/**
+ * Parse a boolean `str`.
+ *
+ * @param {String} str
+ * @return {Boolean}
+ * @api private
+ */
+
+function parseBool(str) {
+ return /^y|yes|ok|true$/i.test(str);
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+ var len = Math.max(0, width - str.length);
+ return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+ options = options || [];
+ for (var i = 0; i < options.length; i++) {
+ if (options[i] == '--help' || options[i] == '-h') {
+ cmd.outputHelp();
+ process.exit(0);
+ }
+ }
+}
diff --git a/node_modules/express/node_modules/commander/node_modules/keypress/README.md b/node_modules/express/node_modules/commander/node_modules/keypress/README.md
new file mode 100644
index 0000000..a768e8f
--- /dev/null
+++ b/node_modules/express/node_modules/commander/node_modules/keypress/README.md
@@ -0,0 +1,101 @@
+keypress
+========
+### Make any Node ReadableStream emit "keypress" events
+
+
+Previous to Node `v0.8.x`, there was an undocumented `"keypress"` event that
+`process.stdin` would emit when it was a TTY. Some people discovered this hidden
+gem, and started using it in their own code.
+
+Now in Node `v0.8.x`, this `"keypress"` event does not get emitted by default,
+but rather only when it is being used in conjuction with the `readline` (or by
+extension, the `repl`) module.
+
+This module is the exact logic from the node `v0.8.x` releases ripped out into its
+own module.
+
+__Bonus:__ Now with mouse support!
+
+Installation
+------------
+
+Install with `npm`:
+
+``` bash
+$ npm install keypress
+```
+
+Or add it to the `"dependencies"` section of your _package.json_ file.
+
+
+Example
+-------
+
+#### Listening for "keypress" events
+
+``` js
+var keypress = require('keypress');
+
+// make `process.stdin` begin emitting "keypress" events
+keypress(process.stdin);
+
+// listen for the "keypress" event
+process.stdin.on('keypress', function (ch, key) {
+ console.log('got "keypress"', key);
+ if (key && key.ctrl && key.name == 'c') {
+ process.stdin.pause();
+ }
+});
+
+process.stdin.setRawMode(true);
+process.stdin.resume();
+```
+
+#### Listening for "mousepress" events
+
+``` js
+var keypress = require('keypress');
+
+// make `process.stdin` begin emitting "mousepress" (and "keypress") events
+keypress(process.stdin);
+
+// you must enable the mouse events before they will begin firing
+keypress.enableMouse(process.stdout);
+
+process.stdin.on('mousepress', function (info) {
+ console.log('got "mousepress" event at %d x %d', info.x, info.y);
+});
+
+process.on('exit', function () {
+ // disable mouse on exit, so that the state
+ // is back to normal for the terminal
+ keypress.disableMouse(process.stdout);
+});
+```
+
+
+License
+-------
+
+(The MIT License)
+
+Copyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/commander/node_modules/keypress/index.js b/node_modules/express/node_modules/commander/node_modules/keypress/index.js
new file mode 100644
index 0000000..c2ba488
--- /dev/null
+++ b/node_modules/express/node_modules/commander/node_modules/keypress/index.js
@@ -0,0 +1,346 @@
+
+/**
+ * This module offers the internal "keypress" functionality from node-core's
+ * `readline` module, for your own programs and modules to use.
+ *
+ * Usage:
+ *
+ * require('keypress')(process.stdin);
+ *
+ * process.stdin.on('keypress', function (ch, key) {
+ * console.log(ch, key);
+ * if (key.ctrl && key.name == 'c') {
+ * process.stdin.pause();
+ * }
+ * });
+ * proces.stdin.resume();
+ */
+var exports = module.exports = keypress;
+
+exports.enableMouse = function (stream) {
+ stream.write('\x1b' +'[?1000h')
+}
+
+exports.disableMouse = function (stream) {
+ stream.write('\x1b' +'[?1000l')
+}
+
+
+/**
+ * accepts a readable Stream instance and makes it emit "keypress" events
+ */
+
+function keypress(stream) {
+ if (isEmittingKeypress(stream)) return;
+ stream._emitKeypress = true;
+
+ function onData(b) {
+ if (stream.listeners('keypress').length > 0) {
+ emitKey(stream, b);
+ } else {
+ // Nobody's watching anyway
+ stream.removeListener('data', onData);
+ stream.on('newListener', onNewListener);
+ }
+ }
+
+ function onNewListener(event) {
+ if (event == 'keypress') {
+ stream.on('data', onData);
+ stream.removeListener('newListener', onNewListener);
+ }
+ }
+
+ if (stream.listeners('keypress').length > 0) {
+ stream.on('data', onData);
+ } else {
+ stream.on('newListener', onNewListener);
+ }
+}
+
+/**
+ * Returns `true` if the stream is already emitting "keypress" events.
+ * `false` otherwise.
+ */
+
+function isEmittingKeypress(stream) {
+ var rtn = stream._emitKeypress;
+ if (!rtn) {
+ // hack: check for the v0.6.x "data" event
+ stream.listeners('data').forEach(function (l) {
+ if (l.name == 'onData' && /emitKey/.test(l.toString())) {
+ rtn = true;
+ stream._emitKeypress = true;
+ }
+ });
+ }
+ if (!rtn) {
+ // hack: check for the v0.6.x "newListener" event
+ stream.listeners('newListener').forEach(function (l) {
+ if (l.name == 'onNewListener' && /keypress/.test(l.toString())) {
+ rtn = true;
+ stream._emitKeypress = true;
+ }
+ });
+ }
+ return rtn;
+}
+
+
+/*
+ Some patterns seen in terminal key escape codes, derived from combos seen
+ at http://www.midnight-commander.org/browser/lib/tty/key.c
+
+ ESC letter
+ ESC [ letter
+ ESC [ modifier letter
+ ESC [ 1 ; modifier letter
+ ESC [ num char
+ ESC [ num ; modifier char
+ ESC O letter
+ ESC O modifier letter
+ ESC O 1 ; modifier letter
+ ESC N letter
+ ESC [ [ num ; modifier char
+ ESC [ [ 1 ; modifier letter
+ ESC ESC [ num char
+ ESC ESC O letter
+
+ - char is usually ~ but $ and ^ also happen with rxvt
+ - modifier is 1 +
+ (shift * 1) +
+ (left_alt * 2) +
+ (ctrl * 4) +
+ (right_alt * 8)
+ - two leading ESCs apparently mean the same as one leading ESC
+*/
+
+// Regexes used for ansi escape code splitting
+var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/;
+var functionKeyCodeRe =
+ /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/;
+
+function emitKey(stream, s) {
+ var ch,
+ key = {
+ name: undefined,
+ ctrl: false,
+ meta: false,
+ shift: false
+ },
+ parts;
+
+ if (Buffer.isBuffer(s)) {
+ if (s[0] > 127 && s[1] === undefined) {
+ s[0] -= 128;
+ s = '\x1b' + s.toString(stream.encoding || 'utf-8');
+ } else {
+ s = s.toString(stream.encoding || 'utf-8');
+ }
+ }
+
+ key.sequence = s;
+
+ if (s === '\r' || s === '\n') {
+ // enter
+ key.name = 'enter';
+
+ } else if (s === '\t') {
+ // tab
+ key.name = 'tab';
+
+ } else if (s === '\b' || s === '\x7f' ||
+ s === '\x1b\x7f' || s === '\x1b\b') {
+ // backspace or ctrl+h
+ key.name = 'backspace';
+ key.meta = (s.charAt(0) === '\x1b');
+
+ } else if (s === '\x1b' || s === '\x1b\x1b') {
+ // escape key
+ key.name = 'escape';
+ key.meta = (s.length === 2);
+
+ } else if (s === ' ' || s === '\x1b ') {
+ key.name = 'space';
+ key.meta = (s.length === 2);
+
+ } else if (s <= '\x1a') {
+ // ctrl+letter
+ key.name = String.fromCharCode(s.charCodeAt(0) + 'a'.charCodeAt(0) - 1);
+ key.ctrl = true;
+
+ } else if (s.length === 1 && s >= 'a' && s <= 'z') {
+ // lowercase letter
+ key.name = s;
+
+ } else if (s.length === 1 && s >= 'A' && s <= 'Z') {
+ // shift+letter
+ key.name = s.toLowerCase();
+ key.shift = true;
+
+ } else if (parts = metaKeyCodeRe.exec(s)) {
+ // meta+character key
+ key.name = parts[1].toLowerCase();
+ key.meta = true;
+ key.shift = /^[A-Z]$/.test(parts[1]);
+
+ } else if (parts = functionKeyCodeRe.exec(s)) {
+ // ansi escape sequence
+
+ // reassemble the key code leaving out leading \x1b's,
+ // the modifier key bitflag and any meaningless "1;" sequence
+ var code = (parts[1] || '') + (parts[2] || '') +
+ (parts[4] || '') + (parts[6] || ''),
+ modifier = (parts[3] || parts[5] || 1) - 1;
+
+ // Parse the key modifier
+ key.ctrl = !!(modifier & 4);
+ key.meta = !!(modifier & 10);
+ key.shift = !!(modifier & 1);
+ key.code = code;
+
+ // Parse the key itself
+ switch (code) {
+ /* xterm/gnome ESC O letter */
+ case 'OP': key.name = 'f1'; break;
+ case 'OQ': key.name = 'f2'; break;
+ case 'OR': key.name = 'f3'; break;
+ case 'OS': key.name = 'f4'; break;
+
+ /* xterm/rxvt ESC [ number ~ */
+ case '[11~': key.name = 'f1'; break;
+ case '[12~': key.name = 'f2'; break;
+ case '[13~': key.name = 'f3'; break;
+ case '[14~': key.name = 'f4'; break;
+
+ /* from Cygwin and used in libuv */
+ case '[[A': key.name = 'f1'; break;
+ case '[[B': key.name = 'f2'; break;
+ case '[[C': key.name = 'f3'; break;
+ case '[[D': key.name = 'f4'; break;
+ case '[[E': key.name = 'f5'; break;
+
+ /* common */
+ case '[15~': key.name = 'f5'; break;
+ case '[17~': key.name = 'f6'; break;
+ case '[18~': key.name = 'f7'; break;
+ case '[19~': key.name = 'f8'; break;
+ case '[20~': key.name = 'f9'; break;
+ case '[21~': key.name = 'f10'; break;
+ case '[23~': key.name = 'f11'; break;
+ case '[24~': key.name = 'f12'; break;
+
+ /* xterm ESC [ letter */
+ case '[A': key.name = 'up'; break;
+ case '[B': key.name = 'down'; break;
+ case '[C': key.name = 'right'; break;
+ case '[D': key.name = 'left'; break;
+ case '[E': key.name = 'clear'; break;
+ case '[F': key.name = 'end'; break;
+ case '[H': key.name = 'home'; break;
+
+ /* xterm/gnome ESC O letter */
+ case 'OA': key.name = 'up'; break;
+ case 'OB': key.name = 'down'; break;
+ case 'OC': key.name = 'right'; break;
+ case 'OD': key.name = 'left'; break;
+ case 'OE': key.name = 'clear'; break;
+ case 'OF': key.name = 'end'; break;
+ case 'OH': key.name = 'home'; break;
+
+ /* xterm/rxvt ESC [ number ~ */
+ case '[1~': key.name = 'home'; break;
+ case '[2~': key.name = 'insert'; break;
+ case '[3~': key.name = 'delete'; break;
+ case '[4~': key.name = 'end'; break;
+ case '[5~': key.name = 'pageup'; break;
+ case '[6~': key.name = 'pagedown'; break;
+
+ /* putty */
+ case '[[5~': key.name = 'pageup'; break;
+ case '[[6~': key.name = 'pagedown'; break;
+
+ /* rxvt */
+ case '[7~': key.name = 'home'; break;
+ case '[8~': key.name = 'end'; break;
+
+ /* rxvt keys with modifiers */
+ case '[a': key.name = 'up'; key.shift = true; break;
+ case '[b': key.name = 'down'; key.shift = true; break;
+ case '[c': key.name = 'right'; key.shift = true; break;
+ case '[d': key.name = 'left'; key.shift = true; break;
+ case '[e': key.name = 'clear'; key.shift = true; break;
+
+ case '[2$': key.name = 'insert'; key.shift = true; break;
+ case '[3$': key.name = 'delete'; key.shift = true; break;
+ case '[5$': key.name = 'pageup'; key.shift = true; break;
+ case '[6$': key.name = 'pagedown'; key.shift = true; break;
+ case '[7$': key.name = 'home'; key.shift = true; break;
+ case '[8$': key.name = 'end'; key.shift = true; break;
+
+ case 'Oa': key.name = 'up'; key.ctrl = true; break;
+ case 'Ob': key.name = 'down'; key.ctrl = true; break;
+ case 'Oc': key.name = 'right'; key.ctrl = true; break;
+ case 'Od': key.name = 'left'; key.ctrl = true; break;
+ case 'Oe': key.name = 'clear'; key.ctrl = true; break;
+
+ case '[2^': key.name = 'insert'; key.ctrl = true; break;
+ case '[3^': key.name = 'delete'; key.ctrl = true; break;
+ case '[5^': key.name = 'pageup'; key.ctrl = true; break;
+ case '[6^': key.name = 'pagedown'; key.ctrl = true; break;
+ case '[7^': key.name = 'home'; key.ctrl = true; break;
+ case '[8^': key.name = 'end'; key.ctrl = true; break;
+
+ /* misc. */
+ case '[Z': key.name = 'tab'; key.shift = true; break;
+ default: key.name = 'undefined'; break;
+
+ }
+ } else if (s.length > 1 && s[0] !== '\x1b') {
+ // Got a longer-than-one string of characters.
+ // Probably a paste, since it wasn't a control sequence.
+ Array.prototype.forEach.call(s, function(c) {
+ emitKey(stream, c);
+ });
+ return;
+ }
+
+ if (key.code == '[M') {
+ key.name = 'mouse';
+ var s = key.sequence;
+ var b = s.charCodeAt(3);
+ key.x = s.charCodeAt(4) - 040;
+ key.y = s.charCodeAt(5) - 040;
+
+ key.scroll = 0;
+
+ key.ctrl = !!(1<<4 & b);
+ key.meta = !!(1<<3 & b);
+ key.shift = !!(1<<2 & b);
+
+ key.release = (3 & b) === 3;
+
+ if (1<<6 & b) { //scroll
+ key.scroll = 1 & b ? 1 : -1;
+ }
+
+ if (!key.release && !key.scroll) {
+ key.button = b & 3;
+ }
+ }
+
+ // Don't emit a key if no name was found
+ if (key.name === undefined) {
+ key = undefined;
+ }
+
+ if (s.length === 1) {
+ ch = s;
+ }
+
+ if (key && key.name == 'mouse') {
+ stream.emit('mousepress', key)
+ } else if (key || ch) {
+ stream.emit('keypress', ch, key);
+ }
+}
diff --git a/node_modules/express/node_modules/commander/node_modules/keypress/package.json b/node_modules/express/node_modules/commander/node_modules/keypress/package.json
new file mode 100644
index 0000000..7f460c2
--- /dev/null
+++ b/node_modules/express/node_modules/commander/node_modules/keypress/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "keypress",
+ "version": "0.1.0",
+ "description": "Make any Node ReadableStream emit \"keypress\" events",
+ "author": {
+ "name": "Nathan Rajlich",
+ "email": "nathan@tootallnate.net",
+ "url": "http://tootallnate.net"
+ },
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/TooTallNate/keypress.git"
+ },
+ "keywords": [
+ "keypress",
+ "readline",
+ "core"
+ ],
+ "license": "MIT",
+ "readme": "keypress\n========\n### Make any Node ReadableStream emit \"keypress\" events\n\n\nPrevious to Node `v0.8.x`, there was an undocumented `\"keypress\"` event that\n`process.stdin` would emit when it was a TTY. Some people discovered this hidden\ngem, and started using it in their own code.\n\nNow in Node `v0.8.x`, this `\"keypress\"` event does not get emitted by default,\nbut rather only when it is being used in conjuction with the `readline` (or by\nextension, the `repl`) module.\n\nThis module is the exact logic from the node `v0.8.x` releases ripped out into its\nown module.\n\n__Bonus:__ Now with mouse support!\n\nInstallation\n------------\n\nInstall with `npm`:\n\n``` bash\n$ npm install keypress\n```\n\nOr add it to the `\"dependencies\"` section of your _package.json_ file.\n\n\nExample\n-------\n\n#### Listening for \"keypress\" events\n\n``` js\nvar keypress = require('keypress');\n\n// make `process.stdin` begin emitting \"keypress\" events\nkeypress(process.stdin);\n\n// listen for the \"keypress\" event\nprocess.stdin.on('keypress', function (ch, key) {\n console.log('got \"keypress\"', key);\n if (key && key.ctrl && key.name == 'c') {\n process.stdin.pause();\n }\n});\n\nprocess.stdin.setRawMode(true);\nprocess.stdin.resume();\n```\n\n#### Listening for \"mousepress\" events\n\n``` js\nvar keypress = require('keypress');\n\n// make `process.stdin` begin emitting \"mousepress\" (and \"keypress\") events\nkeypress(process.stdin);\n\n// you must enable the mouse events before they will begin firing\nkeypress.enableMouse(process.stdout);\n\nprocess.stdin.on('mousepress', function (info) {\n console.log('got \"mousepress\" event at %d x %d', info.x, info.y);\n});\n\nprocess.on('exit', function () {\n // disable mouse on exit, so that the state\n // is back to normal for the terminal\n keypress.disableMouse(process.stdout);\n});\n```\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/TooTallNate/keypress/issues"
+ },
+ "_id": "keypress@0.1.0",
+ "dist": {
+ "shasum": "e8916304351a97625960bd8d5b823fe1d9fb872f"
+ },
+ "_from": "keypress@0.1.x",
+ "_resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz"
+}
diff --git a/node_modules/express/node_modules/commander/node_modules/keypress/test.js b/node_modules/express/node_modules/commander/node_modules/keypress/test.js
new file mode 100644
index 0000000..c3f61d7
--- /dev/null
+++ b/node_modules/express/node_modules/commander/node_modules/keypress/test.js
@@ -0,0 +1,28 @@
+
+var keypress = require('./')
+keypress(process.stdin)
+
+if (process.stdin.setRawMode)
+ process.stdin.setRawMode(true)
+else
+ require('tty').setRawMode(true)
+
+process.stdin.on('keypress', function (c, key) {
+ console.log(0, c, key)
+ if (key && key.ctrl && key.name == 'c') {
+ process.stdin.pause()
+ }
+})
+process.stdin.on('mousepress', function (mouse) {
+ console.log(mouse)
+})
+
+keypress.enableMouse(process.stdout)
+process.on('exit', function () {
+ //disable mouse on exit, so that the state is back to normal
+ //for the terminal.
+ keypress.disableMouse(process.stdout)
+})
+
+process.stdin.resume()
+
diff --git a/node_modules/express/node_modules/commander/package.json b/node_modules/express/node_modules/commander/package.json
new file mode 100644
index 0000000..b9ec316
--- /dev/null
+++ b/node_modules/express/node_modules/commander/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "commander",
+ "version": "1.2.0",
+ "description": "the complete solution for node.js command-line programs",
+ "keywords": [
+ "command",
+ "option",
+ "parser",
+ "prompt",
+ "stdin"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/visionmedia/commander.js.git"
+ },
+ "dependencies": {
+ "keypress": "0.1.x"
+ },
+ "devDependencies": {
+ "should": ">= 0.0.1"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.6.x"
+ },
+ "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese <type> Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] <file ...>')\n .option('-i, --integer <n>', 'An integer argument', parseInt)\n .option('-f, --float <n>', 'A float argument', parseFloat)\n .option('-r, --range <a>..<b>', 'A range', range)\n .option('-l, --list <items>', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n```js\nprogram.prompt('Email: ', /^.+@.+\\..+$/, function(email){\n console.log('email: %j', email);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## .outputHelp()\n\n Output help information without exiting.\n\n## .help()\n\n Output help information and exit immediately.\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/commander.js/issues"
+ },
+ "_id": "commander@1.2.0",
+ "dist": {
+ "shasum": "30b2271036cbabce7e2e65ce376353abe46ffb66"
+ },
+ "_from": "commander@1.2.0",
+ "_resolved": "https://registry.npmjs.org/commander/-/commander-1.2.0.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/.npmignore b/node_modules/express/node_modules/connect/.npmignore
new file mode 100644
index 0000000..9046dde
--- /dev/null
+++ b/node_modules/express/node_modules/connect/.npmignore
@@ -0,0 +1,12 @@
+*.markdown
+*.md
+.git*
+Makefile
+benchmarks/
+docs/
+examples/
+install.sh
+support/
+test/
+.DS_Store
+coverage.html
diff --git a/node_modules/express/node_modules/connect/.travis.yml b/node_modules/express/node_modules/connect/.travis.yml
new file mode 100644
index 0000000..a12e3f0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.8"
+ - "0.10" \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/LICENSE b/node_modules/express/node_modules/connect/LICENSE
new file mode 100644
index 0000000..0c5d22d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/LICENSE
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2010 Sencha Inc.
+Copyright (c) 2011 LearnBoost
+Copyright (c) 2011 TJ Holowaychuk
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/Readme.md b/node_modules/express/node_modules/connect/Readme.md
new file mode 100644
index 0000000..7d65f9c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/Readme.md
@@ -0,0 +1,133 @@
+[![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect)
+# Connect
+
+ Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
+
+ Connect is bundled with over _20_ commonly used middleware, including
+ a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/).
+
+```js
+var connect = require('connect')
+ , http = require('http');
+
+var app = connect()
+ .use(connect.favicon())
+ .use(connect.logger('dev'))
+ .use(connect.static('public'))
+ .use(connect.directory('public'))
+ .use(connect.cookieParser())
+ .use(connect.session({ secret: 'my secret here' }))
+ .use(function(req, res){
+ res.end('Hello from Connect!\n');
+ });
+
+http.createServer(app).listen(3000);
+```
+
+## Middleware
+
+ - [csrf](http://www.senchalabs.org/connect/csrf.html)
+ - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
+ - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)
+ - [json](http://www.senchalabs.org/connect/json.html)
+ - [multipart](http://www.senchalabs.org/connect/multipart.html)
+ - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)
+ - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)
+ - [directory](http://www.senchalabs.org/connect/directory.html)
+ - [compress](http://www.senchalabs.org/connect/compress.html)
+ - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
+ - [favicon](http://www.senchalabs.org/connect/favicon.html)
+ - [limit](http://www.senchalabs.org/connect/limit.html)
+ - [logger](http://www.senchalabs.org/connect/logger.html)
+ - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)
+ - [query](http://www.senchalabs.org/connect/query.html)
+ - [responseTime](http://www.senchalabs.org/connect/responseTime.html)
+ - [session](http://www.senchalabs.org/connect/session.html)
+ - [static](http://www.senchalabs.org/connect/static.html)
+ - [staticCache](http://www.senchalabs.org/connect/staticCache.html)
+ - [vhost](http://www.senchalabs.org/connect/vhost.html)
+ - [subdomains](http://www.senchalabs.org/connect/subdomains.html)
+ - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
+
+## Running Tests
+
+first:
+
+ $ npm install -d
+
+then:
+
+ $ make test
+
+## Authors
+
+ Below is the output from [git-summary](http://github.com/visionmedia/git-extras).
+
+
+ project: connect
+ commits: 2033
+ active : 301 days
+ files : 171
+ authors:
+ 1414 Tj Holowaychuk 69.6%
+ 298 visionmedia 14.7%
+ 191 Tim Caswell 9.4%
+ 51 TJ Holowaychuk 2.5%
+ 10 Ryan Olds 0.5%
+ 8 Astro 0.4%
+ 5 Nathan Rajlich 0.2%
+ 5 Jakub Nešetřil 0.2%
+ 3 Daniel Dickison 0.1%
+ 3 David Rio Deiros 0.1%
+ 3 Alexander Simmerl 0.1%
+ 3 Andreas Lind Petersen 0.1%
+ 2 Aaron Heckmann 0.1%
+ 2 Jacques Crocker 0.1%
+ 2 Fabian Jakobs 0.1%
+ 2 Brian J Brennan 0.1%
+ 2 Adam Malcontenti-Wilson 0.1%
+ 2 Glen Mailer 0.1%
+ 2 James Campos 0.1%
+ 1 Trent Mick 0.0%
+ 1 Troy Kruthoff 0.0%
+ 1 Wei Zhu 0.0%
+ 1 comerc 0.0%
+ 1 darobin 0.0%
+ 1 nateps 0.0%
+ 1 Marco Sanson 0.0%
+ 1 Arthur Taylor 0.0%
+ 1 Aseem Kishore 0.0%
+ 1 Bart Teeuwisse 0.0%
+ 1 Cameron Howey 0.0%
+ 1 Chad Weider 0.0%
+ 1 Craig Barnes 0.0%
+ 1 Eran Hammer-Lahav 0.0%
+ 1 Gregory McWhirter 0.0%
+ 1 Guillermo Rauch 0.0%
+ 1 Jae Kwon 0.0%
+ 1 Jakub Nesetril 0.0%
+ 1 Joshua Peek 0.0%
+ 1 Jxck 0.0%
+ 1 AJ ONeal 0.0%
+ 1 Michael Hemesath 0.0%
+ 1 Morten Siebuhr 0.0%
+ 1 Samori Gorse 0.0%
+ 1 Tom Jensen 0.0%
+
+## Node Compatibility
+
+ Connect `< 1.x` is compatible with node 0.2.x
+
+
+ Connect `1.x` is compatible with node 0.4.x
+
+
+ Connect (_master_) `2.x` is compatible with node 0.6.x
+
+## CLA
+
+ [http://sencha.com/cla](http://sencha.com/cla)
+
+## License
+
+View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).
diff --git a/node_modules/express/node_modules/connect/index.js b/node_modules/express/node_modules/connect/index.js
new file mode 100644
index 0000000..23240ee
--- /dev/null
+++ b/node_modules/express/node_modules/connect/index.js
@@ -0,0 +1,4 @@
+
+module.exports = process.env.CONNECT_COV
+ ? require('./lib-cov/connect')
+ : require('./lib/connect'); \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/cache.js b/node_modules/express/node_modules/connect/lib/cache.js
new file mode 100644
index 0000000..052fcdb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/cache.js
@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - Cache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Expose `Cache`.
+ */
+
+module.exports = Cache;
+
+/**
+ * LRU cache store.
+ *
+ * @param {Number} limit
+ * @api private
+ */
+
+function Cache(limit) {
+ this.store = {};
+ this.keys = [];
+ this.limit = limit;
+}
+
+/**
+ * Touch `key`, promoting the object.
+ *
+ * @param {String} key
+ * @param {Number} i
+ * @api private
+ */
+
+Cache.prototype.touch = function(key, i){
+ this.keys.splice(i,1);
+ this.keys.push(key);
+};
+
+/**
+ * Remove `key`.
+ *
+ * @param {String} key
+ * @api private
+ */
+
+Cache.prototype.remove = function(key){
+ delete this.store[key];
+};
+
+/**
+ * Get the object stored for `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.get = function(key){
+ return this.store[key];
+};
+
+/**
+ * Add a cache `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.add = function(key){
+ // initialize store
+ var len = this.keys.push(key);
+
+ // limit reached, invalidate LRU
+ if (len > this.limit) this.remove(this.keys.shift());
+
+ var arr = this.store[key] = [];
+ arr.createdAt = new Date;
+ return arr;
+};
diff --git a/node_modules/express/node_modules/connect/lib/connect.js b/node_modules/express/node_modules/connect/lib/connect.js
new file mode 100644
index 0000000..72961dc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/connect.js
@@ -0,0 +1,92 @@
+/*!
+ * Connect
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , proto = require('./proto')
+ , utils = require('./utils')
+ , path = require('path')
+ , basename = path.basename
+ , fs = require('fs');
+
+// node patches
+
+require('./patch');
+
+// expose createServer() as the module
+
+exports = module.exports = createServer;
+
+/**
+ * Framework version.
+ */
+
+exports.version = '2.7.11';
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = require('./middleware/static').mime;
+
+/**
+ * Expose the prototype.
+ */
+
+exports.proto = proto;
+
+/**
+ * Auto-load middleware getters.
+ */
+
+exports.middleware = {};
+
+/**
+ * Expose utilities.
+ */
+
+exports.utils = utils;
+
+/**
+ * Create a new connect server.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createServer() {
+ function app(req, res, next){ app.handle(req, res, next); }
+ utils.merge(app, proto);
+ utils.merge(app, EventEmitter.prototype);
+ app.route = '/';
+ app.stack = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ app.use(arguments[i]);
+ }
+ return app;
+};
+
+/**
+ * Support old `.createServer()` method.
+ */
+
+createServer.createServer = createServer;
+
+/**
+ * Auto-load bundled middleware with getters.
+ */
+
+fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
+ if (!/\.js$/.test(filename)) return;
+ var name = basename(filename, '.js');
+ function load(){ return require('./middleware/' + name); }
+ exports.middleware.__defineGetter__(name, load);
+ exports.__defineGetter__(name, load);
+});
diff --git a/node_modules/express/node_modules/connect/lib/index.js b/node_modules/express/node_modules/connect/lib/index.js
new file mode 100644
index 0000000..2618ddc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/index.js
@@ -0,0 +1,50 @@
+
+/**
+ * Connect is a middleware framework for node,
+ * shipping with over 18 bundled middleware and a rich selection of
+ * 3rd-party middleware.
+ *
+ * var app = connect()
+ * .use(connect.logger('dev'))
+ * .use(connect.static('public'))
+ * .use(function(req, res){
+ * res.end('hello world\n');
+ * })
+ * .listen(3000);
+ *
+ * Installation:
+ *
+ * $ npm install connect
+ *
+ * Middleware:
+ *
+ * - [logger](logger.html) request logger with custom format support
+ * - [csrf](csrf.html) Cross-site request forgery protection
+ * - [compress](compress.html) Gzip compression middleware
+ * - [basicAuth](basicAuth.html) basic http authentication
+ * - [bodyParser](bodyParser.html) extensible request body parser
+ * - [json](json.html) application/json parser
+ * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser
+ * - [multipart](multipart.html) multipart/form-data parser
+ * - [timeout](timeout.html) request timeouts
+ * - [cookieParser](cookieParser.html) cookie parser
+ * - [session](session.html) session management support with bundled MemoryStore
+ * - [cookieSession](cookieSession.html) cookie-based session support
+ * - [methodOverride](methodOverride.html) faux HTTP method support
+ * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time
+ * - [staticCache](staticCache.html) memory cache layer for the static() middleware
+ * - [static](static.html) streaming static file server supporting `Range` and more
+ * - [directory](directory.html) directory listing middleware
+ * - [vhost](vhost.html) virtual host sub-domain mapping middleware
+ * - [favicon](favicon.html) efficient favicon server (with default icon)
+ * - [limit](limit.html) limit the bytesize of request bodies
+ * - [query](query.html) automatic querystring parser, populating `req.query`
+ * - [errorHandler](errorHandler.html) flexible error handler
+ *
+ * Links:
+ *
+ * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware
+ * - GitHub [repository](http://github.com/senchalabs/connect)
+ * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md)
+ *
+ */ \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js b/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
new file mode 100644
index 0000000..bc7ec97
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
@@ -0,0 +1,103 @@
+
+/*!
+ * Connect - basicAuth
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , unauthorized = utils.unauthorized;
+
+/**
+ * Basic Auth:
+ *
+ * Enfore basic authentication by providing a `callback(user, pass)`,
+ * which must return `true` in order to gain access. Alternatively an async
+ * method is provided as well, invoking `callback(user, pass, callback)`. Populates
+ * `req.user`. The final alternative is simply passing username / password
+ * strings.
+ *
+ * Simple username and password
+ *
+ * connect(connect.basicAuth('username', 'password'));
+ *
+ * Callback verification
+ *
+ * connect()
+ * .use(connect.basicAuth(function(user, pass){
+ * return 'tj' == user & 'wahoo' == pass;
+ * }))
+ *
+ * Async callback verification, accepting `fn(err, user)`.
+ *
+ * connect()
+ * .use(connect.basicAuth(function(user, pass, fn){
+ * User.authenticate({ user: user, pass: pass }, fn);
+ * }))
+ *
+ * @param {Function|String} callback or username
+ * @param {String} realm
+ * @api public
+ */
+
+module.exports = function basicAuth(callback, realm) {
+ var username, password;
+
+ // user / pass strings
+ if ('string' == typeof callback) {
+ username = callback;
+ password = realm;
+ if ('string' != typeof password) throw new Error('password argument required');
+ realm = arguments[2];
+ callback = function(user, pass){
+ return user == username && pass == password;
+ }
+ }
+
+ realm = realm || 'Authorization Required';
+
+ return function(req, res, next) {
+ var authorization = req.headers.authorization;
+
+ if (req.user) return next();
+ if (!authorization) return unauthorized(res, realm);
+
+ var parts = authorization.split(' ');
+
+ if (parts.length !== 2) return next(utils.error(400));
+
+ var scheme = parts[0]
+ , credentials = new Buffer(parts[1], 'base64').toString()
+ , index = credentials.indexOf(':');
+
+ if ('Basic' != scheme || index < 0) return next(utils.error(400));
+
+ var user = credentials.slice(0, index)
+ , pass = credentials.slice(index + 1);
+
+ // async
+ if (callback.length >= 3) {
+ var pause = utils.pause(req);
+ callback(user, pass, function(err, user){
+ if (err || !user) return unauthorized(res, realm);
+ req.user = req.remoteUser = user;
+ next();
+ pause.resume();
+ });
+ // sync
+ } else {
+ if (callback(user, pass)) {
+ req.user = req.remoteUser = user;
+ next();
+ } else {
+ unauthorized(res, realm);
+ }
+ }
+ }
+};
+
diff --git a/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js b/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
new file mode 100644
index 0000000..9f692cd
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
@@ -0,0 +1,61 @@
+
+/*!
+ * Connect - bodyParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var multipart = require('./multipart')
+ , urlencoded = require('./urlencoded')
+ , json = require('./json');
+
+/**
+ * Body parser:
+ *
+ * Parse request bodies, supports _application/json_,
+ * _application/x-www-form-urlencoded_, and _multipart/form-data_.
+ *
+ * This is equivalent to:
+ *
+ * app.use(connect.json());
+ * app.use(connect.urlencoded());
+ * app.use(connect.multipart());
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.bodyParser())
+ * .use(function(req, res) {
+ * res.end('viewing user ' + req.body.user.name);
+ * });
+ *
+ * $ curl -d 'user[name]=tj' http://local/
+ * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
+ *
+ * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function bodyParser(options){
+ var _urlencoded = urlencoded(options)
+ , _multipart = multipart(options)
+ , _json = json(options);
+
+ return function bodyParser(req, res, next) {
+ _json(req, res, function(err){
+ if (err) return next(err);
+ _urlencoded(req, res, function(err){
+ if (err) return next(err);
+ _multipart(req, res, next);
+ });
+ });
+ }
+}; \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/middleware/compress.js b/node_modules/express/node_modules/connect/lib/middleware/compress.js
new file mode 100644
index 0000000..db60af5
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/compress.js
@@ -0,0 +1,189 @@
+/*!
+ * Connect - compress
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var zlib = require('zlib');
+var utils = require('../utils');
+
+/**
+ * Supported content-encoding methods.
+ */
+
+exports.methods = {
+ gzip: zlib.createGzip
+ , deflate: zlib.createDeflate
+};
+
+/**
+ * Default filter function.
+ */
+
+exports.filter = function(req, res){
+ return /json|text|javascript/.test(res.getHeader('Content-Type'));
+};
+
+/**
+ * Compress:
+ *
+ * Compress response data with gzip/deflate.
+ *
+ * Filter:
+ *
+ * A `filter` callback function may be passed to
+ * replace the default logic of:
+ *
+ * exports.filter = function(req, res){
+ * return /json|text|javascript/.test(res.getHeader('Content-Type'));
+ * };
+ *
+ * Threshold:
+ *
+ * Only compress the response if the byte size is at or above a threshold.
+ * Always compress while streaming.
+ *
+ * - `threshold` - string representation of size or bytes as an integer.
+ *
+ * Options:
+ *
+ * All remaining options are passed to the gzip/deflate
+ * creation functions. Consult node's docs for additional details.
+ *
+ * - `chunkSize` (default: 16*1024)
+ * - `windowBits`
+ * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression
+ * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more
+ * - `strategy`: compression strategy
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function compress(options) {
+ options = options || {};
+ var names = Object.keys(exports.methods)
+ , filter = options.filter || exports.filter
+ , threshold;
+
+ if (false === options.threshold || 0 === options.threshold) {
+ threshold = 0
+ } else if ('string' === typeof options.threshold) {
+ threshold = utils.parseBytes(options.threshold)
+ } else {
+ threshold = options.threshold || 1024
+ }
+
+ return function compress(req, res, next){
+ var accept = req.headers['accept-encoding']
+ , vary = res.getHeader('Vary')
+ , write = res.write
+ , end = res.end
+ , compress = true
+ , stream
+ , method;
+
+ // vary
+ if (!vary) {
+ res.setHeader('Vary', 'Accept-Encoding');
+ } else if (!~vary.indexOf('Accept-Encoding')) {
+ res.setHeader('Vary', vary + ', Accept-Encoding');
+ }
+
+ // see #724
+ req.on('close', function(){
+ res.write = res.end = function(){};
+ });
+
+ // proxy
+
+ res.write = function(chunk, encoding){
+ if (!this.headerSent) this._implicitHeader();
+ return stream
+ ? stream.write(new Buffer(chunk, encoding))
+ : write.call(res, chunk, encoding);
+ };
+
+ res.end = function(chunk, encoding){
+ if (chunk) {
+ if (!this.headerSent && getSize(chunk) < threshold) compress = false;
+ this.write(chunk, encoding);
+ } else if (!this.headerSent) {
+ // response size === 0
+ compress = false;
+ }
+ return stream
+ ? stream.end()
+ : end.call(res);
+ };
+
+ res.on('header', function(){
+ if (!compress) return;
+
+ var encoding = res.getHeader('Content-Encoding') || 'identity';
+
+ // already encoded
+ if ('identity' != encoding) return;
+
+ // default request filter
+ if (!filter(req, res)) return;
+
+ // SHOULD use identity
+ if (!accept) return;
+
+ // head
+ if ('HEAD' == req.method) return;
+
+ // default to gzip
+ if ('*' == accept.trim()) method = 'gzip';
+
+ // compression method
+ if (!method) {
+ for (var i = 0, len = names.length; i < len; ++i) {
+ if (~accept.indexOf(names[i])) {
+ method = names[i];
+ break;
+ }
+ }
+ }
+
+ // compression method
+ if (!method) return;
+
+ // compression stream
+ stream = exports.methods[method](options);
+
+ // header fields
+ res.setHeader('Content-Encoding', method);
+ res.removeHeader('Content-Length');
+
+ // compression
+
+ stream.on('data', function(chunk){
+ write.call(res, chunk);
+ });
+
+ stream.on('end', function(){
+ end.call(res);
+ });
+
+ stream.on('drain', function() {
+ res.emit('drain');
+ });
+ });
+
+ next();
+ };
+};
+
+function getSize(chunk) {
+ return Buffer.isBuffer(chunk)
+ ? chunk.length
+ : Buffer.byteLength(chunk);
+} \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
new file mode 100644
index 0000000..5da23f2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
@@ -0,0 +1,62 @@
+
+/*!
+ * Connect - cookieParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+ , cookie = require('cookie');
+
+/**
+ * Cookie parser:
+ *
+ * Parse _Cookie_ header and populate `req.cookies`
+ * with an object keyed by the cookie names. Optionally
+ * you may enabled signed cookie support by passing
+ * a `secret` string, which assigns `req.secret` so
+ * it may be used by other middleware.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.cookieParser('optional secret string'))
+ * .use(function(req, res, next){
+ * res.end(JSON.stringify(req.cookies));
+ * })
+ *
+ * @param {String} secret
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieParser(secret){
+ return function cookieParser(req, res, next) {
+ if (req.cookies) return next();
+ var cookies = req.headers.cookie;
+
+ req.secret = secret;
+ req.cookies = {};
+ req.signedCookies = {};
+
+ if (cookies) {
+ try {
+ req.cookies = cookie.parse(cookies);
+ if (secret) {
+ req.signedCookies = utils.parseSignedCookies(req.cookies, secret);
+ req.signedCookies = utils.parseJSONCookies(req.signedCookies);
+ }
+ req.cookies = utils.parseJSONCookies(req.cookies);
+ } catch (err) {
+ err.status = 400;
+ return next(err);
+ }
+ }
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js b/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js
new file mode 100644
index 0000000..21011b8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js
@@ -0,0 +1,115 @@
+/*!
+ * Connect - cookieSession
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+ , Cookie = require('./session/cookie')
+ , debug = require('debug')('connect:cookieSession')
+ , signature = require('cookie-signature')
+ , crc32 = require('buffer-crc32');
+
+/**
+ * Cookie Session:
+ *
+ * Cookie session middleware.
+ *
+ * var app = connect();
+ * app.use(connect.cookieParser());
+ * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));
+ *
+ * Options:
+ *
+ * - `key` cookie name defaulting to `connect.sess`
+ * - `secret` prevents cookie tampering
+ * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Clearing sessions:
+ *
+ * To clear the session simply set its value to `null`,
+ * `cookieSession()` will then respond with a 1970 Set-Cookie.
+ *
+ * req.session = null;
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieSession(options){
+ // TODO: utilize Session/Cookie to unify API
+ options = options || {};
+ var key = options.key || 'connect.sess'
+ , trustProxy = options.proxy;
+
+ return function cookieSession(req, res, next) {
+
+ // req.secret is for backwards compatibility
+ var secret = options.secret || req.secret;
+ if (!secret) throw new Error('`secret` option required for cookie sessions');
+
+ // default session
+ req.session = {};
+ var cookie = req.session.cookie = new Cookie(options.cookie);
+
+ // pathname mismatch
+ if (0 != req.originalUrl.indexOf(cookie.path)) return next();
+
+ // cookieParser secret
+ if (!options.secret && req.secret) {
+ req.session = req.signedCookies[key] || {};
+ req.session.cookie = cookie;
+ } else {
+ // TODO: refactor
+ var rawCookie = req.cookies[key];
+ if (rawCookie) {
+ var unsigned = utils.parseSignedCookie(rawCookie, secret);
+ if (unsigned) {
+ var originalHash = crc32.signed(unsigned);
+ req.session = utils.parseJSONCookie(unsigned) || {};
+ req.session.cookie = cookie;
+ }
+ }
+ }
+
+ res.on('header', function(){
+ // removed
+ if (!req.session) {
+ debug('clear session');
+ cookie.expires = new Date(0);
+ res.setHeader('Set-Cookie', cookie.serialize(key, ''));
+ return;
+ }
+
+ delete req.session.cookie;
+
+ // check security
+ var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
+ , tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0]);
+
+ // only send secure cookies via https
+ if (cookie.secure && !tls) return debug('not secured');
+
+ // serialize
+ debug('serializing %j', req.session);
+ var val = 'j:' + JSON.stringify(req.session);
+
+ // compare hashes, no need to set-cookie if unchanged
+ if (originalHash == crc32.signed(val)) return debug('unmodified session');
+
+ // set-cookie
+ val = 's:' + signature.sign(val, secret);
+ val = cookie.serialize(key, val);
+ debug('set-cookie %j', cookie);
+ res.setHeader('Set-Cookie', val);
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/csrf.js b/node_modules/express/node_modules/connect/lib/middleware/csrf.js
new file mode 100644
index 0000000..a815444
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/csrf.js
@@ -0,0 +1,75 @@
+/*!
+ * Connect - csrf
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+var uid = require('uid2');
+
+/**
+ * Anti CSRF:
+ *
+ * CRSF protection middleware.
+ *
+ * By default this middleware generates a token named "_csrf"
+ * which should be added to requests which mutate
+ * state, within a hidden form field, query-string etc. This
+ * token is validated against the visitor's `req.session._csrf`
+ * property.
+ *
+ * The default `value` function checks `req.body` generated
+ * by the `bodyParser()` middleware, `req.query` generated
+ * by `query()`, and the "X-CSRF-Token" header field.
+ *
+ * This middleware requires session support, thus should be added
+ * somewhere _below_ `session()` and `cookieParser()`.
+ *
+ * Options:
+ *
+ * - `value` a function accepting the request, returning the token
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+module.exports = function csrf(options) {
+ options = options || {};
+ var value = options.value || defaultValue;
+
+ return function(req, res, next){
+ // generate CSRF token
+ var token = req.session._csrf || (req.session._csrf = uid(24));
+
+ // ignore these methods
+ if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();
+
+ // determine value
+ var val = value(req);
+
+ // check
+ if (val != token) return next(utils.error(403));
+
+ next();
+ }
+};
+
+/**
+ * Default value function, checking the `req.body`
+ * and `req.query` for the CSRF token.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+function defaultValue(req) {
+ return (req.body && req.body._csrf)
+ || (req.query && req.query._csrf)
+ || (req.headers['x-csrf-token'])
+ || (req.headers['x-xsrf-token']);
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/directory.js b/node_modules/express/node_modules/connect/lib/middleware/directory.js
new file mode 100644
index 0000000..1c925a7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/directory.js
@@ -0,0 +1,229 @@
+
+/*!
+ * Connect - directory
+ * Copyright(c) 2011 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+// TODO: icon / style for directories
+// TODO: arrow key navigation
+// TODO: make icons extensible
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+ , parse = require('url').parse
+ , utils = require('../utils')
+ , path = require('path')
+ , normalize = path.normalize
+ , extname = path.extname
+ , join = path.join;
+
+/*!
+ * Icon cache.
+ */
+
+var cache = {};
+
+/**
+ * Directory:
+ *
+ * Serve directory listings with the given `root` path.
+ *
+ * Options:
+ *
+ * - `hidden` display hidden (dot) files. Defaults to false.
+ * - `icons` display icons. Defaults to false.
+ * - `filter` Apply this filter function to files. Defaults to false.
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function directory(root, options){
+ options = options || {};
+
+ // root required
+ if (!root) throw new Error('directory() root path required');
+ var hidden = options.hidden
+ , icons = options.icons
+ , filter = options.filter
+ , root = normalize(root);
+
+ return function directory(req, res, next) {
+ if ('GET' != req.method && 'HEAD' != req.method) return next();
+
+ var accept = req.headers.accept || 'text/plain'
+ , url = parse(req.url)
+ , dir = decodeURIComponent(url.pathname)
+ , path = normalize(join(root, dir))
+ , originalUrl = parse(req.originalUrl)
+ , originalDir = decodeURIComponent(originalUrl.pathname)
+ , showUp = path != root && path != root + '/';
+
+ // null byte(s), bad request
+ if (~path.indexOf('\0')) return next(utils.error(400));
+
+ // malicious path, forbidden
+ if (0 != path.indexOf(root)) return next(utils.error(403));
+
+ // check if we have a directory
+ fs.stat(path, function(err, stat){
+ if (err) return 'ENOENT' == err.code
+ ? next()
+ : next(err);
+
+ if (!stat.isDirectory()) return next();
+
+ // fetch files
+ fs.readdir(path, function(err, files){
+ if (err) return next(err);
+ if (!hidden) files = removeHidden(files);
+ if (filter) files = files.filter(filter);
+ files.sort();
+
+ // content-negotiation
+ for (var key in exports) {
+ if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {
+ exports[key](req, res, files, next, originalDir, showUp, icons);
+ return;
+ }
+ }
+
+ // not acceptable
+ next(utils.error(406));
+ });
+ });
+ };
+};
+
+/**
+ * Respond with text/html.
+ */
+
+exports.html = function(req, res, files, next, dir, showUp, icons){
+ fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){
+ if (err) return next(err);
+ fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){
+ if (err) return next(err);
+ if (showUp) files.unshift('..');
+ str = str
+ .replace('{style}', style)
+ .replace('{files}', html(files, dir, icons))
+ .replace('{directory}', dir)
+ .replace('{linked-path}', htmlPath(dir));
+ res.setHeader('Content-Type', 'text/html');
+ res.setHeader('Content-Length', str.length);
+ res.end(str);
+ });
+ });
+};
+
+/**
+ * Respond with application/json.
+ */
+
+exports.json = function(req, res, files){
+ files = JSON.stringify(files);
+ res.setHeader('Content-Type', 'application/json');
+ res.setHeader('Content-Length', files.length);
+ res.end(files);
+};
+
+/**
+ * Respond with text/plain.
+ */
+
+exports.plain = function(req, res, files){
+ files = files.join('\n') + '\n';
+ res.setHeader('Content-Type', 'text/plain');
+ res.setHeader('Content-Length', files.length);
+ res.end(files);
+};
+
+/**
+ * Map html `dir`, returning a linked path.
+ */
+
+function htmlPath(dir) {
+ var curr = [];
+ return dir.split('/').map(function(part){
+ curr.push(part);
+ return '<a href="' + curr.join('/') + '">' + part + '</a>';
+ }).join(' / ');
+}
+
+/**
+ * Map html `files`, returning an html unordered list.
+ */
+
+function html(files, dir, useIcons) {
+ return '<ul id="files">' + files.map(function(file){
+ var icon = ''
+ , classes = [];
+
+ if (useIcons && '..' != file) {
+ icon = icons[extname(file)] || icons.default;
+ icon = '<img src="data:image/png;base64,' + load(icon) + '" />';
+ classes.push('icon');
+ }
+
+ return '<li><a href="'
+ + join(dir, file)
+ + '" class="'
+ + classes.join(' ') + '"'
+ + ' title="' + file + '">'
+ + icon + file + '</a></li>';
+
+ }).join('\n') + '</ul>';
+}
+
+/**
+ * Load and cache the given `icon`.
+ *
+ * @param {String} icon
+ * @return {String}
+ * @api private
+ */
+
+function load(icon) {
+ if (cache[icon]) return cache[icon];
+ return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
+}
+
+/**
+ * Filter "hidden" `files`, aka files
+ * beginning with a `.`.
+ *
+ * @param {Array} files
+ * @return {Array}
+ * @api private
+ */
+
+function removeHidden(files) {
+ return files.filter(function(file){
+ return '.' != file[0];
+ });
+}
+
+/**
+ * Icon map.
+ */
+
+var icons = {
+ '.js': 'page_white_code_red.png'
+ , '.c': 'page_white_c.png'
+ , '.h': 'page_white_h.png'
+ , '.cc': 'page_white_cplusplus.png'
+ , '.php': 'page_white_php.png'
+ , '.rb': 'page_white_ruby.png'
+ , '.cpp': 'page_white_cplusplus.png'
+ , '.swf': 'page_white_flash.png'
+ , '.pdf': 'page_white_acrobat.png'
+ , 'default': 'page_white.png'
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
new file mode 100644
index 0000000..4a84edc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
@@ -0,0 +1,86 @@
+/*!
+ * Connect - errorHandler
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , fs = require('fs');
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Error handler:
+ *
+ * Development error handler, providing stack traces
+ * and error message responses for requests accepting text, html,
+ * or json.
+ *
+ * Text:
+ *
+ * By default, and when _text/plain_ is accepted a simple stack trace
+ * or error message will be returned.
+ *
+ * JSON:
+ *
+ * When _application/json_ is accepted, connect will respond with
+ * an object in the form of `{ "error": error }`.
+ *
+ * HTML:
+ *
+ * When accepted connect will output a nice html stack trace.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function errorHandler(){
+ return function errorHandler(err, req, res, next){
+ if (err.status) res.statusCode = err.status;
+ if (res.statusCode < 400) res.statusCode = 500;
+ if ('test' != env) console.error(err.stack);
+ var accept = req.headers.accept || '';
+ // html
+ if (~accept.indexOf('html')) {
+ fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
+ fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
+ var stack = (err.stack || '')
+ .split('\n').slice(1)
+ .map(function(v){ return '<li>' + v + '</li>'; }).join('');
+ html = html
+ .replace('{style}', style)
+ .replace('{stack}', stack)
+ .replace('{title}', exports.title)
+ .replace('{statusCode}', res.statusCode)
+ .replace(/\{error\}/g, utils.escape(err.toString()));
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
+ res.end(html);
+ });
+ });
+ // json
+ } else if (~accept.indexOf('json')) {
+ var error = { message: err.message, stack: err.stack };
+ for (var prop in err) error[prop] = err[prop];
+ var json = JSON.stringify({ error: error });
+ res.setHeader('Content-Type', 'application/json');
+ res.end(json);
+ // plain text
+ } else {
+ res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
+ res.end(err.stack);
+ }
+ };
+};
+
+/**
+ * Template title, framework authors may override this value.
+ */
+
+exports.title = 'Connect';
diff --git a/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/node_modules/express/node_modules/connect/lib/middleware/favicon.js
new file mode 100644
index 0000000..ef54354
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/favicon.js
@@ -0,0 +1,80 @@
+/*!
+ * Connect - favicon
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+ , utils = require('../utils');
+
+/**
+ * Favicon:
+ *
+ * By default serves the connect favicon, or the favicon
+ * located by the given `path`.
+ *
+ * Options:
+ *
+ * - `maxAge` cache-control max-age directive, defaulting to 1 day
+ *
+ * Examples:
+ *
+ * Serve default favicon:
+ *
+ * connect()
+ * .use(connect.favicon())
+ *
+ * Serve favicon before logging for brevity:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.logger('dev'))
+ *
+ * Serve custom favicon:
+ *
+ * connect()
+ * .use(connect.favicon('public/favicon.ico'))
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function favicon(path, options){
+ var options = options || {}
+ , path = path || __dirname + '/../public/favicon.ico'
+ , maxAge = options.maxAge || 86400000
+ , icon; // favicon cache
+
+ return function favicon(req, res, next){
+ if ('/favicon.ico' == req.url) {
+ if (icon) {
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ } else {
+ fs.readFile(path, function(err, buf){
+ if (err) return next(err);
+ icon = {
+ headers: {
+ 'Content-Type': 'image/x-icon'
+ , 'Content-Length': buf.length
+ , 'ETag': '"' + utils.md5(buf) + '"'
+ , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)
+ },
+ body: buf
+ };
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ });
+ }
+ } else {
+ next();
+ }
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/json.js b/node_modules/express/node_modules/connect/lib/middleware/json.js
new file mode 100644
index 0000000..29878d2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/json.js
@@ -0,0 +1,89 @@
+
+/*!
+ * Connect - json
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , _limit = require('./limit');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * JSON:
+ *
+ * Parse JSON request bodies, providing the
+ * parsed object as `req.body`.
+ *
+ * Options:
+ *
+ * - `strict` when `false` anything `JSON.parse()` accepts will be parsed
+ * - `reviver` used as the second "reviver" argument for JSON.parse
+ * - `limit` byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ var options = options || {}
+ , strict = options.strict !== false;
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function json(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // check Content-Type
+ if (!exports.regexp.test(utils.mime(req))) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+ var buf = '';
+ req.setEncoding('utf8');
+ req.on('data', function(chunk){ buf += chunk });
+ req.on('end', function(){
+ var first = buf.trim()[0];
+
+ if (0 == buf.length) {
+ return next(utils.error(400, 'invalid json, empty body'));
+ }
+
+ if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json'));
+ try {
+ req.body = JSON.parse(buf, options.reviver);
+ } catch (err){
+ err.body = buf;
+ err.status = 400;
+ return next(err);
+ }
+ next();
+ });
+ });
+ };
+};
+
+exports.regexp = /^application\/([\w!#\$%&\*`\-\.\^~]*\+)?json$/i;
+
diff --git a/node_modules/express/node_modules/connect/lib/middleware/limit.js b/node_modules/express/node_modules/connect/lib/middleware/limit.js
new file mode 100644
index 0000000..09bd1c4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/limit.js
@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - limit
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils'),
+ brokenPause = utils.brokenPause;
+
+/**
+ * Limit:
+ *
+ * Limit request bodies to the given size in `bytes`.
+ *
+ * A string representation of the bytesize may also be passed,
+ * for example "5mb", "200kb", "1gb", etc.
+ *
+ * connect()
+ * .use(connect.limit('5.5mb'))
+ * .use(handleImageUpload)
+ *
+ * @param {Number|String} bytes
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function limit(bytes){
+ if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);
+ if ('number' != typeof bytes) throw new Error('limit() bytes required');
+ return function limit(req, res, next){
+ var received = 0
+ , len = req.headers['content-length']
+ ? parseInt(req.headers['content-length'], 10)
+ : null;
+
+ // self-awareness
+ if (req._limit) return next();
+ req._limit = true;
+
+ // limit by content-length
+ if (len && len > bytes) return next(utils.error(413));
+
+ // limit
+ if (brokenPause) {
+ listen();
+ } else {
+ req.on('newListener', function handler(event) {
+ if (event !== 'data') return;
+
+ req.removeListener('newListener', handler);
+ // Start listening at the end of the current loop
+ // otherwise the request will be consumed too early.
+ // Sideaffect is `limit` will miss the first chunk,
+ // but that's not a big deal.
+ // Unfortunately, the tests don't have large enough
+ // request bodies to test this.
+ process.nextTick(listen);
+ });
+ };
+
+ next();
+
+ function listen() {
+ req.on('data', function(chunk) {
+ received += Buffer.isBuffer(chunk)
+ ? chunk.length :
+ Buffer.byteLength(chunk);
+
+ if (received > bytes) req.destroy();
+ });
+ };
+ };
+}; \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/middleware/logger.js b/node_modules/express/node_modules/connect/lib/middleware/logger.js
new file mode 100644
index 0000000..7e88248
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/logger.js
@@ -0,0 +1,339 @@
+/*!
+ * Connect - logger
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var bytes = require('bytes');
+
+/*!
+ * Log buffer.
+ */
+
+var buf = [];
+
+/*!
+ * Default log buffer duration.
+ */
+
+var defaultBufferDuration = 1000;
+
+/**
+ * Logger:
+ *
+ * Log requests with the given `options` or a `format` string.
+ *
+ * Options:
+ *
+ * - `format` Format string, see below for tokens
+ * - `stream` Output stream, defaults to _stdout_
+ * - `buffer` Buffer duration, defaults to 1000ms when _true_
+ * - `immediate` Write log line on request instead of response (for response times)
+ *
+ * Tokens:
+ *
+ * - `:req[header]` ex: `:req[Accept]`
+ * - `:res[header]` ex: `:res[Content-Length]`
+ * - `:http-version`
+ * - `:response-time`
+ * - `:remote-addr`
+ * - `:date`
+ * - `:method`
+ * - `:url`
+ * - `:referrer`
+ * - `:user-agent`
+ * - `:status`
+ *
+ * Formats:
+ *
+ * Pre-defined formats that ship with connect:
+ *
+ * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
+ * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
+ * - `tiny` ':method :url :status :res[content-length] - :response-time ms'
+ * - `dev` concise output colored by response status for development use
+ *
+ * Examples:
+ *
+ * connect.logger() // default
+ * connect.logger('short')
+ * connect.logger('tiny')
+ * connect.logger({ immediate: true, format: 'dev' })
+ * connect.logger(':method :url - :referrer')
+ * connect.logger(':req[content-type] -> :res[content-type]')
+ * connect.logger(function(tokens, req, res){ return 'some format string' })
+ *
+ * Defining Tokens:
+ *
+ * To define a token, simply invoke `connect.logger.token()` with the
+ * name and a callback function. The value returned is then available
+ * as ":type" in this case.
+ *
+ * connect.logger.token('type', function(req, res){ return req.headers['content-type']; })
+ *
+ * Defining Formats:
+ *
+ * All default formats are defined this way, however it's public API as well:
+ *
+ * connect.logger.format('name', 'string or function')
+ *
+ * @param {String|Function|Object} format or options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function logger(options) {
+ if ('object' == typeof options) {
+ options = options || {};
+ } else if (options) {
+ options = { format: options };
+ } else {
+ options = {};
+ }
+
+ // output on request instead of response
+ var immediate = options.immediate;
+
+ // format name
+ var fmt = exports[options.format] || options.format || exports.default;
+
+ // compile format
+ if ('function' != typeof fmt) fmt = compile(fmt);
+
+ // options
+ var stream = options.stream || process.stdout
+ , buffer = options.buffer;
+
+ // buffering support
+ if (buffer) {
+ var realStream = stream
+ , interval = 'number' == typeof buffer
+ ? buffer
+ : defaultBufferDuration;
+
+ // flush interval
+ setInterval(function(){
+ if (buf.length) {
+ realStream.write(buf.join(''));
+ buf.length = 0;
+ }
+ }, interval);
+
+ // swap the stream
+ stream = {
+ write: function(str){
+ buf.push(str);
+ }
+ };
+ }
+
+ return function logger(req, res, next) {
+ req._startTime = new Date;
+
+ // immediate
+ if (immediate) {
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n');
+ // proxy end to output logging
+ } else {
+ var end = res.end;
+ res.end = function(chunk, encoding){
+ res.end = end;
+ res.end(chunk, encoding);
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n');
+ };
+ }
+
+
+ next();
+ };
+};
+
+/**
+ * Compile `fmt` into a function.
+ *
+ * @param {String} fmt
+ * @return {Function}
+ * @api private
+ */
+
+function compile(fmt) {
+ fmt = fmt.replace(/"/g, '\\"');
+ var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
+ return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "';
+ }) + '";'
+ return new Function('tokens, req, res', js);
+};
+
+/**
+ * Define a token function with the given `name`,
+ * and callback `fn(req, res)`.
+ *
+ * @param {String} name
+ * @param {Function} fn
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.token = function(name, fn) {
+ exports[name] = fn;
+ return this;
+};
+
+/**
+ * Define a `fmt` with the given `name`.
+ *
+ * @param {String} name
+ * @param {String|Function} fmt
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.format = function(name, str){
+ exports[name] = str;
+ return this;
+};
+
+/**
+ * Default format.
+ */
+
+exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
+
+/**
+ * Short format.
+ */
+
+exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
+
+/**
+ * Tiny format.
+ */
+
+exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
+
+/**
+ * dev (colored)
+ */
+
+exports.format('dev', function(tokens, req, res){
+ var status = res.statusCode
+ , len = parseInt(res.getHeader('Content-Length'), 10)
+ , color = 32;
+
+ if (status >= 500) color = 31
+ else if (status >= 400) color = 33
+ else if (status >= 300) color = 36;
+
+ len = isNaN(len)
+ ? ''
+ : len = ' - ' + bytes(len);
+
+ return '\x1b[90m' + req.method
+ + ' ' + req.originalUrl + ' '
+ + '\x1b[' + color + 'm' + res.statusCode
+ + ' \x1b[90m'
+ + (new Date - req._startTime)
+ + 'ms' + len
+ + '\x1b[0m';
+});
+
+/**
+ * request url
+ */
+
+exports.token('url', function(req){
+ return req.originalUrl || req.url;
+});
+
+/**
+ * request method
+ */
+
+exports.token('method', function(req){
+ return req.method;
+});
+
+/**
+ * response time in milliseconds
+ */
+
+exports.token('response-time', function(req){
+ return new Date - req._startTime;
+});
+
+/**
+ * UTC date
+ */
+
+exports.token('date', function(){
+ return new Date().toUTCString();
+});
+
+/**
+ * response status code
+ */
+
+exports.token('status', function(req, res){
+ return res.statusCode;
+});
+
+/**
+ * normalized referrer
+ */
+
+exports.token('referrer', function(req){
+ return req.headers['referer'] || req.headers['referrer'];
+});
+
+/**
+ * remote address
+ */
+
+exports.token('remote-addr', function(req){
+ if (req.ip) return req.ip;
+ var sock = req.socket;
+ if (sock.socket) return sock.socket.remoteAddress;
+ return sock.remoteAddress;
+});
+
+/**
+ * HTTP version
+ */
+
+exports.token('http-version', function(req){
+ return req.httpVersionMajor + '.' + req.httpVersionMinor;
+});
+
+/**
+ * UA string
+ */
+
+exports.token('user-agent', function(req){
+ return req.headers['user-agent'];
+});
+
+/**
+ * request header
+ */
+
+exports.token('req', function(req, res, field){
+ return req.headers[field.toLowerCase()];
+});
+
+/**
+ * response header
+ */
+
+exports.token('res', function(req, res, field){
+ return (res._headers || {})[field.toLowerCase()];
+});
+
diff --git a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
new file mode 100644
index 0000000..9ce4939
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
@@ -0,0 +1,59 @@
+
+/*!
+ * Connect - methodOverride
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var methods = require('methods');
+
+/**
+ * Method Override:
+ *
+ * Provides faux HTTP method support.
+ *
+ * Pass an optional `key` to use when checking for
+ * a method override, othewise defaults to _\_method_.
+ * The original method is available via `req.originalMethod`.
+ *
+ * @param {String} key
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function methodOverride(key){
+ key = key || "_method";
+ return function methodOverride(req, res, next) {
+ var method;
+ req.originalMethod = req.originalMethod || req.method;
+
+ // req.body
+ if (req.body && key in req.body) {
+ method = req.body[key].toLowerCase();
+ delete req.body[key];
+ }
+
+ // check X-HTTP-Method-Override
+ if (req.headers['x-http-method-override']) {
+ method = req.headers['x-http-method-override'].toLowerCase();
+ }
+
+ // replace
+ if (supports(method)) req.method = method.toUpperCase();
+
+ next();
+ };
+};
+
+/**
+ * Check if node supports `method`.
+ */
+
+function supports(method) {
+ return ~methods.indexOf(method);
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/node_modules/express/node_modules/connect/lib/middleware/multipart.js
new file mode 100644
index 0000000..7b26fae
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/multipart.js
@@ -0,0 +1,133 @@
+/*!
+ * Connect - multipart
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var formidable = require('formidable')
+ , _limit = require('./limit')
+ , utils = require('../utils')
+ , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * Multipart:
+ *
+ * Parse multipart/form-data request bodies,
+ * providing the parsed object as `req.body`
+ * and `req.files`.
+ *
+ * Configuration:
+ *
+ * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s
+ * `IncomingForm` object, allowing you to configure the upload directory,
+ * size limits, etc. For example if you wish to change the upload dir do the following.
+ *
+ * app.use(connect.multipart({ uploadDir: path }));
+ *
+ * Options:
+ *
+ * - `limit` byte limit defaulting to none
+ * - `defer` defers processing and exposes the Formidable form object as `req.form`.
+ * `next()` is called without waiting for the form's "end" event.
+ * This option is useful if you need to bind to the "progress" event, for example.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ options = options || {};
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function multipart(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+ req.files = req.files || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // ignore GET
+ if ('GET' == req.method || 'HEAD' == req.method) return next();
+
+ // check Content-Type
+ if ('multipart/form-data' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+
+ var form = new formidable.IncomingForm
+ , data = {}
+ , files = {}
+ , done;
+
+ Object.keys(options).forEach(function(key){
+ form[key] = options[key];
+ });
+
+ function ondata(name, val, data){
+ if (Array.isArray(data[name])) {
+ data[name].push(val);
+ } else if (data[name]) {
+ data[name] = [data[name], val];
+ } else {
+ data[name] = val;
+ }
+ }
+
+ form.on('field', function(name, val){
+ ondata(name, val, data);
+ });
+
+ form.on('file', function(name, val){
+ ondata(name, val, files);
+ });
+
+ form.on('error', function(err){
+ if (!options.defer) {
+ err.status = 400;
+ next(err);
+ }
+ done = true;
+ });
+
+ form.on('end', function(){
+ if (done) return;
+ try {
+ req.body = qs.parse(data);
+ req.files = qs.parse(files);
+ if (!options.defer) next();
+ } catch (err) {
+ form.emit('error', err);
+ }
+ });
+
+ form.parse(req);
+
+ if (options.defer) {
+ req.form = form;
+ next();
+ }
+ });
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/query.js b/node_modules/express/node_modules/connect/lib/middleware/query.js
new file mode 100644
index 0000000..93fc5d3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/query.js
@@ -0,0 +1,46 @@
+/*!
+ * Connect - query
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var qs = require('qs')
+ , parse = require('../utils').parseUrl;
+
+/**
+ * Query:
+ *
+ * Automatically parse the query-string when available,
+ * populating the `req.query` object.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.query())
+ * .use(function(req, res){
+ * res.end(JSON.stringify(req.query));
+ * });
+ *
+ * The `options` passed are provided to qs.parse function.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function query(options){
+ return function query(req, res, next){
+ if (!req.query) {
+ req.query = ~req.url.indexOf('?')
+ ? qs.parse(parse(req).query, options)
+ : {};
+ }
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
new file mode 100644
index 0000000..62abc04
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
@@ -0,0 +1,32 @@
+
+/*!
+ * Connect - responseTime
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Reponse time:
+ *
+ * Adds the `X-Response-Time` header displaying the response
+ * duration in milliseconds.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function responseTime(){
+ return function(req, res, next){
+ var start = new Date;
+
+ if (res._responseTime) return next();
+ res._responseTime = true;
+
+ res.on('header', function(){
+ var duration = new Date - start;
+ res.setHeader('X-Response-Time', duration + 'ms');
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session.js b/node_modules/express/node_modules/connect/lib/middleware/session.js
new file mode 100644
index 0000000..a107295
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session.js
@@ -0,0 +1,355 @@
+/*!
+ * Connect - session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Session = require('./session/session')
+ , debug = require('debug')('connect:session')
+ , MemoryStore = require('./session/memory')
+ , signature = require('cookie-signature')
+ , Cookie = require('./session/cookie')
+ , Store = require('./session/store')
+ , utils = require('./../utils')
+ , uid = require('uid2')
+ , parse = utils.parseUrl
+ , crc32 = require('buffer-crc32');
+
+// environment
+
+var env = process.env.NODE_ENV;
+
+/**
+ * Expose the middleware.
+ */
+
+exports = module.exports = session;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Store = Store;
+exports.Cookie = Cookie;
+exports.Session = Session;
+exports.MemoryStore = MemoryStore;
+
+/**
+ * Warning message for `MemoryStore` usage in production.
+ */
+
+var warning = 'Warning: connection.session() MemoryStore is not\n'
+ + 'designed for a production environment, as it will leak\n'
+ + 'memory, and will not scale past a single process.';
+
+/**
+ * Session:
+ *
+ * Setup session store with the given `options`.
+ *
+ * Session data is _not_ saved in the cookie itself, however
+ * cookies are used, so we must use the [cookieParser()](cookieParser.html)
+ * middleware _before_ `session()`.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.cookieParser())
+ * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
+ *
+ * Options:
+ *
+ * - `key` cookie name defaulting to `connect.sid`
+ * - `store` session store instance
+ * - `secret` session cookie is signed with this secret to prevent tampering
+ * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Cookie option:
+ *
+ * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set
+ * so the cookie becomes a browser-session cookie. When the user closes the
+ * browser the cookie (and session) will be removed.
+ *
+ * ## req.session
+ *
+ * To store or access session data, simply use the request property `req.session`,
+ * which is (generally) serialized as JSON by the store, so nested objects
+ * are typically fine. For example below is a user-specific view counter:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.cookieParser())
+ * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
+ * .use(function(req, res, next){
+ * var sess = req.session;
+ * if (sess.views) {
+ * res.setHeader('Content-Type', 'text/html');
+ * res.write('<p>views: ' + sess.views + '</p>');
+ * res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
+ * res.end();
+ * sess.views++;
+ * } else {
+ * sess.views = 1;
+ * res.end('welcome to the session demo. refresh!');
+ * }
+ * }
+ * )).listen(3000);
+ *
+ * ## Session#regenerate()
+ *
+ * To regenerate the session simply invoke the method, once complete
+ * a new SID and `Session` instance will be initialized at `req.session`.
+ *
+ * req.session.regenerate(function(err){
+ * // will have a new session here
+ * });
+ *
+ * ## Session#destroy()
+ *
+ * Destroys the session, removing `req.session`, will be re-generated next request.
+ *
+ * req.session.destroy(function(err){
+ * // cannot access session here
+ * });
+ *
+ * ## Session#reload()
+ *
+ * Reloads the session data.
+ *
+ * req.session.reload(function(err){
+ * // session updated
+ * });
+ *
+ * ## Session#save()
+ *
+ * Save the session.
+ *
+ * req.session.save(function(err){
+ * // session saved
+ * });
+ *
+ * ## Session#touch()
+ *
+ * Updates the `.maxAge` property. Typically this is
+ * not necessary to call, as the session middleware does this for you.
+ *
+ * ## Session#cookie
+ *
+ * Each session has a unique cookie object accompany it. This allows
+ * you to alter the session cookie per visitor. For example we can
+ * set `req.session.cookie.expires` to `false` to enable the cookie
+ * to remain for only the duration of the user-agent.
+ *
+ * ## Session#maxAge
+ *
+ * Alternatively `req.session.cookie.maxAge` will return the time
+ * remaining in milliseconds, which we may also re-assign a new value
+ * to adjust the `.expires` property appropriately. The following
+ * are essentially equivalent
+ *
+ * var hour = 3600000;
+ * req.session.cookie.expires = new Date(Date.now() + hour);
+ * req.session.cookie.maxAge = hour;
+ *
+ * For example when `maxAge` is set to `60000` (one minute), and 30 seconds
+ * has elapsed it will return `30000` until the current request has completed,
+ * at which time `req.session.touch()` is called to reset `req.session.maxAge`
+ * to its original value.
+ *
+ * req.session.cookie.maxAge;
+ * // => 30000
+ *
+ * Session Store Implementation:
+ *
+ * Every session store _must_ implement the following methods
+ *
+ * - `.get(sid, callback)`
+ * - `.set(sid, session, callback)`
+ * - `.destroy(sid, callback)`
+ *
+ * Recommended methods include, but are not limited to:
+ *
+ * - `.length(callback)`
+ * - `.clear(callback)`
+ *
+ * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+function session(options){
+ var options = options || {}
+ , key = options.key || 'connect.sid'
+ , store = options.store || new MemoryStore
+ , cookie = options.cookie || {}
+ , trustProxy = options.proxy
+ , storeReady = true;
+
+ // notify user that this store is not
+ // meant for a production environment
+ if ('production' == env && store instanceof MemoryStore) {
+ console.warn(warning);
+ }
+
+ // generates the new session
+ store.generate = function(req){
+ req.sessionID = uid(24);
+ req.session = new Session(req);
+ req.session.cookie = new Cookie(cookie);
+ };
+
+ store.on('disconnect', function(){ storeReady = false; });
+ store.on('connect', function(){ storeReady = true; });
+
+ return function session(req, res, next) {
+ // self-awareness
+ if (req.session) return next();
+
+ // Handle connection as if there is no session if
+ // the store has temporarily disconnected etc
+ if (!storeReady) return debug('store is disconnected'), next();
+
+ // pathname mismatch
+ if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next();
+
+ // backwards compatibility for signed cookies
+ // req.secret is passed from the cookie parser middleware
+ var secret = options.secret || req.secret;
+
+ // ensure secret is available or bail
+ if (!secret) throw new Error('`secret` option required for sessions');
+
+ // parse url
+ var originalHash
+ , originalId;
+
+ // expose store
+ req.sessionStore = store;
+
+ // grab the session cookie value and check the signature
+ var rawCookie = req.cookies[key];
+
+ // get signedCookies for backwards compat with signed cookies
+ var unsignedCookie = req.signedCookies[key];
+
+ if (!unsignedCookie && rawCookie) {
+ unsignedCookie = utils.parseSignedCookie(rawCookie, secret);
+ }
+
+ // set-cookie
+ res.on('header', function(){
+ if (!req.session) return;
+ var cookie = req.session.cookie
+ , proto = (req.headers['x-forwarded-proto'] || '').split(',')[0].toLowerCase().trim()
+ , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
+ , isNew = unsignedCookie != req.sessionID;
+
+ // only send secure cookies via https
+ if (cookie.secure && !tls) return debug('not secured');
+
+ // long expires, handle expiry server-side
+ if (!isNew && cookie.hasLongExpires) return debug('already set cookie');
+
+ // browser-session length cookie
+ if (null == cookie.expires) {
+ if (!isNew) return debug('already set browser-session cookie');
+ // compare hashes and ids
+ } else if (originalHash == hash(req.session) && originalId == req.session.id) {
+ return debug('unmodified session');
+ }
+
+ var val = 's:' + signature.sign(req.sessionID, secret);
+ val = cookie.serialize(key, val);
+ debug('set-cookie %s', val);
+ res.setHeader('Set-Cookie', val);
+ });
+
+ // proxy end() to commit the session
+ var end = res.end;
+ res.end = function(data, encoding){
+ res.end = end;
+ if (!req.session) return res.end(data, encoding);
+ debug('saving');
+ req.session.resetMaxAge();
+ req.session.save(function(err){
+ if (err) console.error(err.stack);
+ debug('saved');
+ res.end(data, encoding);
+ });
+ };
+
+ // generate the session
+ function generate() {
+ store.generate(req);
+ }
+
+ // get the sessionID from the cookie
+ req.sessionID = unsignedCookie;
+
+ // generate a session if the browser doesn't send a sessionID
+ if (!req.sessionID) {
+ debug('no SID sent, generating session');
+ generate();
+ next();
+ return;
+ }
+
+ // generate the session object
+ var pause = utils.pause(req);
+ debug('fetching %s', req.sessionID);
+ store.get(req.sessionID, function(err, sess){
+ // proxy to resume() events
+ var _next = next;
+ next = function(err){
+ _next(err);
+ pause.resume();
+ };
+
+ // error handling
+ if (err) {
+ debug('error %j', err);
+ if ('ENOENT' == err.code) {
+ generate();
+ next();
+ } else {
+ next(err);
+ }
+ // no session
+ } else if (!sess) {
+ debug('no session found');
+ generate();
+ next();
+ // populate req.session
+ } else {
+ debug('session found');
+ store.createSession(req, sess);
+ originalId = req.sessionID;
+ originalHash = hash(sess);
+ next();
+ }
+ });
+ };
+};
+
+/**
+ * Hash the given `sess` object omitting changes
+ * to `.cookie`.
+ *
+ * @param {Object} sess
+ * @return {String}
+ * @api private
+ */
+
+function hash(sess) {
+ return crc32.signed(JSON.stringify(sess, function(key, val){
+ if ('cookie' != key) return val;
+ }));
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
new file mode 100644
index 0000000..cdce2a5
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
@@ -0,0 +1,140 @@
+
+/*!
+ * Connect - session - Cookie
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils')
+ , cookie = require('cookie');
+
+/**
+ * Initialize a new `Cookie` with the given `options`.
+ *
+ * @param {IncomingMessage} req
+ * @param {Object} options
+ * @api private
+ */
+
+var Cookie = module.exports = function Cookie(options) {
+ this.path = '/';
+ this.maxAge = null;
+ this.httpOnly = true;
+ if (options) utils.merge(this, options);
+ this.originalMaxAge = undefined == this.originalMaxAge
+ ? this.maxAge
+ : this.originalMaxAge;
+};
+
+/*!
+ * Prototype.
+ */
+
+Cookie.prototype = {
+
+ /**
+ * Set expires `date`.
+ *
+ * @param {Date} date
+ * @api public
+ */
+
+ set expires(date) {
+ this._expires = date;
+ this.originalMaxAge = this.maxAge;
+ },
+
+ /**
+ * Get expires `date`.
+ *
+ * @return {Date}
+ * @api public
+ */
+
+ get expires() {
+ return this._expires;
+ },
+
+ /**
+ * Set expires via max-age in `ms`.
+ *
+ * @param {Number} ms
+ * @api public
+ */
+
+ set maxAge(ms) {
+ this.expires = 'number' == typeof ms
+ ? new Date(Date.now() + ms)
+ : ms;
+ },
+
+ /**
+ * Get expires max-age in `ms`.
+ *
+ * @return {Number}
+ * @api public
+ */
+
+ get maxAge() {
+ return this.expires instanceof Date
+ ? this.expires.valueOf() - Date.now()
+ : this.expires;
+ },
+
+ /**
+ * Return cookie data object.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ get data() {
+ return {
+ originalMaxAge: this.originalMaxAge
+ , expires: this._expires
+ , secure: this.secure
+ , httpOnly: this.httpOnly
+ , domain: this.domain
+ , path: this.path
+ }
+ },
+
+ /**
+ * Check if the cookie has a reasonably large max-age.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+ get hasLongExpires() {
+ var week = 604800000;
+ return this.maxAge > (4 * week);
+ },
+
+ /**
+ * Return a serialized cookie string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+ serialize: function(name, val){
+ return cookie.serialize(name, val, this.data);
+ },
+
+ /**
+ * Return JSON representation of this cookie.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ toJSON: function(){
+ return this.data;
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
new file mode 100644
index 0000000..fb93939
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
@@ -0,0 +1,129 @@
+
+/*!
+ * Connect - session - MemoryStore
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Store = require('./store');
+
+/**
+ * Initialize a new `MemoryStore`.
+ *
+ * @api public
+ */
+
+var MemoryStore = module.exports = function MemoryStore() {
+ this.sessions = {};
+};
+
+/**
+ * Inherit from `Store.prototype`.
+ */
+
+MemoryStore.prototype.__proto__ = Store.prototype;
+
+/**
+ * Attempt to fetch session by the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.get = function(sid, fn){
+ var self = this;
+ process.nextTick(function(){
+ var expires
+ , sess = self.sessions[sid];
+ if (sess) {
+ sess = JSON.parse(sess);
+ expires = 'string' == typeof sess.cookie.expires
+ ? new Date(sess.cookie.expires)
+ : sess.cookie.expires;
+ if (!expires || new Date < expires) {
+ fn(null, sess);
+ } else {
+ self.destroy(sid, fn);
+ }
+ } else {
+ fn();
+ }
+ });
+};
+
+/**
+ * Commit the given `sess` object associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Session} sess
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.set = function(sid, sess, fn){
+ var self = this;
+ process.nextTick(function(){
+ self.sessions[sid] = JSON.stringify(sess);
+ fn && fn();
+ });
+};
+
+/**
+ * Destroy the session associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @api public
+ */
+
+MemoryStore.prototype.destroy = function(sid, fn){
+ var self = this;
+ process.nextTick(function(){
+ delete self.sessions[sid];
+ fn && fn();
+ });
+};
+
+/**
+ * Invoke the given callback `fn` with all active sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.all = function(fn){
+ var arr = []
+ , keys = Object.keys(this.sessions);
+ for (var i = 0, len = keys.length; i < len; ++i) {
+ arr.push(this.sessions[keys[i]]);
+ }
+ fn(null, arr);
+};
+
+/**
+ * Clear all sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.clear = function(fn){
+ this.sessions = {};
+ fn && fn();
+};
+
+/**
+ * Fetch number of sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.length = function(fn){
+ fn(null, Object.keys(this.sessions).length);
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/node_modules/express/node_modules/connect/lib/middleware/session/session.js
new file mode 100644
index 0000000..0dd4b40
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/session.js
@@ -0,0 +1,116 @@
+
+/*!
+ * Connect - session - Session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils');
+
+/**
+ * Create a new `Session` with the given request and `data`.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} data
+ * @api private
+ */
+
+var Session = module.exports = function Session(req, data) {
+ Object.defineProperty(this, 'req', { value: req });
+ Object.defineProperty(this, 'id', { value: req.sessionID });
+ if ('object' == typeof data) utils.merge(this, data);
+};
+
+/**
+ * Update reset `.cookie.maxAge` to prevent
+ * the cookie from expiring when the
+ * session is still active.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.touch = function(){
+ return this.resetMaxAge();
+};
+
+/**
+ * Reset `.maxAge` to `.originalMaxAge`.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.resetMaxAge = function(){
+ this.cookie.maxAge = this.cookie.originalMaxAge;
+ return this;
+};
+
+/**
+ * Save the session data with optional callback `fn(err)`.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.save = function(fn){
+ this.req.sessionStore.set(this.id, this, fn || function(){});
+ return this;
+};
+
+/**
+ * Re-loads the session data _without_ altering
+ * the maxAge properties. Invokes the callback `fn(err)`,
+ * after which time if no exception has occurred the
+ * `req.session` property will be a new `Session` object,
+ * although representing the same session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.reload = function(fn){
+ var req = this.req
+ , store = this.req.sessionStore;
+ store.get(this.id, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn(new Error('failed to load session'));
+ store.createSession(req, sess);
+ fn();
+ });
+ return this;
+};
+
+/**
+ * Destroy `this` session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.destroy = function(fn){
+ delete this.req.session;
+ this.req.sessionStore.destroy(this.id, fn);
+ return this;
+};
+
+/**
+ * Regenerate this request's session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.regenerate = function(fn){
+ this.req.sessionStore.regenerate(this.req, fn);
+ return this;
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/node_modules/express/node_modules/connect/lib/middleware/session/store.js
new file mode 100644
index 0000000..54294cb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/store.js
@@ -0,0 +1,84 @@
+
+/*!
+ * Connect - session - Store
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , Session = require('./session')
+ , Cookie = require('./cookie');
+
+/**
+ * Initialize abstract `Store`.
+ *
+ * @api private
+ */
+
+var Store = module.exports = function Store(options){};
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Store.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Re-generate the given requests's session.
+ *
+ * @param {IncomingRequest} req
+ * @return {Function} fn
+ * @api public
+ */
+
+Store.prototype.regenerate = function(req, fn){
+ var self = this;
+ this.destroy(req.sessionID, function(err){
+ self.generate(req);
+ fn(err);
+ });
+};
+
+/**
+ * Load a `Session` instance via the given `sid`
+ * and invoke the callback `fn(err, sess)`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+Store.prototype.load = function(sid, fn){
+ var self = this;
+ this.get(sid, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn();
+ var req = { sessionID: sid, sessionStore: self };
+ sess = self.createSession(req, sess);
+ fn(null, sess);
+ });
+};
+
+/**
+ * Create session from JSON `sess` data.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} sess
+ * @return {Session}
+ * @api private
+ */
+
+Store.prototype.createSession = function(req, sess){
+ var expires = sess.cookie.expires
+ , orig = sess.cookie.originalMaxAge;
+ sess.cookie = new Cookie(sess.cookie);
+ if ('string' == typeof expires) sess.cookie.expires = new Date(expires);
+ sess.cookie.originalMaxAge = orig;
+ req.session = new Session(req, sess);
+ return req.session;
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/static.js b/node_modules/express/node_modules/connect/lib/middleware/static.js
new file mode 100644
index 0000000..7762ac1
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/static.js
@@ -0,0 +1,95 @@
+/*!
+ * Connect - static
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var send = require('send')
+ , utils = require('../utils')
+ , parse = utils.parseUrl
+ , url = require('url');
+
+/**
+ * Static:
+ *
+ * Static file server with the given `root` path.
+ *
+ * Examples:
+ *
+ * var oneDay = 86400000;
+ *
+ * connect()
+ * .use(connect.static(__dirname + '/public'))
+ *
+ * connect()
+ * .use(connect.static(__dirname + '/public', { maxAge: oneDay }))
+ *
+ * Options:
+ *
+ * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0
+ * - `hidden` Allow transfer of hidden files. defaults to false
+ * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true
+ * - `index` Default file name, defaults to 'index.html'
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(root, options){
+ options = options || {};
+
+ // root required
+ if (!root) throw new Error('static() root path required');
+
+ // default redirect
+ var redirect = false !== options.redirect;
+
+ return function staticMiddleware(req, res, next) {
+ if ('GET' != req.method && 'HEAD' != req.method) return next();
+ var path = parse(req).pathname;
+ var pause = utils.pause(req);
+
+ function resume() {
+ next();
+ pause.resume();
+ }
+
+ function directory() {
+ if (!redirect) return resume();
+ var pathname = url.parse(req.originalUrl).pathname;
+ res.statusCode = 303;
+ res.setHeader('Location', pathname + '/');
+ res.end('Redirecting to ' + utils.escape(pathname) + '/');
+ }
+
+ function error(err) {
+ if (404 == err.status) return resume();
+ next(err);
+ }
+
+ send(req, path)
+ .maxage(options.maxAge || 0)
+ .root(root)
+ .index(options.index || 'index.html')
+ .hidden(options.hidden)
+ .on('error', error)
+ .on('directory', directory)
+ .pipe(res);
+ };
+};
+
+/**
+ * Expose mime module.
+ *
+ * If you wish to extend the mime table use this
+ * reference to the "mime" module in the npm registry.
+ */
+
+exports.mime = send.mime;
diff --git a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
new file mode 100644
index 0000000..7354a8f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
@@ -0,0 +1,231 @@
+
+/*!
+ * Connect - staticCache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , Cache = require('../cache')
+ , fresh = require('fresh');
+
+/**
+ * Static cache:
+ *
+ * Enables a memory cache layer on top of
+ * the `static()` middleware, serving popular
+ * static files.
+ *
+ * By default a maximum of 128 objects are
+ * held in cache, with a max of 256k each,
+ * totalling ~32mb.
+ *
+ * A Least-Recently-Used (LRU) cache algo
+ * is implemented through the `Cache` object,
+ * simply rotating cache objects as they are
+ * hit. This means that increasingly popular
+ * objects maintain their positions while
+ * others get shoved out of the stack and
+ * garbage collected.
+ *
+ * Benchmarks:
+ *
+ * static(): 2700 rps
+ * node-static: 5300 rps
+ * static() + staticCache(): 7500 rps
+ *
+ * Options:
+ *
+ * - `maxObjects` max cache objects [128]
+ * - `maxLength` max cache object length 256kb
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function staticCache(options){
+ var options = options || {}
+ , cache = new Cache(options.maxObjects || 128)
+ , maxlen = options.maxLength || 1024 * 256;
+
+ console.warn('connect.staticCache() is deprecated and will be removed in 3.0');
+ console.warn('use varnish or similar reverse proxy caches.');
+
+ return function staticCache(req, res, next){
+ var key = cacheKey(req)
+ , ranges = req.headers.range
+ , hasCookies = req.headers.cookie
+ , hit = cache.get(key);
+
+ // cache static
+ // TODO: change from staticCache() -> cache()
+ // and make this work for any request
+ req.on('static', function(stream){
+ var headers = res._headers
+ , cc = utils.parseCacheControl(headers['cache-control'] || '')
+ , contentLength = headers['content-length']
+ , hit;
+
+ // dont cache set-cookie responses
+ if (headers['set-cookie']) return hasCookies = true;
+
+ // dont cache when cookies are present
+ if (hasCookies) return;
+
+ // ignore larger files
+ if (!contentLength || contentLength > maxlen) return;
+
+ // don't cache partial files
+ if (headers['content-range']) return;
+
+ // dont cache items we shouldn't be
+ // TODO: real support for must-revalidate / no-cache
+ if ( cc['no-cache']
+ || cc['no-store']
+ || cc['private']
+ || cc['must-revalidate']) return;
+
+ // if already in cache then validate
+ if (hit = cache.get(key)){
+ if (headers.etag == hit[0].etag) {
+ hit[0].date = new Date;
+ return;
+ } else {
+ cache.remove(key);
+ }
+ }
+
+ // validation notifiactions don't contain a steam
+ if (null == stream) return;
+
+ // add the cache object
+ var arr = [];
+
+ // store the chunks
+ stream.on('data', function(chunk){
+ arr.push(chunk);
+ });
+
+ // flag it as complete
+ stream.on('end', function(){
+ var cacheEntry = cache.add(key);
+ delete headers['x-cache']; // Clean up (TODO: others)
+ cacheEntry.push(200);
+ cacheEntry.push(headers);
+ cacheEntry.push.apply(cacheEntry, arr);
+ });
+ });
+
+ if (req.method == 'GET' || req.method == 'HEAD') {
+ if (ranges) {
+ next();
+ } else if (!hasCookies && hit && !mustRevalidate(req, hit)) {
+ res.setHeader('X-Cache', 'HIT');
+ respondFromCache(req, res, hit);
+ } else {
+ res.setHeader('X-Cache', 'MISS');
+ next();
+ }
+ } else {
+ next();
+ }
+ }
+};
+
+/**
+ * Respond with the provided cached value.
+ * TODO: Assume 200 code, that's iffy.
+ *
+ * @param {Object} req
+ * @param {Object} res
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function respondFromCache(req, res, cacheEntry) {
+ var status = cacheEntry[0]
+ , headers = utils.merge({}, cacheEntry[1])
+ , content = cacheEntry.slice(2);
+
+ headers.age = (new Date - new Date(headers.date)) / 1000 || 0;
+
+ switch (req.method) {
+ case 'HEAD':
+ res.writeHead(status, headers);
+ res.end();
+ break;
+ case 'GET':
+ if (utils.conditionalGET(req) && fresh(req.headers, headers)) {
+ headers['content-length'] = 0;
+ res.writeHead(304, headers);
+ res.end();
+ } else {
+ res.writeHead(status, headers);
+
+ function write() {
+ while (content.length) {
+ if (false === res.write(content.shift())) {
+ res.once('drain', write);
+ return;
+ }
+ }
+ res.end();
+ }
+
+ write();
+ }
+ break;
+ default:
+ // This should never happen.
+ res.writeHead(500, '');
+ res.end();
+ }
+}
+
+/**
+ * Determine whether or not a cached value must be revalidated.
+ *
+ * @param {Object} req
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function mustRevalidate(req, cacheEntry) {
+ var cacheHeaders = cacheEntry[1]
+ , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '')
+ , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '')
+ , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0;
+
+ if ( cacheCC['no-cache']
+ || cacheCC['must-revalidate']
+ || cacheCC['proxy-revalidate']) return true;
+
+ if (reqCC['no-cache']) return true;
+
+ if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge;
+
+ if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge;
+
+ return false;
+}
+
+/**
+ * The key to use in the cache. For now, this is the URL path and query.
+ *
+ * 'http://example.com?key=value' -> '/?key=value'
+ *
+ * @param {Object} req
+ * @return {String}
+ * @api private
+ */
+
+function cacheKey(req) {
+ return utils.parseUrl(req).path;
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/node_modules/express/node_modules/connect/lib/middleware/timeout.js
new file mode 100644
index 0000000..5496c02
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/timeout.js
@@ -0,0 +1,55 @@
+/*!
+ * Connect - timeout
+ * Ported from https://github.com/LearnBoost/connect-timeout
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var debug = require('debug')('connect:timeout');
+
+/**
+ * Timeout:
+ *
+ * Times out the request in `ms`, defaulting to `5000`. The
+ * method `req.clearTimeout()` is added to revert this behaviour
+ * programmatically within your application's middleware, routes, etc.
+ *
+ * The timeout error is passed to `next()` so that you may customize
+ * the response behaviour. This error has the `.timeout` property as
+ * well as `.status == 503`.
+ *
+ * @param {Number} ms
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function timeout(ms) {
+ ms = ms || 5000;
+
+ return function(req, res, next) {
+ var id = setTimeout(function(){
+ req.emit('timeout', ms);
+ }, ms);
+
+ req.on('timeout', function(){
+ if (res.headerSent) return debug('response started, cannot timeout');
+ var err = new Error('Response timeout');
+ err.timeout = ms;
+ err.status = 503;
+ next(err);
+ });
+
+ req.clearTimeout = function(){
+ clearTimeout(id);
+ };
+
+ res.on('header', function(){
+ clearTimeout(id);
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
new file mode 100644
index 0000000..cceafc0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - urlencoded
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , _limit = require('./limit')
+ , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * Urlencoded:
+ *
+ * Parse x-ww-form-urlencoded request bodies,
+ * providing the parsed object as `req.body`.
+ *
+ * Options:
+ *
+ * - `limit` byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ options = options || {};
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function urlencoded(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // check Content-Type
+ if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+ var buf = '';
+ req.setEncoding('utf8');
+ req.on('data', function(chunk){ buf += chunk });
+ req.on('end', function(){
+ try {
+ req.body = buf.length
+ ? qs.parse(buf, options)
+ : {};
+ next();
+ } catch (err){
+ err.body = buf;
+ next(err);
+ }
+ });
+ });
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/node_modules/express/node_modules/connect/lib/middleware/vhost.js
new file mode 100644
index 0000000..abbb050
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/vhost.js
@@ -0,0 +1,40 @@
+
+/*!
+ * Connect - vhost
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Vhost:
+ *
+ * Setup vhost for the given `hostname` and `server`.
+ *
+ * connect()
+ * .use(connect.vhost('foo.com', fooApp))
+ * .use(connect.vhost('bar.com', barApp))
+ * .use(connect.vhost('*.com', mainApp))
+ *
+ * The `server` may be a Connect server or
+ * a regular Node `http.Server`.
+ *
+ * @param {String} hostname
+ * @param {Server} server
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function vhost(hostname, server){
+ if (!hostname) throw new Error('vhost hostname required');
+ if (!server) throw new Error('vhost server required');
+ var regexp = new RegExp('^' + hostname.replace(/[^*\w]/g, '\\$&').replace(/[*]/g, '(?:.*?)') + '$', 'i');
+ if (server.onvhost) server.onvhost(hostname);
+ return function vhost(req, res, next){
+ if (!req.headers.host) return next();
+ var host = req.headers.host.split(':')[0];
+ if (!regexp.test(host)) return next();
+ if ('function' == typeof server) return server(req, res, next);
+ server.emit('request', req, res);
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/patch.js b/node_modules/express/node_modules/connect/lib/patch.js
new file mode 100644
index 0000000..7cf0012
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/patch.js
@@ -0,0 +1,79 @@
+
+/*!
+ * Connect
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , res = http.ServerResponse.prototype
+ , setHeader = res.setHeader
+ , _renderHeaders = res._renderHeaders
+ , writeHead = res.writeHead;
+
+// apply only once
+
+if (!res._hasConnectPatch) {
+
+ /**
+ * Provide a public "header sent" flag
+ * until node does.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+ res.__defineGetter__('headerSent', function(){
+ return this._header;
+ });
+
+ /**
+ * Set header `field` to `val`, special-casing
+ * the `Set-Cookie` field for multiple support.
+ *
+ * @param {String} field
+ * @param {String} val
+ * @api public
+ */
+
+ res.setHeader = function(field, val){
+ var key = field.toLowerCase()
+ , prev;
+
+ // special-case Set-Cookie
+ if (this._headers && 'set-cookie' == key) {
+ if (prev = this.getHeader(field)) {
+ val = Array.isArray(prev)
+ ? prev.concat(val)
+ : [prev, val];
+ }
+ // charset
+ } else if ('content-type' == key && this.charset) {
+ val += '; charset=' + this.charset;
+ }
+
+ return setHeader.call(this, field, val);
+ };
+
+ /**
+ * Proxy to emit "header" event.
+ */
+
+ res._renderHeaders = function(){
+ if (!this._emittedHeader) this.emit('header');
+ this._emittedHeader = true;
+ return _renderHeaders.call(this);
+ };
+
+ res.writeHead = function(){
+ if (!this._emittedHeader) this.emit('header');
+ this._emittedHeader = true;
+ return writeHead.apply(this, arguments);
+ };
+
+ res._hasConnectPatch = true;
+}
diff --git a/node_modules/express/node_modules/connect/lib/proto.js b/node_modules/express/node_modules/connect/lib/proto.js
new file mode 100644
index 0000000..6fadf8f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/proto.js
@@ -0,0 +1,230 @@
+
+/*!
+ * Connect - HTTPServer
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , utils = require('./utils')
+ , debug = require('debug')('connect:dispatcher');
+
+// prototype
+
+var app = module.exports = {};
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Utilize the given middleware `handle` to the given `route`,
+ * defaulting to _/_. This "route" is the mount-point for the
+ * middleware, when given a value other than _/_ the middleware
+ * is only effective when that segment is present in the request's
+ * pathname.
+ *
+ * For example if we were to mount a function at _/admin_, it would
+ * be invoked on _/admin_, and _/admin/settings_, however it would
+ * not be invoked for _/_, or _/posts_.
+ *
+ * Examples:
+ *
+ * var app = connect();
+ * app.use(connect.favicon());
+ * app.use(connect.logger());
+ * app.use(connect.static(__dirname + '/public'));
+ *
+ * If we wanted to prefix static files with _/public_, we could
+ * "mount" the `static()` middleware:
+ *
+ * app.use('/public', connect.static(__dirname + '/public'));
+ *
+ * This api is chainable, so the following is valid:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.logger())
+ * .use(connect.static(__dirname + '/public'))
+ * .listen(3000);
+ *
+ * @param {String|Function|Server} route, callback or server
+ * @param {Function|Server} callback or server
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+ // default route to '/'
+ if ('string' != typeof route) {
+ fn = route;
+ route = '/';
+ }
+
+ // wrap sub-apps
+ if ('function' == typeof fn.handle) {
+ var server = fn;
+ fn.route = route;
+ fn = function(req, res, next){
+ server.handle(req, res, next);
+ };
+ }
+
+ // wrap vanilla http.Servers
+ if (fn instanceof http.Server) {
+ fn = fn.listeners('request')[0];
+ }
+
+ // strip trailing slash
+ if ('/' == route[route.length - 1]) {
+ route = route.slice(0, -1);
+ }
+
+ // add the middleware
+ debug('use %s %s', route || '/', fn.name || 'anonymous');
+ this.stack.push({ route: route, handle: fn });
+
+ return this;
+};
+
+/**
+ * Handle server requests, punting them down
+ * the middleware stack.
+ *
+ * @api private
+ */
+
+app.handle = function(req, res, out) {
+ var stack = this.stack
+ , fqdn = ~req.url.indexOf('://')
+ , removed = ''
+ , slashAdded = false
+ , index = 0;
+
+ function next(err) {
+ var layer, path, status, c;
+
+ if (slashAdded) {
+ req.url = req.url.substr(1);
+ slashAdded = false;
+ }
+
+ req.url = removed + req.url;
+ req.originalUrl = req.originalUrl || req.url;
+ removed = '';
+
+ // next callback
+ layer = stack[index++];
+
+ // all done
+ if (!layer || res.headerSent) {
+ // delegate to parent
+ if (out) return out(err);
+
+ // unhandled error
+ if (err) {
+ // default to 500
+ if (res.statusCode < 400) res.statusCode = 500;
+ debug('default %s', res.statusCode);
+
+ // respect err.status
+ if (err.status) res.statusCode = err.status;
+
+ // production gets a basic error message
+ var msg = 'production' == env
+ ? http.STATUS_CODES[res.statusCode]
+ : err.stack || err.toString();
+
+ // log to stderr in a non-test env
+ if ('test' != env) console.error(err.stack || err.toString());
+ if (res.headerSent) return req.socket.destroy();
+ res.setHeader('Content-Type', 'text/plain');
+ res.setHeader('Content-Length', Buffer.byteLength(msg));
+ if ('HEAD' == req.method) return res.end();
+ res.end(msg);
+ } else {
+ debug('default 404');
+ res.statusCode = 404;
+ res.setHeader('Content-Type', 'text/plain');
+ if ('HEAD' == req.method) return res.end();
+ res.end('Cannot ' + utils.escape(req.method) + ' ' + utils.escape(req.originalUrl));
+ }
+ return;
+ }
+
+ try {
+ path = utils.parseUrl(req).pathname;
+ if (undefined == path) path = '/';
+
+ // skip this layer if the route doesn't match.
+ if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);
+
+ c = path[layer.route.length];
+ if (c && '/' != c && '.' != c) return next(err);
+
+ // Call the layer handler
+ // Trim off the part of the url that matches the route
+ removed = layer.route;
+ req.url = req.url.substr(removed.length);
+
+ // Ensure leading slash
+ if (!fqdn && '/' != req.url[0]) {
+ req.url = '/' + req.url;
+ slashAdded = true;
+ }
+
+ debug('%s %s : %s', layer.handle.name || 'anonymous', layer.route, req.originalUrl);
+ var arity = layer.handle.length;
+ if (err) {
+ if (arity === 4) {
+ layer.handle(err, req, res, next);
+ } else {
+ next(err);
+ }
+ } else if (arity < 4) {
+ layer.handle(req, res, next);
+ } else {
+ next();
+ }
+ } catch (e) {
+ next(e);
+ }
+ }
+ next();
+};
+
+/**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * HTTP and HTTPS:
+ *
+ * If you run your application both as HTTP
+ * and HTTPS you may wrap them individually,
+ * since your Connect "server" is really just
+ * a JavaScript `Function`.
+ *
+ * var connect = require('connect')
+ * , http = require('http')
+ * , https = require('https');
+ *
+ * var app = connect();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer(options, app).listen(443);
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+ var server = http.createServer(this);
+ return server.listen.apply(server, arguments);
+};
diff --git a/node_modules/express/node_modules/connect/lib/public/directory.html b/node_modules/express/node_modules/connect/lib/public/directory.html
new file mode 100644
index 0000000..2d63704
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/directory.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset='utf-8'>
+ <title>listing directory {directory}</title>
+ <style>{style}</style>
+ <script>
+ function $(id){
+ var el = 'string' == typeof id
+ ? document.getElementById(id)
+ : id;
+
+ el.on = function(event, fn){
+ if ('content loaded' == event) {
+ event = window.attachEvent ? "load" : "DOMContentLoaded";
+ }
+ el.addEventListener
+ ? el.addEventListener(event, fn, false)
+ : el.attachEvent("on" + event, fn);
+ };
+
+ el.all = function(selector){
+ return $(el.querySelectorAll(selector));
+ };
+
+ el.each = function(fn){
+ for (var i = 0, len = el.length; i < len; ++i) {
+ fn($(el[i]), i);
+ }
+ };
+
+ el.getClasses = function(){
+ return this.getAttribute('class').split(/\s+/);
+ };
+
+ el.addClass = function(name){
+ var classes = this.getAttribute('class');
+ el.setAttribute('class', classes
+ ? classes + ' ' + name
+ : name);
+ };
+
+ el.removeClass = function(name){
+ var classes = this.getClasses().filter(function(curr){
+ return curr != name;
+ });
+ this.setAttribute('class', classes);
+ };
+
+ return el;
+ }
+
+ function search() {
+ var str = $('search').value
+ , links = $('files').all('a');
+
+ links.each(function(link){
+ var text = link.textContent;
+
+ if ('..' == text) return;
+ if (str.length && ~text.indexOf(str)) {
+ link.addClass('highlight');
+ } else {
+ link.removeClass('highlight');
+ }
+ });
+ }
+
+ $(window).on('content loaded', function(){
+ $('search').on('keyup', search);
+ });
+ </script>
+ </head>
+ <body class="directory">
+ <input id="search" type="text" placeholder="Search" autocomplete="off" />
+ <div id="wrapper">
+ <h1>{linked-path}</h1>
+ {files}
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/public/error.html b/node_modules/express/node_modules/connect/lib/public/error.html
new file mode 100644
index 0000000..a6d3faf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/error.html
@@ -0,0 +1,14 @@
+<html>
+ <head>
+ <meta charset='utf-8'>
+ <title>{error}</title>
+ <style>{style}</style>
+ </head>
+ <body>
+ <div id="wrapper">
+ <h1>{title}</h1>
+ <h2><em>{statusCode}</em> {error}</h2>
+ <ul id="stacktrace">{stack}</ul>
+ </div>
+ </body>
+</html>
diff --git a/node_modules/express/node_modules/connect/lib/public/favicon.ico b/node_modules/express/node_modules/connect/lib/public/favicon.ico
new file mode 100644
index 0000000..895fc96
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/favicon.ico
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page.png b/node_modules/express/node_modules/connect/lib/public/icons/page.png
new file mode 100644
index 0000000..03ddd79
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png
new file mode 100644
index 0000000..d5bfa07
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
new file mode 100644
index 0000000..89ee2da
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png
new file mode 100644
index 0000000..f7ea904
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
new file mode 100644
index 0000000..195dc6d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
new file mode 100644
index 0000000..3141467
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
new file mode 100644
index 0000000..046811e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png
new file mode 100644
index 0000000..f07f449
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
new file mode 100644
index 0000000..eb6158e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png
new file mode 100644
index 0000000..2f19388
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
new file mode 100644
index 0000000..8e83281
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png
new file mode 100644
index 0000000..80fe1ed
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png
new file mode 100644
index 0000000..de8e003
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png
new file mode 100644
index 0000000..d6626cb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
new file mode 100644
index 0000000..7e56870
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png
new file mode 100644
index 0000000..312eab0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
new file mode 100644
index 0000000..246a2f0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
new file mode 100644
index 0000000..968f073
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png
new file mode 100644
index 0000000..0b18247
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
new file mode 100644
index 0000000..cf347c7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png
new file mode 100644
index 0000000..caea546
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png
new file mode 100644
index 0000000..8b8b1ca
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
new file mode 100644
index 0000000..8f8095e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
new file mode 100644
index 0000000..159b240
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
new file mode 100644
index 0000000..aa23dde
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
new file mode 100644
index 0000000..34a05cc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
new file mode 100644
index 0000000..f501a59
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
new file mode 100644
index 0000000..848bdaf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
new file mode 100644
index 0000000..0c76bd1
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
new file mode 100644
index 0000000..87a6914
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
new file mode 100644
index 0000000..c66011f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
new file mode 100644
index 0000000..2b6b100
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
new file mode 100644
index 0000000..a9f31a2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
new file mode 100644
index 0000000..a87cf84
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
new file mode 100644
index 0000000..ffb8fc9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
new file mode 100644
index 0000000..0a7d6f4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
new file mode 100644
index 0000000..bddba1f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
new file mode 100644
index 0000000..af1ecaf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
new file mode 100644
index 0000000..4cc537a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
new file mode 100644
index 0000000..b93e776
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
new file mode 100644
index 0000000..9fc5a0a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
new file mode 100644
index 0000000..b977d7e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
new file mode 100644
index 0000000..5818436
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
new file mode 100644
index 0000000..5769120
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
new file mode 100644
index 0000000..8d719df
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
new file mode 100644
index 0000000..106f5aa
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
new file mode 100644
index 0000000..e4a1ecb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
new file mode 100644
index 0000000..7e62a92
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
new file mode 100644
index 0000000..e902abb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
new file mode 100644
index 0000000..1d2d0a4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
new file mode 100644
index 0000000..d616484
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
new file mode 100644
index 0000000..7215d1e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
new file mode 100644
index 0000000..bf7bd1c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
new file mode 100644
index 0000000..f6b74cc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
new file mode 100644
index 0000000..d3fffb6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
new file mode 100644
index 0000000..a65bcb3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
new file mode 100644
index 0000000..23a37b8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
new file mode 100644
index 0000000..f907e44
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
new file mode 100644
index 0000000..5b2cbb3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
new file mode 100644
index 0000000..7868a25
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
new file mode 100644
index 0000000..134b669
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
new file mode 100644
index 0000000..c4eff03
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
new file mode 100644
index 0000000..884ffd6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
new file mode 100644
index 0000000..f59b7c4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
new file mode 100644
index 0000000..44084ad
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
new file mode 100644
index 0000000..3a1441c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
new file mode 100644
index 0000000..e770829
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
new file mode 100644
index 0000000..813f712
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
new file mode 100644
index 0000000..d9cf132
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
new file mode 100644
index 0000000..52699bf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
new file mode 100644
index 0000000..4a05955
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
new file mode 100644
index 0000000..a0a433d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
new file mode 100644
index 0000000..1eb8809
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
new file mode 100644
index 0000000..ae8ecbf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
new file mode 100644
index 0000000..6ed2490
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
new file mode 100644
index 0000000..fecadd0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
new file mode 100644
index 0000000..fd4bbcc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png
new file mode 100644
index 0000000..834cdfa
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png
new file mode 100644
index 0000000..b8895dd
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/lib/public/style.css b/node_modules/express/node_modules/connect/lib/public/style.css
new file mode 100644
index 0000000..32b6507
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/style.css
@@ -0,0 +1,141 @@
+body {
+ margin: 0;
+ padding: 80px 100px;
+ font: 13px "Helvetica Neue", "Lucida Grande", "Arial";
+ background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9));
+ background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9);
+ background-repeat: no-repeat;
+ color: #555;
+ -webkit-font-smoothing: antialiased;
+}
+h1, h2, h3 {
+ margin: 0;
+ font-size: 22px;
+ color: #343434;
+}
+h1 em, h2 em {
+ padding: 0 5px;
+ font-weight: normal;
+}
+h1 {
+ font-size: 60px;
+}
+h2 {
+ margin-top: 10px;
+}
+h3 {
+ margin: 5px 0 10px 0;
+ padding-bottom: 5px;
+ border-bottom: 1px solid #eee;
+ font-size: 18px;
+}
+ul {
+ margin: 0;
+ padding: 0;
+}
+ul li {
+ margin: 5px 0;
+ padding: 3px 8px;
+ list-style: none;
+}
+ul li:hover {
+ cursor: pointer;
+ color: #2e2e2e;
+}
+ul li .path {
+ padding-left: 5px;
+ font-weight: bold;
+}
+ul li .line {
+ padding-right: 5px;
+ font-style: italic;
+}
+ul li:first-child .path {
+ padding-left: 0;
+}
+p {
+ line-height: 1.5;
+}
+a {
+ color: #555;
+ text-decoration: none;
+}
+a:hover {
+ color: #303030;
+}
+#stacktrace {
+ margin-top: 15px;
+}
+.directory h1 {
+ margin-bottom: 15px;
+ font-size: 18px;
+}
+ul#files {
+ width: 100%;
+ height: 500px;
+}
+ul#files li {
+ padding: 0;
+}
+ul#files li img {
+ position: absolute;
+ top: 5px;
+ left: 5px;
+}
+ul#files li a {
+ position: relative;
+ display: block;
+ margin: 1px;
+ width: 30%;
+ height: 25px;
+ line-height: 25px;
+ text-indent: 8px;
+ float: left;
+ border: 1px solid transparent;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+ul#files li a.icon {
+ text-indent: 25px;
+}
+ul#files li a:focus,
+ul#files li a:hover {
+ outline: none;
+ background: rgba(255,255,255,0.65);
+ border: 1px solid #ececec;
+}
+ul#files li a.highlight {
+ -webkit-transition: background .4s ease-in-out;
+ background: #ffff4f;
+ border-color: #E9DC51;
+}
+#search {
+ display: block;
+ position: fixed;
+ top: 20px;
+ right: 20px;
+ width: 90px;
+ -webkit-transition: width ease 0.2s, opacity ease 0.4s;
+ -moz-transition: width ease 0.2s, opacity ease 0.4s;
+ -webkit-border-radius: 32px;
+ -moz-border-radius: 32px;
+ -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);
+ -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);
+ -webkit-font-smoothing: antialiased;
+ text-align: left;
+ font: 13px "Helvetica Neue", Arial, sans-serif;
+ padding: 4px 10px;
+ border: none;
+ background: transparent;
+ margin-bottom: 0;
+ outline: none;
+ opacity: 0.7;
+ color: #888;
+}
+#search:focus {
+ width: 120px;
+ opacity: 1.0;
+}
diff --git a/node_modules/express/node_modules/connect/lib/utils.js b/node_modules/express/node_modules/connect/lib/utils.js
new file mode 100644
index 0000000..d52009a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/utils.js
@@ -0,0 +1,386 @@
+
+/*!
+ * Connect - utils
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , crypto = require('crypto')
+ , parse = require('url').parse
+ , signature = require('cookie-signature')
+ , nodeVersion = process.versions.node.split('.');
+
+// pause is broken in node < 0.10
+exports.brokenPause = parseInt(nodeVersion[0], 10) === 0
+ && parseInt(nodeVersion[1], 10) < 10;
+
+/**
+ * Return `true` if the request has a body, otherwise return `false`.
+ *
+ * @param {IncomingMessage} req
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.hasBody = function(req) {
+ var encoding = 'transfer-encoding' in req.headers;
+ var length = 'content-length' in req.headers && req.headers['content-length'] !== '0';
+ return encoding || length;
+};
+
+/**
+ * Extract the mime type from the given request's
+ * _Content-Type_ header.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+exports.mime = function(req) {
+ var str = req.headers['content-type'] || '';
+ return str.split(';')[0];
+};
+
+/**
+ * Generate an `Error` from the given status `code`
+ * and optional `msg`.
+ *
+ * @param {Number} code
+ * @param {String} msg
+ * @return {Error}
+ * @api private
+ */
+
+exports.error = function(code, msg){
+ var err = new Error(msg || http.STATUS_CODES[code]);
+ err.status = code;
+ return err;
+};
+
+/**
+ * Return md5 hash of the given string and optional encoding,
+ * defaulting to hex.
+ *
+ * utils.md5('wahoo');
+ * // => "e493298061761236c96b02ea6aa8a2ad"
+ *
+ * @param {String} str
+ * @param {String} encoding
+ * @return {String}
+ * @api private
+ */
+
+exports.md5 = function(str, encoding){
+ return crypto
+ .createHash('md5')
+ .update(str)
+ .digest(encoding || 'hex');
+};
+
+/**
+ * Merge object b with object a.
+ *
+ * var a = { foo: 'bar' }
+ * , b = { bar: 'baz' };
+ *
+ * utils.merge(a, b);
+ * // => { foo: 'bar', bar: 'baz' }
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object}
+ * @api private
+ */
+
+exports.merge = function(a, b){
+ if (a && b) {
+ for (var key in b) {
+ a[key] = b[key];
+ }
+ }
+ return a;
+};
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+};
+
+/**
+ * Sign the given `val` with `secret`.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(val, secret){
+ console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature')
+ return val + '.' + crypto
+ .createHmac('sha256', secret)
+ .update(val)
+ .digest('base64')
+ .replace(/=+$/, '');
+};
+
+/**
+ * Unsign and decode the given `val` with `secret`,
+ * returning `false` if the signature is invalid.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String|Boolean}
+ * @api private
+ */
+
+exports.unsign = function(val, secret){
+ console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature')
+ var str = val.slice(0, val.lastIndexOf('.'));
+ return exports.sign(str, secret) == val
+ ? str
+ : false;
+};
+
+/**
+ * Parse signed cookies, returning an object
+ * containing the decoded key/value pairs,
+ * while removing the signed key from `obj`.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseSignedCookies = function(obj, secret){
+ var ret = {};
+ Object.keys(obj).forEach(function(key){
+ var val = obj[key];
+ if (0 == val.indexOf('s:')) {
+ val = signature.unsign(val.slice(2), secret);
+ if (val) {
+ ret[key] = val;
+ delete obj[key];
+ }
+ }
+ });
+ return ret;
+};
+
+/**
+ * Parse a signed cookie string, return the decoded value
+ *
+ * @param {String} str signed cookie string
+ * @param {String} secret
+ * @return {String} decoded value
+ * @api private
+ */
+
+exports.parseSignedCookie = function(str, secret){
+ return 0 == str.indexOf('s:')
+ ? signature.unsign(str.slice(2), secret)
+ : str;
+};
+
+/**
+ * Parse JSON cookies.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseJSONCookies = function(obj){
+ Object.keys(obj).forEach(function(key){
+ var val = obj[key];
+ var res = exports.parseJSONCookie(val);
+ if (res) obj[key] = res;
+ });
+ return obj;
+};
+
+/**
+ * Parse JSON cookie string
+ *
+ * @param {String} str
+ * @return {Object} Parsed object or null if not json cookie
+ * @api private
+ */
+
+exports.parseJSONCookie = function(str) {
+ if (0 == str.indexOf('j:')) {
+ try {
+ return JSON.parse(str.slice(2));
+ } catch (err) {
+ // no op
+ }
+ }
+};
+
+/**
+ * Pause `data` and `end` events on the given `obj`.
+ * Middleware performing async tasks _should_ utilize
+ * this utility (or similar), to re-emit data once
+ * the async operation has completed, otherwise these
+ * events may be lost. Pause is only required for
+ * node versions less than 10, and is replaced with
+ * noop's otherwise.
+ *
+ * var pause = utils.pause(req);
+ * fs.readFile(path, function(){
+ * next();
+ * pause.resume();
+ * });
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.pause = exports.brokenPause
+ ? require('pause')
+ : function () {
+ return {
+ end: noop,
+ resume: noop
+ }
+ }
+
+/**
+ * Strip `Content-*` headers from `res`.
+ *
+ * @param {ServerResponse} res
+ * @api private
+ */
+
+exports.removeContentHeaders = function(res){
+ Object.keys(res._headers).forEach(function(field){
+ if (0 == field.indexOf('content')) {
+ res.removeHeader(field);
+ }
+ });
+};
+
+/**
+ * Check if `req` is a conditional GET request.
+ *
+ * @param {IncomingMessage} req
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.conditionalGET = function(req) {
+ return req.headers['if-modified-since']
+ || req.headers['if-none-match'];
+};
+
+/**
+ * Respond with 401 "Unauthorized".
+ *
+ * @param {ServerResponse} res
+ * @param {String} realm
+ * @api private
+ */
+
+exports.unauthorized = function(res, realm) {
+ res.statusCode = 401;
+ res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"');
+ res.end('Unauthorized');
+};
+
+/**
+ * Respond with 304 "Not Modified".
+ *
+ * @param {ServerResponse} res
+ * @param {Object} headers
+ * @api private
+ */
+
+exports.notModified = function(res) {
+ exports.removeContentHeaders(res);
+ res.statusCode = 304;
+ res.end();
+};
+
+/**
+ * Return an ETag in the form of `"<size>-<mtime>"`
+ * from the given `stat`.
+ *
+ * @param {Object} stat
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(stat) {
+ return '"' + stat.size + '-' + Number(stat.mtime) + '"';
+};
+
+/**
+ * Parse the given Cache-Control `str`.
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseCacheControl = function(str){
+ var directives = str.split(',')
+ , obj = {};
+
+ for(var i = 0, len = directives.length; i < len; i++) {
+ var parts = directives[i].split('=')
+ , key = parts.shift().trim()
+ , val = parseInt(parts.shift(), 10);
+
+ obj[key] = isNaN(val) ? true : val;
+ }
+
+ return obj;
+};
+
+/**
+ * Parse the `req` url with memoization.
+ *
+ * @param {ServerRequest} req
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseUrl = function(req){
+ var parsed = req._parsedUrl;
+ if (parsed && parsed.href == req.url) {
+ return parsed;
+ } else {
+ return req._parsedUrl = parse(req.url);
+ }
+};
+
+/**
+ * Parse byte `size` string.
+ *
+ * @param {String} size
+ * @return {Number}
+ * @api private
+ */
+
+exports.parseBytes = require('bytes');
+
+function noop() {}
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
@@ -0,0 +1 @@
+test
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/node_modules/express/node_modules/connect/node_modules/bytes/History.md
new file mode 100644
index 0000000..1332808
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/History.md
@@ -0,0 +1,10 @@
+
+0.2.0 / 2012-10-28
+==================
+
+ * bytes(200).should.eql('200b')
+
+0.1.0 / 2012-07-04
+==================
+
+ * add bytes to string conversion [yields]
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
new file mode 100644
index 0000000..8e8640f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec \
+ --require should
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
new file mode 100644
index 0000000..9325d5b
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
@@ -0,0 +1,51 @@
+# node-bytes
+
+ Byte string parser / formatter.
+
+## Example:
+
+```js
+bytes('1kb')
+// => 1024
+
+bytes('2mb')
+// => 2097152
+
+bytes('1gb')
+// => 1073741824
+
+bytes(1073741824)
+// => 1gb
+```
+
+## Installation
+
+```
+$ npm install bytes
+$ component install visionmedia/bytes.js
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/node_modules/express/node_modules/connect/node_modules/bytes/component.json
new file mode 100644
index 0000000..76a6057
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/component.json
@@ -0,0 +1,7 @@
+{
+ "name": "bytes",
+ "description": "byte size string parser / serializer",
+ "keywords": ["bytes", "utility"],
+ "version": "0.1.0",
+ "scripts": ["index.js"]
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/node_modules/express/node_modules/connect/node_modules/bytes/index.js
new file mode 100644
index 0000000..70b2e01
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/index.js
@@ -0,0 +1,39 @@
+
+/**
+ * Parse byte `size` string.
+ *
+ * @param {String} size
+ * @return {Number}
+ * @api public
+ */
+
+module.exports = function(size) {
+ if ('number' == typeof size) return convert(size);
+ var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/)
+ , n = parseFloat(parts[1])
+ , type = parts[2];
+
+ var map = {
+ kb: 1 << 10
+ , mb: 1 << 20
+ , gb: 1 << 30
+ };
+
+ return map[type] * n;
+};
+
+/**
+ * convert bytes into string.
+ *
+ * @param {Number} b - bytes to convert
+ * @return {String}
+ * @api public
+ */
+
+function convert (b) {
+ var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10;
+ if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
+ if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb';
+ if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb';
+ return b + 'b';
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/node_modules/express/node_modules/connect/node_modules/bytes/package.json
new file mode 100644
index 0000000..2f10433
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "bytes",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "description": "byte size string parser / serializer",
+ "version": "0.2.0",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "readme": "# node-bytes\n\n Byte string parser / formatter.\n\n## Example:\n\n```js\nbytes('1kb')\n// => 1024\n\nbytes('2mb')\n// => 2097152\n\nbytes('1gb')\n// => 1073741824\n\nbytes(1073741824)\n// => 1gb\n```\n\n## Installation\n\n```\n$ npm install bytes\n$ component install visionmedia/bytes.js\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "Readme.md",
+ "_id": "bytes@0.2.0",
+ "dist": {
+ "shasum": "6455d77a156ca2aa32c3319bf9139cbcf45c892a"
+ },
+ "_from": "bytes@0.2.0",
+ "_resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
new file mode 100644
index 0000000..4fbabb3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
@@ -0,0 +1,4 @@
+/test/tmp/
+*.upload
+*.un~
+*.http
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
new file mode 100644
index 0000000..cb931cb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.8
+ - 0.9
+ - "0.10"
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE b/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE
new file mode 100644
index 0000000..38d3c9c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE
@@ -0,0 +1,7 @@
+Copyright (C) 2011 Felix Geisendörfer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
new file mode 100644
index 0000000..08e9eca
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
@@ -0,0 +1,419 @@
+# Formidable
+
+[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)
+
+## Purpose
+
+A node.js module for parsing form data, especially file uploads.
+
+## Current status
+
+This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading
+and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from
+a large variety of clients and is considered production-ready.
+
+## Features
+
+* Fast (~500mb/sec), non-buffering multipart parser
+* Automatically writing file uploads to disk
+* Low memory footprint
+* Graceful error handling
+* Very high test coverage
+
+## Installation
+
+Via [npm](http://github.com/isaacs/npm):
+```
+npm install formidable@latest
+```
+Manually:
+```
+git clone git://github.com/felixge/node-formidable.git formidable
+vim my.js
+# var formidable = require('./formidable');
+```
+
+Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.
+
+## Example
+
+Parse an incoming file upload.
+```javascript
+var formidable = require('formidable'),
+ http = require('http'),
+ util = require('util');
+
+http.createServer(function(req, res) {
+ if (req.url == '/upload' && req.method.toLowerCase() == 'post') {
+ // parse a file upload
+ var form = new formidable.IncomingForm();
+
+ form.parse(req, function(err, fields, files) {
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.write('received upload:\n\n');
+ res.end(util.inspect({fields: fields, files: files}));
+ });
+
+ return;
+ }
+
+ // show a file upload form
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ '<form action="/upload" enctype="multipart/form-data" method="post">'+
+ '<input type="text" name="title"><br>'+
+ '<input type="file" name="upload" multiple="multiple"><br>'+
+ '<input type="submit" value="Upload">'+
+ '</form>'
+ );
+}).listen(8080);
+```
+## API
+
+### Formidable.IncomingForm
+```javascript
+var form = new formidable.IncomingForm()
+```
+Creates a new incoming form.
+
+```javascript
+form.encoding = 'utf-8';
+```
+Sets encoding for incoming form fields.
+
+```javascript
+form.uploadDir = process.env.TMP || process.env.TMPDIR || process.env.TEMP || '/tmp' || process.cwd();
+```
+The directory for placing file uploads in. You can move them later on using
+`fs.rename()`. The default directory is picked at module load time depending on
+the first existing directory from those listed above.
+
+```javascript
+form.keepExtensions = false;
+```
+If you want the files written to `form.uploadDir` to include the extensions of the original files, set this property to `true`.
+
+```javascript
+form.type
+```
+Either 'multipart' or 'urlencoded' depending on the incoming request.
+
+```javascript
+form.maxFieldsSize = 2 * 1024 * 1024;
+```
+Limits the amount of memory a field (not file) can allocate in bytes.
+If this value is exceeded, an `'error'` event is emitted. The default
+size is 2MB.
+
+```javascript
+form.maxFields = 0;
+```
+Limits the number of fields that the querystring parser will decode. Defaults
+to 0 (unlimited).
+
+```javascript
+form.hash = false;
+```
+If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.
+
+```javascript
+form.bytesReceived
+```
+The amount of bytes received for this form so far.
+
+```javascript
+form.bytesExpected
+```
+The expected number of bytes in this form.
+
+```javascript
+form.parse(request, [cb]);
+```
+Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:
+
+
+```javascript
+form.parse(req, function(err, fields, files) {
+ // ...
+});
+
+form.onPart(part);
+```
+You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.
+
+```javascript
+form.onPart = function(part) {
+ part.addListener('data', function() {
+ // ...
+ });
+}
+```
+If you want to use formidable to only handle certain parts for you, you can do so:
+```javascript
+form.onPart = function(part) {
+ if (!part.filename) {
+ // let formidable handle all non-file parts
+ form.handlePart(part);
+ }
+}
+```
+Check the code in this method for further inspiration.
+
+
+### Formidable.File
+```javascript
+file.size = 0
+```
+The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.
+```javascript
+file.path = null
+```
+The path this file is being written to. You can modify this in the `'fileBegin'` event in
+case you are unhappy with the way formidable generates a temporary path for your files.
+```javascript
+file.name = null
+```
+The name this file had according to the uploading client.
+```javascript
+file.type = null
+```
+The mime type of this file, according to the uploading client.
+```javascript
+file.lastModifiedDate = null
+```
+A date object (or `null`) containing the time this file was last written to. Mostly
+here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).
+```javascript
+file.hash = null
+```
+If hash calculation was set, you can read the hex digest out of this var.
+
+#### Formidable.File#toJSON()
+
+ This method returns a JSON-representation of the file, allowing you to
+ `JSON.stringify()` the file which is useful for logging and responding
+ to requests.
+
+### Events
+
+
+#### 'progress'
+```javascript
+form.on('progress', function(bytesReceived, bytesExpected) {
+});
+```
+Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.
+
+
+
+#### 'field'
+```javascript
+form.on('field', function(name, value) {
+});
+```
+
+#### 'fileBegin'
+
+Emitted whenever a field / value pair has been received.
+```javascript
+form.on('fileBegin', function(name, file) {
+});
+```
+
+#### 'file'
+
+Emitted whenever a new file is detected in the upload stream. Use this even if
+you want to stream the file to somewhere else while buffering the upload on
+the file system.
+
+Emitted whenever a field / file pair has been received. `file` is an instance of `File`.
+```javascript
+form.on('file', function(name, file) {
+});
+```
+
+#### 'error'
+
+Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.
+```javascript
+form.on('error', function(err) {
+});
+```
+
+#### 'aborted'
+
+
+Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).
+```javascript
+form.on('aborted', function() {
+});
+```
+
+##### 'end'
+```javascript
+form.on('end', function() {
+});
+```
+Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
+
+
+
+## Changelog
+
+### v1.0.14
+
+* Add failing hash tests. (Ben Trask)
+* Enable hash calculation again (Eugene Girshov)
+* Test for immediate data events (Tim Smart)
+* Re-arrange IncomingForm#parse (Tim Smart)
+
+### v1.0.13
+
+* Only update hash if update method exists (Sven Lito)
+* According to travis v0.10 needs to go quoted (Sven Lito)
+* Bumping build node versions (Sven Lito)
+* Additional fix for empty requests (Eugene Girshov)
+* Change the default to 1000, to match the new Node behaviour. (OrangeDog)
+* Add ability to control maxKeys in the querystring parser. (OrangeDog)
+* Adjust test case to work with node 0.9.x (Eugene Girshov)
+* Update package.json (Sven Lito)
+* Path adjustment according to eb4468b (Markus Ast)
+
+### v1.0.12
+
+* Emit error on aborted connections (Eugene Girshov)
+* Add support for empty requests (Eugene Girshov)
+* Fix name/filename handling in Content-Disposition (jesperp)
+* Tolerate malformed closing boundary in multipart (Eugene Girshov)
+* Ignore preamble in multipart messages (Eugene Girshov)
+* Add support for application/json (Mike Frey, Carlos Rodriguez)
+* Add support for Base64 encoding (Elmer Bulthuis)
+* Add File#toJSON (TJ Holowaychuk)
+* Remove support for Node.js 0.4 & 0.6 (Andrew Kelley)
+* Documentation improvements (Sven Lito, Andre Azevedo)
+* Add support for application/octet-stream (Ion Lupascu, Chris Scribner)
+* Use os.tmpDir() to get tmp directory (Andrew Kelley)
+* Improve package.json (Andrew Kelley, Sven Lito)
+* Fix benchmark script (Andrew Kelley)
+* Fix scope issue in incoming_forms (Sven Lito)
+* Fix file handle leak on error (OrangeDog)
+
+### v1.0.11
+
+* Calculate checksums for incoming files (sreuter)
+* Add definition parameters to "IncomingForm" as an argument (Math-)
+
+### v1.0.10
+
+* Make parts to be proper Streams (Matt Robenolt)
+
+### v1.0.9
+
+* Emit progress when content length header parsed (Tim Koschützki)
+* Fix Readme syntax due to GitHub changes (goob)
+* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)
+
+### v1.0.8
+
+* Strip potentially unsafe characters when using `keepExtensions: true`.
+* Switch to utest / urun for testing
+* Add travis build
+
+### v1.0.7
+
+* Remove file from package that was causing problems when installing on windows. (#102)
+* Fix typos in Readme (Jason Davies).
+
+### v1.0.6
+
+* Do not default to the default to the field name for file uploads where
+ filename="".
+
+### v1.0.5
+
+* Support filename="" in multipart parts
+* Explain unexpected end() errors in parser better
+
+**Note:** Starting with this version, formidable emits 'file' events for empty
+file input fields. Previously those were incorrectly emitted as regular file
+input fields with value = "".
+
+### v1.0.4
+
+* Detect a good default tmp directory regardless of platform. (#88)
+
+### v1.0.3
+
+* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)
+* Small performance improvements
+* New test suite and fixture system
+
+### v1.0.2
+
+* Exclude node\_modules folder from git
+* Implement new `'aborted'` event
+* Fix files in example folder to work with recent node versions
+* Make gently a devDependency
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
+
+### v1.0.1
+
+* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
+
+### v1.0.0
+
+* Add support for multipart boundaries that are quoted strings. (Jeff Craig)
+
+This marks the beginning of development on version 2.0 which will include
+several architectural improvements.
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)
+
+### v0.9.11
+
+* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)
+* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class
+
+**Important:** The old property names of the File class will be removed in a
+future release.
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)
+
+### Older releases
+
+These releases were done before starting to maintain the above Changelog:
+
+* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)
+* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)
+* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)
+* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)
+* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)
+* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)
+* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)
+* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)
+* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)
+* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)
+
+## License
+
+Formidable is licensed under the MIT license.
+
+## Ports
+
+* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable
+
+## Credits
+
+* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
new file mode 100644
index 0000000..49abc43
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
@@ -0,0 +1,71 @@
+var assert = require('assert');
+require('../test/common');
+var multipartParser = require('../lib/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ parser = new MultipartParser(),
+ Buffer = require('buffer').Buffer,
+ boundary = '-----------------------------168072824752491622650073',
+ mb = 100,
+ buffer = createMultipartBuffer(boundary, mb * 1024 * 1024),
+ callbacks =
+ { partBegin: -1,
+ partEnd: -1,
+ headerField: -1,
+ headerValue: -1,
+ partData: -1,
+ end: -1,
+ };
+
+
+parser.initWithBoundary(boundary);
+parser.onHeaderField = function() {
+ callbacks.headerField++;
+};
+
+parser.onHeaderValue = function() {
+ callbacks.headerValue++;
+};
+
+parser.onPartBegin = function() {
+ callbacks.partBegin++;
+};
+
+parser.onPartData = function() {
+ callbacks.partData++;
+};
+
+parser.onPartEnd = function() {
+ callbacks.partEnd++;
+};
+
+parser.onEnd = function() {
+ callbacks.end++;
+};
+
+var start = +new Date(),
+ nparsed = parser.write(buffer),
+ duration = +new Date - start,
+ mbPerSec = (mb / (duration / 1000)).toFixed(2);
+
+console.log(mbPerSec+' mb/sec');
+
+assert.equal(nparsed, buffer.length);
+
+function createMultipartBuffer(boundary, size) {
+ var head =
+ '--'+boundary+'\r\n'
+ + 'content-disposition: form-data; name="field1"\r\n'
+ + '\r\n'
+ , tail = '\r\n--'+boundary+'--\r\n'
+ , buffer = new Buffer(size);
+
+ buffer.write(head, 'ascii', 0);
+ buffer.write(tail, 'ascii', buffer.length - tail.length);
+ return buffer;
+}
+
+process.on('exit', function() {
+ for (var k in callbacks) {
+ assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]);
+ }
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
new file mode 100644
index 0000000..eb8a724
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
@@ -0,0 +1,67 @@
+var common = require('../test/common'),
+ http = require('http'),
+ util = require('util'),
+ formidable = common.formidable,
+ Buffer = require('buffer').Buffer,
+ port = common.port,
+ server;
+
+server = http.createServer(function(req, res) {
+ if (req.method !== 'POST') {
+ res.writeHead(200, {'content-type': 'text/plain'})
+ res.end('Please POST a JSON payload to http://localhost:'+port+'/')
+ return;
+ }
+
+ var form = new formidable.IncomingForm(),
+ fields = {};
+
+ form
+ .on('error', function(err) {
+ res.writeHead(500, {'content-type': 'text/plain'});
+ res.end('error:\n\n'+util.inspect(err));
+ console.error(err);
+ })
+ .on('field', function(field, value) {
+ console.log(field, value);
+ fields[field] = value;
+ })
+ .on('end', function() {
+ console.log('-> post done');
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.end('received fields:\n\n '+util.inspect(fields));
+ });
+ form.parse(req);
+});
+server.listen(port);
+
+console.log('listening on http://localhost:'+port+'/');
+
+
+var request = http.request({
+ host: 'localhost',
+ path: '/',
+ port: port,
+ method: 'POST',
+ headers: { 'content-type':'application/json', 'content-length':48 }
+}, function(response) {
+ var data = '';
+ console.log('\nServer responded with:');
+ console.log('Status:', response.statusCode);
+ response.pipe(process.stdout);
+ response.on('end', function() {
+ console.log('\n')
+ process.exit();
+ });
+ // response.on('data', function(chunk) {
+ // data += chunk.toString('utf8');
+ // });
+ // response.on('end', function() {
+ // console.log('Response Data:')
+ // console.log(data);
+ // process.exit();
+ // });
+})
+
+request.write('{"numbers":[1,2,3,4,5],"nested":{"key":"value"}}');
+request.end();
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
new file mode 100644
index 0000000..f6c15a6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
@@ -0,0 +1,43 @@
+require('../test/common');
+var http = require('http'),
+ util = require('util'),
+ formidable = require('formidable'),
+ server;
+
+server = http.createServer(function(req, res) {
+ if (req.url == '/') {
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ '<form action="/post" method="post">'+
+ '<input type="text" name="title"><br>'+
+ '<input type="text" name="data[foo][]"><br>'+
+ '<input type="submit" value="Submit">'+
+ '</form>'
+ );
+ } else if (req.url == '/post') {
+ var form = new formidable.IncomingForm(),
+ fields = [];
+
+ form
+ .on('error', function(err) {
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.end('error:\n\n'+util.inspect(err));
+ })
+ .on('field', function(field, value) {
+ console.log(field, value);
+ fields.push([field, value]);
+ })
+ .on('end', function() {
+ console.log('-> post done');
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.end('received fields:\n\n '+util.inspect(fields));
+ });
+ form.parse(req);
+ } else {
+ res.writeHead(404, {'content-type': 'text/plain'});
+ res.end('404');
+ }
+});
+server.listen(TEST_PORT);
+
+console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
new file mode 100644
index 0000000..050cdd9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
@@ -0,0 +1,48 @@
+require('../test/common');
+var http = require('http'),
+ util = require('util'),
+ formidable = require('formidable'),
+ server;
+
+server = http.createServer(function(req, res) {
+ if (req.url == '/') {
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ '<form action="/upload" enctype="multipart/form-data" method="post">'+
+ '<input type="text" name="title"><br>'+
+ '<input type="file" name="upload" multiple="multiple"><br>'+
+ '<input type="submit" value="Upload">'+
+ '</form>'
+ );
+ } else if (req.url == '/upload') {
+ var form = new formidable.IncomingForm(),
+ files = [],
+ fields = [];
+
+ form.uploadDir = TEST_TMP;
+
+ form
+ .on('field', function(field, value) {
+ console.log(field, value);
+ fields.push([field, value]);
+ })
+ .on('file', function(field, file) {
+ console.log(field, file);
+ files.push([field, file]);
+ })
+ .on('end', function() {
+ console.log('-> upload done');
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.write('received fields:\n\n '+util.inspect(fields));
+ res.write('\n\n');
+ res.end('received files:\n\n '+util.inspect(files));
+ });
+ form.parse(req);
+ } else {
+ res.writeHead(404, {'content-type': 'text/plain'});
+ res.end('404');
+ }
+});
+server.listen(TEST_PORT);
+
+console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/index.js
new file mode 100644
index 0000000..4cc88b3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib'); \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
new file mode 100644
index 0000000..e34c10e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
@@ -0,0 +1,72 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var util = require('util'),
+ WriteStream = require('fs').WriteStream,
+ EventEmitter = require('events').EventEmitter,
+ crypto = require('crypto');
+
+function File(properties) {
+ EventEmitter.call(this);
+
+ this.size = 0;
+ this.path = null;
+ this.name = null;
+ this.type = null;
+ this.hash = null;
+ this.lastModifiedDate = null;
+
+ this._writeStream = null;
+
+ for (var key in properties) {
+ this[key] = properties[key];
+ }
+
+ if(typeof this.hash === 'string') {
+ this.hash = crypto.createHash(properties.hash);
+ } else {
+ this.hash = null;
+ }
+}
+module.exports = File;
+util.inherits(File, EventEmitter);
+
+File.prototype.open = function() {
+ this._writeStream = new WriteStream(this.path);
+};
+
+File.prototype.toJSON = function() {
+ return {
+ size: this.size,
+ path: this.path,
+ name: this.name,
+ type: this.type,
+ mtime: this.lastModifiedDate,
+ length: this.length,
+ filename: this.filename,
+ mime: this.mime
+ };
+};
+
+File.prototype.write = function(buffer, cb) {
+ var self = this;
+ if (self.hash) {
+ self.hash.update(buffer);
+ }
+ this._writeStream.write(buffer, function() {
+ self.lastModifiedDate = new Date();
+ self.size += buffer.length;
+ self.emit('progress', self.size);
+ cb();
+ });
+};
+
+File.prototype.end = function(cb) {
+ var self = this;
+ if (self.hash) {
+ self.hash = self.hash.digest('hex');
+ }
+ this._writeStream.end(function() {
+ self.emit('end');
+ cb();
+ });
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
new file mode 100644
index 0000000..c2eeaf8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
@@ -0,0 +1,535 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var fs = require('fs');
+var util = require('util'),
+ path = require('path'),
+ File = require('./file'),
+ MultipartParser = require('./multipart_parser').MultipartParser,
+ QuerystringParser = require('./querystring_parser').QuerystringParser,
+ OctetParser = require('./octet_parser').OctetParser,
+ JSONParser = require('./json_parser').JSONParser,
+ StringDecoder = require('string_decoder').StringDecoder,
+ EventEmitter = require('events').EventEmitter,
+ Stream = require('stream').Stream,
+ os = require('os');
+
+function IncomingForm(opts) {
+ if (!(this instanceof IncomingForm)) return new IncomingForm(opts);
+ EventEmitter.call(this);
+
+ opts=opts||{};
+
+ this.error = null;
+ this.ended = false;
+
+ this.maxFields = opts.maxFields || 1000;
+ this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
+ this.keepExtensions = opts.keepExtensions || false;
+ this.uploadDir = opts.uploadDir || os.tmpDir();
+ this.encoding = opts.encoding || 'utf-8';
+ this.headers = null;
+ this.type = null;
+ this.hash = false;
+
+ this.bytesReceived = null;
+ this.bytesExpected = null;
+
+ this._parser = null;
+ this._flushing = 0;
+ this._fieldsSize = 0;
+ this.openedFiles = [];
+
+ return this;
+};
+util.inherits(IncomingForm, EventEmitter);
+exports.IncomingForm = IncomingForm;
+
+IncomingForm.prototype.parse = function(req, cb) {
+ this.pause = function() {
+ try {
+ req.pause();
+ } catch (err) {
+ // the stream was destroyed
+ if (!this.ended) {
+ // before it was completed, crash & burn
+ this._error(err);
+ }
+ return false;
+ }
+ return true;
+ };
+
+ this.resume = function() {
+ try {
+ req.resume();
+ } catch (err) {
+ // the stream was destroyed
+ if (!this.ended) {
+ // before it was completed, crash & burn
+ this._error(err);
+ }
+ return false;
+ }
+
+ return true;
+ };
+
+ // Setup callback first, so we don't miss anything from data events emitted
+ // immediately.
+ if (cb) {
+ var fields = {}, files = {};
+ this
+ .on('field', function(name, value) {
+ fields[name] = value;
+ })
+ .on('file', function(name, file) {
+ files[name] = file;
+ })
+ .on('error', function(err) {
+ cb(err, fields, files);
+ })
+ .on('end', function() {
+ cb(null, fields, files);
+ });
+ }
+
+ // Parse headers and setup the parser, ready to start listening for data.
+ this.writeHeaders(req.headers);
+
+ // Start listening for data.
+ var self = this;
+ req
+ .on('error', function(err) {
+ self._error(err);
+ })
+ .on('aborted', function() {
+ self.emit('aborted');
+ self._error(new Error('Request aborted'));
+ })
+ .on('data', function(buffer) {
+ self.write(buffer);
+ })
+ .on('end', function() {
+ if (self.error) {
+ return;
+ }
+
+ var err = self._parser.end();
+ if (err) {
+ self._error(err);
+ }
+ });
+
+ return this;
+};
+
+IncomingForm.prototype.writeHeaders = function(headers) {
+ this.headers = headers;
+ this._parseContentLength();
+ this._parseContentType();
+};
+
+IncomingForm.prototype.write = function(buffer) {
+ if (!this._parser) {
+ this._error(new Error('unintialized parser'));
+ return;
+ }
+
+ this.bytesReceived += buffer.length;
+ this.emit('progress', this.bytesReceived, this.bytesExpected);
+
+ var bytesParsed = this._parser.write(buffer);
+ if (bytesParsed !== buffer.length) {
+ this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed'));
+ }
+
+ return bytesParsed;
+};
+
+IncomingForm.prototype.pause = function() {
+ // this does nothing, unless overwritten in IncomingForm.parse
+ return false;
+};
+
+IncomingForm.prototype.resume = function() {
+ // this does nothing, unless overwritten in IncomingForm.parse
+ return false;
+};
+
+IncomingForm.prototype.onPart = function(part) {
+ // this method can be overwritten by the user
+ this.handlePart(part);
+};
+
+IncomingForm.prototype.handlePart = function(part) {
+ var self = this;
+
+ if (part.filename === undefined) {
+ var value = ''
+ , decoder = new StringDecoder(this.encoding);
+
+ part.on('data', function(buffer) {
+ self._fieldsSize += buffer.length;
+ if (self._fieldsSize > self.maxFieldsSize) {
+ self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
+ return;
+ }
+ value += decoder.write(buffer);
+ });
+
+ part.on('end', function() {
+ self.emit('field', part.name, value);
+ });
+ return;
+ }
+
+ this._flushing++;
+
+ var file = new File({
+ path: this._uploadPath(part.filename),
+ name: part.filename,
+ type: part.mime,
+ hash: self.hash
+ });
+
+ this.emit('fileBegin', part.name, file);
+
+ file.open();
+ this.openedFiles.push(file);
+
+ part.on('data', function(buffer) {
+ self.pause();
+ file.write(buffer, function() {
+ self.resume();
+ });
+ });
+
+ part.on('end', function() {
+ file.end(function() {
+ self._flushing--;
+ self.emit('file', part.name, file);
+ self._maybeEnd();
+ });
+ });
+};
+
+function dummyParser(self) {
+ return {
+ end: function () {
+ self.ended = true;
+ self._maybeEnd();
+ return null;
+ }
+ };
+}
+
+IncomingForm.prototype._parseContentType = function() {
+ if (this.bytesExpected === 0) {
+ this._parser = dummyParser(this);
+ return;
+ }
+
+ if (!this.headers['content-type']) {
+ this._error(new Error('bad content-type header, no content-type'));
+ return;
+ }
+
+ if (this.headers['content-type'].match(/octet-stream/i)) {
+ this._initOctetStream();
+ return;
+ }
+
+ if (this.headers['content-type'].match(/urlencoded/i)) {
+ this._initUrlencoded();
+ return;
+ }
+
+ if (this.headers['content-type'].match(/multipart/i)) {
+ var m;
+ if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) {
+ this._initMultipart(m[1] || m[2]);
+ } else {
+ this._error(new Error('bad content-type header, no multipart boundary'));
+ }
+ return;
+ }
+
+ if (this.headers['content-type'].match(/json/i)) {
+ this._initJSONencoded();
+ return;
+ }
+
+ this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
+};
+
+IncomingForm.prototype._error = function(err) {
+ if (this.error || this.ended) {
+ return;
+ }
+
+ this.error = err;
+ this.pause();
+ this.emit('error', err);
+
+ if (Array.isArray(this.openedFiles)) {
+ this.openedFiles.forEach(function(file) {
+ file._writeStream.destroy();
+ setTimeout(fs.unlink, 0, file.path);
+ });
+ }
+};
+
+IncomingForm.prototype._parseContentLength = function() {
+ this.bytesReceived = 0;
+ if (this.headers['content-length']) {
+ this.bytesExpected = parseInt(this.headers['content-length'], 10);
+ } else if (this.headers['transfer-encoding'] === undefined) {
+ this.bytesExpected = 0;
+ }
+
+ if (this.bytesExpected !== null) {
+ this.emit('progress', this.bytesReceived, this.bytesExpected);
+ }
+};
+
+IncomingForm.prototype._newParser = function() {
+ return new MultipartParser();
+};
+
+IncomingForm.prototype._initMultipart = function(boundary) {
+ this.type = 'multipart';
+
+ var parser = new MultipartParser(),
+ self = this,
+ headerField,
+ headerValue,
+ part;
+
+ parser.initWithBoundary(boundary);
+
+ parser.onPartBegin = function() {
+ part = new Stream();
+ part.readable = true;
+ part.headers = {};
+ part.name = null;
+ part.filename = null;
+ part.mime = null;
+
+ part.transferEncoding = 'binary';
+ part.transferBuffer = '';
+
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeaderField = function(b, start, end) {
+ headerField += b.toString(self.encoding, start, end);
+ };
+
+ parser.onHeaderValue = function(b, start, end) {
+ headerValue += b.toString(self.encoding, start, end);
+ };
+
+ parser.onHeaderEnd = function() {
+ headerField = headerField.toLowerCase();
+ part.headers[headerField] = headerValue;
+
+ var m;
+ if (headerField == 'content-disposition') {
+ if (m = headerValue.match(/\bname="([^"]+)"/i)) {
+ part.name = m[1];
+ }
+
+ part.filename = self._fileName(headerValue);
+ } else if (headerField == 'content-type') {
+ part.mime = headerValue;
+ } else if (headerField == 'content-transfer-encoding') {
+ part.transferEncoding = headerValue.toLowerCase();
+ }
+
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeadersEnd = function() {
+ switch(part.transferEncoding){
+ case 'binary':
+ case '7bit':
+ case '8bit':
+ parser.onPartData = function(b, start, end) {
+ part.emit('data', b.slice(start, end));
+ };
+
+ parser.onPartEnd = function() {
+ part.emit('end');
+ };
+ break;
+
+ case 'base64':
+ parser.onPartData = function(b, start, end) {
+ part.transferBuffer += b.slice(start, end).toString('ascii');
+
+ /*
+ four bytes (chars) in base64 converts to three bytes in binary
+ encoding. So we should always work with a number of bytes that
+ can be divided by 4, it will result in a number of buytes that
+ can be divided vy 3.
+ */
+ var offset = parseInt(part.transferBuffer.length / 4) * 4;
+ part.emit('data', new Buffer(part.transferBuffer.substring(0, offset), 'base64'))
+ part.transferBuffer = part.transferBuffer.substring(offset);
+ };
+
+ parser.onPartEnd = function() {
+ part.emit('data', new Buffer(part.transferBuffer, 'base64'))
+ part.emit('end');
+ };
+ break;
+
+ default:
+ return self._error(new Error('unknown transfer-encoding'));
+ }
+
+ self.onPart(part);
+ };
+
+
+ parser.onEnd = function() {
+ self.ended = true;
+ self._maybeEnd();
+ };
+
+ this._parser = parser;
+};
+
+IncomingForm.prototype._fileName = function(headerValue) {
+ var m = headerValue.match(/\bfilename="(.*?)"($|; )/i);
+ if (!m) return;
+
+ var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
+ filename = filename.replace(/%22/g, '"');
+ filename = filename.replace(/&#([\d]{4});/g, function(m, code) {
+ return String.fromCharCode(code);
+ });
+ return filename;
+};
+
+IncomingForm.prototype._initUrlencoded = function() {
+ this.type = 'urlencoded';
+
+ var parser = new QuerystringParser(this.maxFields)
+ , self = this;
+
+ parser.onField = function(key, val) {
+ self.emit('field', key, val);
+ };
+
+ parser.onEnd = function() {
+ self.ended = true;
+ self._maybeEnd();
+ };
+
+ this._parser = parser;
+};
+
+IncomingForm.prototype._initOctetStream = function() {
+ this.type = 'octet-stream';
+ var filename = this.headers['x-file-name'];
+ var mime = this.headers['content-type'];
+
+ var file = new File({
+ path: this._uploadPath(filename),
+ name: filename,
+ type: mime
+ });
+
+ file.open();
+
+ this.emit('fileBegin', filename, file);
+
+ this._flushing++;
+
+ var self = this;
+
+ self._parser = new OctetParser();
+
+ //Keep track of writes that haven't finished so we don't emit the file before it's done being written
+ var outstandingWrites = 0;
+
+ self._parser.on('data', function(buffer){
+ self.pause();
+ outstandingWrites++;
+
+ file.write(buffer, function() {
+ outstandingWrites--;
+ self.resume();
+
+ if(self.ended){
+ self._parser.emit('doneWritingFile');
+ }
+ });
+ });
+
+ self._parser.on('end', function(){
+ self._flushing--;
+ self.ended = true;
+
+ var done = function(){
+ self.emit('file', 'file', file);
+ self._maybeEnd();
+ };
+
+ if(outstandingWrites === 0){
+ done();
+ } else {
+ self._parser.once('doneWritingFile', done);
+ }
+ });
+};
+
+IncomingForm.prototype._initJSONencoded = function() {
+ this.type = 'json';
+
+ var parser = new JSONParser()
+ , self = this;
+
+ if (this.bytesExpected) {
+ parser.initWithLength(this.bytesExpected);
+ }
+
+ parser.onField = function(key, val) {
+ self.emit('field', key, val);
+ }
+
+ parser.onEnd = function() {
+ self.ended = true;
+ self._maybeEnd();
+ };
+
+ this._parser = parser;
+};
+
+IncomingForm.prototype._uploadPath = function(filename) {
+ var name = '';
+ for (var i = 0; i < 32; i++) {
+ name += Math.floor(Math.random() * 16).toString(16);
+ }
+
+ if (this.keepExtensions) {
+ var ext = path.extname(filename);
+ ext = ext.replace(/(\.[a-z0-9]+).*/, '$1');
+
+ name += ext;
+ }
+
+ return path.join(this.uploadDir, name);
+};
+
+IncomingForm.prototype._maybeEnd = function() {
+ if (!this.ended || this._flushing || this.error) {
+ return;
+ }
+
+ this.emit('end');
+};
+
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
new file mode 100644
index 0000000..7a6e3e1
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
@@ -0,0 +1,3 @@
+var IncomingForm = require('./incoming_form').IncomingForm;
+IncomingForm.IncomingForm = IncomingForm;
+module.exports = IncomingForm;
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
new file mode 100644
index 0000000..6ce966b
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
@@ -0,0 +1,35 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var Buffer = require('buffer').Buffer
+
+function JSONParser() {
+ this.data = new Buffer('');
+ this.bytesWritten = 0;
+};
+exports.JSONParser = JSONParser;
+
+JSONParser.prototype.initWithLength = function(length) {
+ this.data = new Buffer(length);
+}
+
+JSONParser.prototype.write = function(buffer) {
+ if (this.data.length >= this.bytesWritten + buffer.length) {
+ buffer.copy(this.data, this.bytesWritten);
+ } else {
+ this.data = Buffer.concat([this.data, buffer]);
+ }
+ this.bytesWritten += buffer.length;
+ return buffer.length;
+}
+
+JSONParser.prototype.end = function() {
+ try {
+ var fields = JSON.parse(this.data.toString('utf8'))
+ for (var field in fields) {
+ this.onField(field, fields[field]);
+ }
+ } catch (e) {}
+ this.data = null;
+
+ this.onEnd();
+} \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
new file mode 100644
index 0000000..98a6856
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
@@ -0,0 +1,324 @@
+var Buffer = require('buffer').Buffer,
+ s = 0,
+ S =
+ { PARSER_UNINITIALIZED: s++,
+ START: s++,
+ START_BOUNDARY: s++,
+ HEADER_FIELD_START: s++,
+ HEADER_FIELD: s++,
+ HEADER_VALUE_START: s++,
+ HEADER_VALUE: s++,
+ HEADER_VALUE_ALMOST_DONE: s++,
+ HEADERS_ALMOST_DONE: s++,
+ PART_DATA_START: s++,
+ PART_DATA: s++,
+ PART_END: s++,
+ END: s++
+ },
+
+ f = 1,
+ F =
+ { PART_BOUNDARY: f,
+ LAST_BOUNDARY: f *= 2
+ },
+
+ LF = 10,
+ CR = 13,
+ SPACE = 32,
+ HYPHEN = 45,
+ COLON = 58,
+ A = 97,
+ Z = 122,
+
+ lower = function(c) {
+ return c | 0x20;
+ };
+
+for (s in S) {
+ exports[s] = S[s];
+}
+
+function MultipartParser() {
+ this.boundary = null;
+ this.boundaryChars = null;
+ this.lookbehind = null;
+ this.state = S.PARSER_UNINITIALIZED;
+
+ this.index = null;
+ this.flags = 0;
+};
+exports.MultipartParser = MultipartParser;
+
+MultipartParser.stateToString = function(stateNumber) {
+ for (var state in S) {
+ var number = S[state];
+ if (number === stateNumber) return state;
+ }
+};
+
+MultipartParser.prototype.initWithBoundary = function(str) {
+ this.boundary = new Buffer(str.length+4);
+ this.boundary.write('\r\n--', 'ascii', 0);
+ this.boundary.write(str, 'ascii', 4);
+ this.lookbehind = new Buffer(this.boundary.length+8);
+ this.state = S.START;
+
+ this.boundaryChars = {};
+ for (var i = 0; i < this.boundary.length; i++) {
+ this.boundaryChars[this.boundary[i]] = true;
+ }
+};
+
+MultipartParser.prototype.write = function(buffer) {
+ var self = this,
+ i = 0,
+ len = buffer.length,
+ prevIndex = this.index,
+ index = this.index,
+ state = this.state,
+ flags = this.flags,
+ lookbehind = this.lookbehind,
+ boundary = this.boundary,
+ boundaryChars = this.boundaryChars,
+ boundaryLength = this.boundary.length,
+ boundaryEnd = boundaryLength - 1,
+ bufferLength = buffer.length,
+ c,
+ cl,
+
+ mark = function(name) {
+ self[name+'Mark'] = i;
+ },
+ clear = function(name) {
+ delete self[name+'Mark'];
+ },
+ callback = function(name, buffer, start, end) {
+ if (start !== undefined && start === end) {
+ return;
+ }
+
+ var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
+ if (callbackSymbol in self) {
+ self[callbackSymbol](buffer, start, end);
+ }
+ },
+ dataCallback = function(name, clear) {
+ var markSymbol = name+'Mark';
+ if (!(markSymbol in self)) {
+ return;
+ }
+
+ if (!clear) {
+ callback(name, buffer, self[markSymbol], buffer.length);
+ self[markSymbol] = 0;
+ } else {
+ callback(name, buffer, self[markSymbol], i);
+ delete self[markSymbol];
+ }
+ };
+
+ for (i = 0; i < len; i++) {
+ c = buffer[i];
+ switch (state) {
+ case S.PARSER_UNINITIALIZED:
+ return i;
+ case S.START:
+ index = 0;
+ state = S.START_BOUNDARY;
+ case S.START_BOUNDARY:
+ if (index == boundary.length - 2) {
+ if (c != CR) {
+ return i;
+ }
+ index++;
+ break;
+ } else if (index - 1 == boundary.length - 2) {
+ if (c != LF) {
+ return i;
+ }
+ index = 0;
+ callback('partBegin');
+ state = S.HEADER_FIELD_START;
+ break;
+ }
+
+ if (c != boundary[index+2]) {
+ index = -2;
+ }
+ if (c == boundary[index+2]) {
+ index++;
+ }
+ break;
+ case S.HEADER_FIELD_START:
+ state = S.HEADER_FIELD;
+ mark('headerField');
+ index = 0;
+ case S.HEADER_FIELD:
+ if (c == CR) {
+ clear('headerField');
+ state = S.HEADERS_ALMOST_DONE;
+ break;
+ }
+
+ index++;
+ if (c == HYPHEN) {
+ break;
+ }
+
+ if (c == COLON) {
+ if (index == 1) {
+ // empty header field
+ return i;
+ }
+ dataCallback('headerField', true);
+ state = S.HEADER_VALUE_START;
+ break;
+ }
+
+ cl = lower(c);
+ if (cl < A || cl > Z) {
+ return i;
+ }
+ break;
+ case S.HEADER_VALUE_START:
+ if (c == SPACE) {
+ break;
+ }
+
+ mark('headerValue');
+ state = S.HEADER_VALUE;
+ case S.HEADER_VALUE:
+ if (c == CR) {
+ dataCallback('headerValue', true);
+ callback('headerEnd');
+ state = S.HEADER_VALUE_ALMOST_DONE;
+ }
+ break;
+ case S.HEADER_VALUE_ALMOST_DONE:
+ if (c != LF) {
+ return i;
+ }
+ state = S.HEADER_FIELD_START;
+ break;
+ case S.HEADERS_ALMOST_DONE:
+ if (c != LF) {
+ return i;
+ }
+
+ callback('headersEnd');
+ state = S.PART_DATA_START;
+ break;
+ case S.PART_DATA_START:
+ state = S.PART_DATA;
+ mark('partData');
+ case S.PART_DATA:
+ prevIndex = index;
+
+ if (index == 0) {
+ // boyer-moore derrived algorithm to safely skip non-boundary data
+ i += boundaryEnd;
+ while (i < bufferLength && !(buffer[i] in boundaryChars)) {
+ i += boundaryLength;
+ }
+ i -= boundaryEnd;
+ c = buffer[i];
+ }
+
+ if (index < boundary.length) {
+ if (boundary[index] == c) {
+ if (index == 0) {
+ dataCallback('partData', true);
+ }
+ index++;
+ } else {
+ index = 0;
+ }
+ } else if (index == boundary.length) {
+ index++;
+ if (c == CR) {
+ // CR = part boundary
+ flags |= F.PART_BOUNDARY;
+ } else if (c == HYPHEN) {
+ // HYPHEN = end boundary
+ flags |= F.LAST_BOUNDARY;
+ } else {
+ index = 0;
+ }
+ } else if (index - 1 == boundary.length) {
+ if (flags & F.PART_BOUNDARY) {
+ index = 0;
+ if (c == LF) {
+ // unset the PART_BOUNDARY flag
+ flags &= ~F.PART_BOUNDARY;
+ callback('partEnd');
+ callback('partBegin');
+ state = S.HEADER_FIELD_START;
+ break;
+ }
+ } else if (flags & F.LAST_BOUNDARY) {
+ if (c == HYPHEN) {
+ callback('partEnd');
+ callback('end');
+ state = S.END;
+ } else {
+ index = 0;
+ }
+ } else {
+ index = 0;
+ }
+ }
+
+ if (index > 0) {
+ // when matching a possible boundary, keep a lookbehind reference
+ // in case it turns out to be a false lead
+ lookbehind[index-1] = c;
+ } else if (prevIndex > 0) {
+ // if our boundary turned out to be rubbish, the captured lookbehind
+ // belongs to partData
+ callback('partData', lookbehind, 0, prevIndex);
+ prevIndex = 0;
+ mark('partData');
+
+ // reconsider the current character even so it interrupted the sequence
+ // it could be the beginning of a new sequence
+ i--;
+ }
+
+ break;
+ case S.END:
+ break;
+ default:
+ return i;
+ }
+ }
+
+ dataCallback('headerField');
+ dataCallback('headerValue');
+ dataCallback('partData');
+
+ this.index = index;
+ this.state = state;
+ this.flags = flags;
+
+ return len;
+};
+
+MultipartParser.prototype.end = function() {
+ var callback = function(self, name) {
+ var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
+ if (callbackSymbol in self) {
+ self[callbackSymbol]();
+ }
+ };
+ if ((this.state == S.HEADER_FIELD_START && this.index == 0) ||
+ (this.state == S.PART_DATA && this.index == this.boundary.length)) {
+ callback(this, 'partEnd');
+ callback(this, 'end');
+ } else if (this.state != S.END) {
+ return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
+ }
+};
+
+MultipartParser.prototype.explain = function() {
+ return 'state = ' + MultipartParser.stateToString(this.state);
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
new file mode 100644
index 0000000..6e8b551
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
@@ -0,0 +1,20 @@
+var EventEmitter = require('events').EventEmitter
+ , util = require('util');
+
+function OctetParser(options){
+ if(!(this instanceof OctetParser)) return new OctetParser(options);
+ EventEmitter.call(this);
+}
+
+util.inherits(OctetParser, EventEmitter);
+
+exports.OctetParser = OctetParser;
+
+OctetParser.prototype.write = function(buffer) {
+ this.emit('data', buffer);
+ return buffer.length;
+};
+
+OctetParser.prototype.end = function() {
+ this.emit('end');
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
new file mode 100644
index 0000000..320ce5a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
@@ -0,0 +1,27 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+// This is a buffering parser, not quite as nice as the multipart one.
+// If I find time I'll rewrite this to be fully streaming as well
+var querystring = require('querystring');
+
+function QuerystringParser(maxKeys) {
+ this.maxKeys = maxKeys;
+ this.buffer = '';
+};
+exports.QuerystringParser = QuerystringParser;
+
+QuerystringParser.prototype.write = function(buffer) {
+ this.buffer += buffer.toString('ascii');
+ return buffer.length;
+};
+
+QuerystringParser.prototype.end = function() {
+ var fields = querystring.parse(this.buffer, '&', '=', { maxKeys: this.maxKeys });
+ for (var field in fields) {
+ this.onField(field, fields[field]);
+ }
+ this.buffer = '';
+
+ this.onEnd();
+};
+
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/package.json
new file mode 100644
index 0000000..925a3de
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "formidable",
+ "description": "A node.js module for parsing form data, especially file uploads.",
+ "homepage": "https://github.com/felixge/node-formidable",
+ "version": "1.0.14",
+ "devDependencies": {
+ "gently": "0.8.0",
+ "findit": "0.1.1",
+ "hashish": "0.0.4",
+ "urun": "~0.0.6",
+ "utest": "0.0.3",
+ "request": "~2.11.4"
+ },
+ "directories": {
+ "lib": "./lib"
+ },
+ "main": "./lib/index",
+ "scripts": {
+ "test": "node test/run.js",
+ "clean": "rm test/tmp/*"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/felixge/node-formidable.git"
+ },
+ "bugs": {
+ "url": "http://github.com/felixge/node-formidable/issues"
+ },
+ "optionalDependencies": {},
+ "readme": "# Formidable\n\n[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)\n\n## Purpose\n\nA node.js module for parsing form data, especially file uploads.\n\n## Current status\n\nThis module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading\nand encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from\na large variety of clients and is considered production-ready.\n\n## Features\n\n* Fast (~500mb/sec), non-buffering multipart parser\n* Automatically writing file uploads to disk\n* Low memory footprint\n* Graceful error handling\n* Very high test coverage\n\n## Installation\n\nVia [npm](http://github.com/isaacs/npm):\n```\nnpm install formidable@latest\n```\nManually:\n```\ngit clone git://github.com/felixge/node-formidable.git formidable\nvim my.js\n# var formidable = require('./formidable');\n```\n\nNote: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.\n\n## Example\n\nParse an incoming file upload.\n```javascript\nvar formidable = require('formidable'),\n http = require('http'),\n util = require('util');\n\nhttp.createServer(function(req, res) {\n if (req.url == '/upload' && req.method.toLowerCase() == 'post') {\n // parse a file upload\n var form = new formidable.IncomingForm();\n\n form.parse(req, function(err, fields, files) {\n res.writeHead(200, {'content-type': 'text/plain'});\n res.write('received upload:\\n\\n');\n res.end(util.inspect({fields: fields, files: files}));\n });\n\n return;\n }\n\n // show a file upload form\n res.writeHead(200, {'content-type': 'text/html'});\n res.end(\n '<form action=\"/upload\" enctype=\"multipart/form-data\" method=\"post\">'+\n '<input type=\"text\" name=\"title\"><br>'+\n '<input type=\"file\" name=\"upload\" multiple=\"multiple\"><br>'+\n '<input type=\"submit\" value=\"Upload\">'+\n '</form>'\n );\n}).listen(8080);\n```\n## API\n\n### Formidable.IncomingForm\n```javascript\nvar form = new formidable.IncomingForm()\n```\nCreates a new incoming form.\n\n```javascript\nform.encoding = 'utf-8';\n```\nSets encoding for incoming form fields.\n\n```javascript\nform.uploadDir = process.env.TMP || process.env.TMPDIR || process.env.TEMP || '/tmp' || process.cwd();\n```\nThe directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default directory is picked at module load time depending on\nthe first existing directory from those listed above.\n\n```javascript\nform.keepExtensions = false;\n```\nIf you want the files written to `form.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n```javascript\nform.type\n```\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n```javascript\nform.maxFieldsSize = 2 * 1024 * 1024;\n```\nLimits the amount of memory a field (not file) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 2MB.\n\n```javascript\nform.maxFields = 0;\n```\nLimits the number of fields that the querystring parser will decode. Defaults\nto 0 (unlimited).\n\n```javascript\nform.hash = false;\n```\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n```javascript\nform.bytesReceived\n```\nThe amount of bytes received for this form so far.\n\n```javascript\nform.bytesExpected\n```\nThe expected number of bytes in this form.\n\n```javascript\nform.parse(request, [cb]);\n```\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:\n\n\n```javascript\nform.parse(req, function(err, fields, files) {\n // ...\n});\n\nform.onPart(part);\n```\nYou may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.\n\n```javascript\nform.onPart = function(part) {\n part.addListener('data', function() {\n // ...\n });\n}\n```\nIf you want to use formidable to only handle certain parts for you, you can do so:\n```javascript\nform.onPart = function(part) {\n if (!part.filename) {\n // let formidable handle all non-file parts\n form.handlePart(part);\n }\n}\n```\nCheck the code in this method for further inspiration.\n\n\n### Formidable.File\n```javascript\nfile.size = 0\n```\nThe size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.\n```javascript\nfile.path = null\n```\nThe path this file is being written to. You can modify this in the `'fileBegin'` event in\ncase you are unhappy with the way formidable generates a temporary path for your files.\n```javascript\nfile.name = null\n```\nThe name this file had according to the uploading client.\n```javascript\nfile.type = null\n```\nThe mime type of this file, according to the uploading client.\n```javascript\nfile.lastModifiedDate = null\n```\nA date object (or `null`) containing the time this file was last written to. Mostly\nhere for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).\n```javascript\nfile.hash = null\n```\nIf hash calculation was set, you can read the hex digest out of this var.\n\n#### Formidable.File#toJSON()\n\n This method returns a JSON-representation of the file, allowing you to\n `JSON.stringify()` the file which is useful for logging and responding\n to requests.\n\n### Events\n\n\n#### 'progress'\n```javascript\nform.on('progress', function(bytesReceived, bytesExpected) {\n});\n```\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n\n\n#### 'field'\n```javascript\nform.on('field', function(name, value) {\n});\n```\n\n#### 'fileBegin'\n\nEmitted whenever a field / value pair has been received.\n```javascript\nform.on('fileBegin', function(name, file) {\n});\n```\n\n#### 'file'\n\nEmitted whenever a new file is detected in the upload stream. Use this even if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n```javascript\nform.on('file', function(name, file) {\n});\n```\n\n#### 'error'\n\nEmitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.\n```javascript\nform.on('error', function(err) {\n});\n```\n\n#### 'aborted'\n\n\nEmitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).\n```javascript\nform.on('aborted', function() {\n});\n```\n\n##### 'end'\n```javascript\nform.on('end', function() {\n});\n```\nEmitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.\n\n\n\n## Changelog\n\n### v1.0.14\n\n* Add failing hash tests. (Ben Trask)\n* Enable hash calculation again (Eugene Girshov)\n* Test for immediate data events (Tim Smart)\n* Re-arrange IncomingForm#parse (Tim Smart)\n\n### v1.0.13\n\n* Only update hash if update method exists (Sven Lito)\n* According to travis v0.10 needs to go quoted (Sven Lito)\n* Bumping build node versions (Sven Lito)\n* Additional fix for empty requests (Eugene Girshov)\n* Change the default to 1000, to match the new Node behaviour. (OrangeDog)\n* Add ability to control maxKeys in the querystring parser. (OrangeDog)\n* Adjust test case to work with node 0.9.x (Eugene Girshov)\n* Update package.json (Sven Lito)\n* Path adjustment according to eb4468b (Markus Ast)\n\n### v1.0.12\n\n* Emit error on aborted connections (Eugene Girshov)\n* Add support for empty requests (Eugene Girshov)\n* Fix name/filename handling in Content-Disposition (jesperp)\n* Tolerate malformed closing boundary in multipart (Eugene Girshov)\n* Ignore preamble in multipart messages (Eugene Girshov)\n* Add support for application/json (Mike Frey, Carlos Rodriguez)\n* Add support for Base64 encoding (Elmer Bulthuis)\n* Add File#toJSON (TJ Holowaychuk)\n* Remove support for Node.js 0.4 & 0.6 (Andrew Kelley)\n* Documentation improvements (Sven Lito, Andre Azevedo)\n* Add support for application/octet-stream (Ion Lupascu, Chris Scribner)\n* Use os.tmpDir() to get tmp directory (Andrew Kelley)\n* Improve package.json (Andrew Kelley, Sven Lito)\n* Fix benchmark script (Andrew Kelley)\n* Fix scope issue in incoming_forms (Sven Lito)\n* Fix file handle leak on error (OrangeDog)\n\n### v1.0.11\n\n* Calculate checksums for incoming files (sreuter)\n* Add definition parameters to \"IncomingForm\" as an argument (Math-)\n\n### v1.0.10\n\n* Make parts to be proper Streams (Matt Robenolt)\n\n### v1.0.9\n\n* Emit progress when content length header parsed (Tim Koschützki)\n* Fix Readme syntax due to GitHub changes (goob)\n* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)\n\n### v1.0.8\n\n* Strip potentially unsafe characters when using `keepExtensions: true`.\n* Switch to utest / urun for testing\n* Add travis build\n\n### v1.0.7\n\n* Remove file from package that was causing problems when installing on windows. (#102)\n* Fix typos in Readme (Jason Davies).\n\n### v1.0.6\n\n* Do not default to the default to the field name for file uploads where\n filename=\"\".\n\n### v1.0.5\n\n* Support filename=\"\" in multipart parts\n* Explain unexpected end() errors in parser better\n\n**Note:** Starting with this version, formidable emits 'file' events for empty\nfile input fields. Previously those were incorrectly emitted as regular file\ninput fields with value = \"\".\n\n### v1.0.4\n\n* Detect a good default tmp directory regardless of platform. (#88)\n\n### v1.0.3\n\n* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)\n* Small performance improvements\n* New test suite and fixture system\n\n### v1.0.2\n\n* Exclude node\\_modules folder from git\n* Implement new `'aborted'` event\n* Fix files in example folder to work with recent node versions\n* Make gently a devDependency\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)\n\n### v1.0.0\n\n* Add support for multipart boundaries that are quoted strings. (Jeff Craig)\n\nThis marks the beginning of development on version 2.0 which will include\nseveral architectural improvements.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)\n\n### v0.9.11\n\n* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)\n* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class\n\n**Important:** The old property names of the File class will be removed in a\nfuture release.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)\n* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)\n* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)\n* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)\n* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)\n* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)\n* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)\n* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)\n* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)\n* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js\n",
+ "readmeFilename": "Readme.md",
+ "dependencies": {},
+ "_id": "formidable@1.0.14",
+ "dist": {
+ "shasum": "73ba5aa6e343f96f25bc60620356adc1256c7897"
+ },
+ "_from": "formidable@1.0.14",
+ "_resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
new file mode 100644
index 0000000..6a94295
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
@@ -0,0 +1,18 @@
+var path = require('path');
+
+var root = path.join(__dirname, '../');
+exports.dir = {
+ root : root,
+ lib : root + '/lib',
+ fixture : root + '/test/fixture',
+ tmp : root + '/test/tmp',
+};
+
+exports.port = 13532;
+
+exports.formidable = require('..');
+exports.assert = require('assert');
+
+exports.require = function(lib) {
+ return require(exports.dir.lib + '/' + lib);
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png
new file mode 100644
index 0000000..20b1a7f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz
new file mode 100644
index 0000000..4a85af7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz
Binary files differ
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif
new file mode 100644
index 0000000..75b945d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif
Binary files differ
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
new file mode 100644
index 0000000..e7a4785
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
@@ -0,0 +1 @@
+I am a text file with a funky name!
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png
new file mode 100644
index 0000000..1c16a71
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png
Binary files differ
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
new file mode 100644
index 0000000..9b6903e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
@@ -0,0 +1 @@
+I am a plain text file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
new file mode 100644
index 0000000..3c9dbe3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
@@ -0,0 +1,3 @@
+* Opera does not allow submitting this file, it shows a warning to the
+ user that the file could not be found instead. Tested in 9.8, 11.51 on OSX.
+ Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com).
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
new file mode 100644
index 0000000..fc22026
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
@@ -0,0 +1,24 @@
+module.exports['menu_seperator.png.http'] = [
+ {type: 'file', name: 'image', filename: 'menu_separator.png', fixture: 'menu_separator.png',
+ sha1: 'c845ca3ea794be298f2a1b79769b71939eaf4e54'}
+];
+
+module.exports['beta-sticker-1.png.http'] = [
+ {type: 'file', name: 'sticker', filename: 'beta-sticker-1.png', fixture: 'beta-sticker-1.png',
+ sha1: '6abbcffd12b4ada5a6a084fe9e4584f846331bc4'}
+];
+
+module.exports['blank.gif.http'] = [
+ {type: 'file', name: 'file', filename: 'blank.gif', fixture: 'blank.gif',
+ sha1: 'a1fdee122b95748d81cee426d717c05b5174fe96'}
+];
+
+module.exports['binaryfile.tar.gz.http'] = [
+ {type: 'file', name: 'file', filename: 'binaryfile.tar.gz', fixture: 'binaryfile.tar.gz',
+ sha1: 'cfabe13b348e5e69287d677860880c52a69d2155'}
+];
+
+module.exports['plain.txt.http'] = [
+ {type: 'file', name: 'file', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}
+];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
new file mode 100644
index 0000000..4489176
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
@@ -0,0 +1,6 @@
+module.exports = {
+ 'empty.http': [],
+ 'empty-urlencoded.http': [],
+ 'empty-multipart.http': [],
+ 'minimal.http': [],
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
new file mode 100644
index 0000000..f03b4f0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
@@ -0,0 +1,9 @@
+module.exports['generic.http'] = [
+ {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
+
+module.exports['filename-name.http'] = [
+ {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
new file mode 100644
index 0000000..d2e4cfd
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
@@ -0,0 +1,9 @@
+module.exports['crlf.http'] = [
+ {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
+
+module.exports['preamble.http'] = [
+ {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
new file mode 100644
index 0000000..eb76fdc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
@@ -0,0 +1,21 @@
+var properFilename = 'funkyfilename.txt';
+
+function expect(filename) {
+ return [
+ {type: 'field', name: 'title', value: 'Weird filename'},
+ {type: 'file', name: 'upload', filename: filename, fixture: properFilename},
+ ];
+};
+
+var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
+var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
+
+module.exports = {
+ 'osx-chrome-13.http' : expect(webkit),
+ 'osx-firefox-3.6.http' : expect(ffOrIe),
+ 'osx-safari-5.http' : expect(webkit),
+ 'xp-chrome-12.http' : expect(webkit),
+ 'xp-ie-7.http' : expect(ffOrIe),
+ 'xp-ie-8.http' : expect(ffOrIe),
+ 'xp-safari-5.http' : expect(webkit),
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
new file mode 100644
index 0000000..e59c5b2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
@@ -0,0 +1,8 @@
+module.exports['missing-hyphens1.http'] = [
+ {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
+module.exports['missing-hyphens2.http'] = [
+ {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
+ sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
+];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
new file mode 100644
index 0000000..a476169
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
@@ -0,0 +1,72 @@
+exports['rfc1867'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--\r\n',
+ parts:
+ [ { headers: {
+ 'content-disposition': 'form-data; name="field1"',
+ },
+ data: 'Joe Blow\r\nalmost tricked you!',
+ },
+ { headers: {
+ 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
+ 'Content-Type': 'text/plain',
+ },
+ data: '... contents of file1.txt ...\r',
+ }
+ ]
+ };
+
+exports['noTrailing\r\n'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--',
+ parts:
+ [ { headers: {
+ 'content-disposition': 'form-data; name="field1"',
+ },
+ data: 'Joe Blow\r\nalmost tricked you!',
+ },
+ { headers: {
+ 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
+ 'Content-Type': 'text/plain',
+ },
+ data: '... contents of file1.txt ...\r',
+ }
+ ]
+ };
+
+exports['emptyHeader'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ ': foo\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--\r\n',
+ expectError: true,
+ };
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
new file mode 100644
index 0000000..8e10ac9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
@@ -0,0 +1,96 @@
+var hashish = require('hashish');
+var fs = require('fs');
+var findit = require('findit');
+var path = require('path');
+var http = require('http');
+var net = require('net');
+var assert = require('assert');
+
+var common = require('../common');
+var formidable = common.formidable;
+
+var server = http.createServer();
+server.listen(common.port, findFixtures);
+
+function findFixtures() {
+ var fixtures = [];
+ findit
+ .sync(common.dir.fixture + '/js')
+ .forEach(function(jsPath) {
+ if (!/\.js$/.test(jsPath)) return;
+
+ var group = path.basename(jsPath, '.js');
+ hashish.forEach(require(jsPath), function(fixture, name) {
+ fixtures.push({
+ name : group + '/' + name,
+ fixture : fixture,
+ });
+ });
+ });
+
+ testNext(fixtures);
+}
+
+function testNext(fixtures) {
+ var fixture = fixtures.shift();
+ if (!fixture) return server.close();
+
+ var name = fixture.name;
+ var fixture = fixture.fixture;
+
+ uploadFixture(name, function(err, parts) {
+ if (err) throw err;
+
+ fixture.forEach(function(expectedPart, i) {
+ var parsedPart = parts[i];
+ assert.equal(parsedPart.type, expectedPart.type);
+ assert.equal(parsedPart.name, expectedPart.name);
+
+ if (parsedPart.type === 'file') {
+ var file = parsedPart.value;
+ assert.equal(file.name, expectedPart.filename);
+ if(expectedPart.sha1) assert.equal(file.hash, expectedPart.sha1);
+ }
+ });
+
+ testNext(fixtures);
+ });
+};
+
+function uploadFixture(name, cb) {
+ server.once('request', function(req, res) {
+ var form = new formidable.IncomingForm();
+ form.uploadDir = common.dir.tmp;
+ form.hash = "sha1";
+ form.parse(req);
+
+ function callback() {
+ var realCallback = cb;
+ cb = function() {};
+ realCallback.apply(null, arguments);
+ }
+
+ var parts = [];
+ form
+ .on('error', callback)
+ .on('fileBegin', function(name, value) {
+ parts.push({type: 'file', name: name, value: value});
+ })
+ .on('field', function(name, value) {
+ parts.push({type: 'field', name: name, value: value});
+ })
+ .on('end', function() {
+ res.end('OK');
+ callback(null, parts);
+ });
+ });
+
+ var socket = net.createConnection(common.port);
+ var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
+
+ file.pipe(socket, {end: false});
+ socket.on('data', function () {
+ socket.end();
+ });
+
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
new file mode 100644
index 0000000..28e758e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
@@ -0,0 +1,38 @@
+var common = require('../common');
+var formidable = common.formidable;
+var http = require('http');
+var assert = require('assert');
+
+var testData = {
+ numbers: [1, 2, 3, 4, 5],
+ nested: { key: 'value' }
+};
+
+var server = http.createServer(function(req, res) {
+ var form = new formidable.IncomingForm();
+
+ form.parse(req, function(err, fields, files) {
+ assert.deepEqual(fields, testData);
+
+ res.end();
+ server.close();
+ });
+});
+
+var port = common.port;
+
+server.listen(port, function(err){
+ assert.equal(err, null);
+
+ var request = http.request({
+ port: port,
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ });
+
+ request.write(JSON.stringify(testData));
+ request.end();
+});
+
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
new file mode 100644
index 0000000..643d2c6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
@@ -0,0 +1,45 @@
+var common = require('../common');
+var formidable = common.formidable;
+var http = require('http');
+var fs = require('fs');
+var path = require('path');
+var hashish = require('hashish');
+var assert = require('assert');
+
+var testFilePath = path.join(__dirname, '../fixture/file/binaryfile.tar.gz');
+
+var server = http.createServer(function(req, res) {
+ var form = new formidable.IncomingForm();
+
+ form.parse(req, function(err, fields, files) {
+ assert.equal(hashish(files).length, 1);
+ var file = files.file;
+
+ assert.equal(file.size, 301);
+
+ var uploaded = fs.readFileSync(file.path);
+ var original = fs.readFileSync(testFilePath);
+
+ assert.deepEqual(uploaded, original);
+
+ res.end();
+ server.close();
+ });
+});
+
+var port = common.port;
+
+server.listen(port, function(err){
+ assert.equal(err, null);
+
+ var request = http.request({
+ port: port,
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/octet-stream'
+ }
+ });
+
+ fs.createReadStream(testFilePath).pipe(request);
+});
+
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
new file mode 100644
index 0000000..2b98598
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
@@ -0,0 +1,24 @@
+var path = require('path'),
+ fs = require('fs');
+
+try {
+ global.Gently = require('gently');
+} catch (e) {
+ throw new Error('this test suite requires node-gently');
+}
+
+exports.lib = path.join(__dirname, '../../lib');
+
+global.GENTLY = new Gently();
+
+global.assert = require('assert');
+global.TEST_PORT = 13532;
+global.TEST_FIXTURES = path.join(__dirname, '../fixture');
+global.TEST_TMP = path.join(__dirname, '../tmp');
+
+// Stupid new feature in node that complains about gently attaching too many
+// listeners to process 'exit'. This is a workaround until I can think of a
+// better way to deal with this.
+if (process.setMaxListeners) {
+ process.setMaxListeners(10000);
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
new file mode 100644
index 0000000..75232aa
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
@@ -0,0 +1,80 @@
+var common = require('../common');
+var CHUNK_LENGTH = 10,
+ multipartParser = require(common.lib + '/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ parser = new MultipartParser(),
+ fixtures = require(TEST_FIXTURES + '/multipart'),
+ Buffer = require('buffer').Buffer;
+
+Object.keys(fixtures).forEach(function(name) {
+ var fixture = fixtures[name],
+ buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')),
+ offset = 0,
+ chunk,
+ nparsed,
+
+ parts = [],
+ part = null,
+ headerField,
+ headerValue,
+ endCalled = '';
+
+ parser.initWithBoundary(fixture.boundary);
+ parser.onPartBegin = function() {
+ part = {headers: {}, data: ''};
+ parts.push(part);
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeaderField = function(b, start, end) {
+ headerField += b.toString('ascii', start, end);
+ };
+
+ parser.onHeaderValue = function(b, start, end) {
+ headerValue += b.toString('ascii', start, end);
+ }
+
+ parser.onHeaderEnd = function() {
+ part.headers[headerField] = headerValue;
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onPartData = function(b, start, end) {
+ var str = b.toString('ascii', start, end);
+ part.data += b.slice(start, end);
+ }
+
+ parser.onEnd = function() {
+ endCalled = true;
+ }
+
+ buffer.write(fixture.raw, 'binary', 0);
+
+ while (offset < buffer.length) {
+ if (offset + CHUNK_LENGTH < buffer.length) {
+ chunk = buffer.slice(offset, offset+CHUNK_LENGTH);
+ } else {
+ chunk = buffer.slice(offset, buffer.length);
+ }
+ offset = offset + CHUNK_LENGTH;
+
+ nparsed = parser.write(chunk);
+ if (nparsed != chunk.length) {
+ if (fixture.expectError) {
+ return;
+ }
+ puts('-- ERROR --');
+ p(chunk.toString('ascii'));
+ throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!');
+ }
+ }
+
+ if (fixture.expectError) {
+ throw new Error('expected parse error did not happen');
+ }
+
+ assert.ok(endCalled);
+ assert.deepEqual(parts, fixture.parts);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
new file mode 100644
index 0000000..52ceedb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
@@ -0,0 +1,104 @@
+var common = require('../common');
+var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
+
+var File = require(common.lib + '/file'),
+ EventEmitter = require('events').EventEmitter,
+ file,
+ gently;
+
+function test(test) {
+ gently = new Gently();
+ file = new File();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.ok(file instanceof EventEmitter);
+ assert.strictEqual(file.size, 0);
+ assert.strictEqual(file.path, null);
+ assert.strictEqual(file.name, null);
+ assert.strictEqual(file.type, null);
+ assert.strictEqual(file.lastModifiedDate, null);
+
+ assert.strictEqual(file._writeStream, null);
+
+ (function testSetProperties() {
+ var file2 = new File({foo: 'bar'});
+ assert.equal(file2.foo, 'bar');
+ })();
+});
+
+test(function open() {
+ var WRITE_STREAM;
+ file.path = '/foo';
+
+ gently.expect(WriteStreamStub, 'new', function (path) {
+ WRITE_STREAM = this;
+ assert.strictEqual(path, file.path);
+ });
+
+ file.open();
+ assert.strictEqual(file._writeStream, WRITE_STREAM);
+});
+
+test(function write() {
+ var BUFFER = {length: 10},
+ CB_STUB,
+ CB = function() {
+ CB_STUB.apply(this, arguments);
+ };
+
+ file._writeStream = {};
+
+ gently.expect(file._writeStream, 'write', function (buffer, cb) {
+ assert.strictEqual(buffer, BUFFER);
+
+ gently.expect(file, 'emit', function (event, bytesWritten) {
+ assert.ok(file.lastModifiedDate instanceof Date);
+ assert.equal(event, 'progress');
+ assert.equal(bytesWritten, file.size);
+ });
+
+ CB_STUB = gently.expect(function writeCb() {
+ assert.equal(file.size, 10);
+ });
+
+ cb();
+
+ gently.expect(file, 'emit', function (event, bytesWritten) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesWritten, file.size);
+ });
+
+ CB_STUB = gently.expect(function writeCb() {
+ assert.equal(file.size, 20);
+ });
+
+ cb();
+ });
+
+ file.write(BUFFER, CB);
+});
+
+test(function end() {
+ var CB_STUB,
+ CB = function() {
+ CB_STUB.apply(this, arguments);
+ };
+
+ file._writeStream = {};
+
+ gently.expect(file._writeStream, 'end', function (cb) {
+ gently.expect(file, 'emit', function (event) {
+ assert.equal(event, 'end');
+ });
+
+ CB_STUB = gently.expect(function endCb() {
+ });
+
+ cb();
+ });
+
+ file.end(CB);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
new file mode 100644
index 0000000..25bd887
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
@@ -0,0 +1,756 @@
+var common = require('../common');
+var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'),
+ QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'),
+ EventEmitterStub = GENTLY.stub('events', 'EventEmitter'),
+ StreamStub = GENTLY.stub('stream', 'Stream'),
+ FileStub = GENTLY.stub('./file');
+
+var formidable = require(common.lib + '/index'),
+ IncomingForm = formidable.IncomingForm,
+ events = require('events'),
+ fs = require('fs'),
+ path = require('path'),
+ Buffer = require('buffer').Buffer,
+ fixtures = require(TEST_FIXTURES + '/multipart'),
+ form,
+ gently;
+
+function test(test) {
+ gently = new Gently();
+ gently.expect(EventEmitterStub, 'call');
+ form = new IncomingForm();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.strictEqual(form.error, null);
+ assert.strictEqual(form.ended, false);
+ assert.strictEqual(form.type, null);
+ assert.strictEqual(form.headers, null);
+ assert.strictEqual(form.keepExtensions, false);
+ // Can't assume dir === '/tmp' for portability
+ // assert.strictEqual(form.uploadDir, '/tmp');
+ // Make sure it is a directory instead
+ assert.doesNotThrow(function () {
+ assert(fs.statSync(form.uploadDir).isDirectory());
+ });
+ assert.strictEqual(form.encoding, 'utf-8');
+ assert.strictEqual(form.bytesReceived, null);
+ assert.strictEqual(form.bytesExpected, null);
+ assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024);
+ assert.strictEqual(form._parser, null);
+ assert.strictEqual(form._flushing, 0);
+ assert.strictEqual(form._fieldsSize, 0);
+ assert.ok(form instanceof EventEmitterStub);
+ assert.equal(form.constructor.name, 'IncomingForm');
+
+ (function testSimpleConstructor() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = IncomingForm();
+ assert.ok(form instanceof IncomingForm);
+ })();
+
+ (function testSimpleConstructorShortcut() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = formidable();
+ assert.ok(form instanceof IncomingForm);
+ })();
+});
+
+test(function parse() {
+ var REQ = {headers: {}}
+ , emit = {};
+
+ gently.expect(form, 'writeHeaders', function(headers) {
+ assert.strictEqual(headers, REQ.headers);
+ });
+
+ var EVENTS = ['error', 'aborted', 'data', 'end'];
+ gently.expect(REQ, 'on', EVENTS.length, function(event, fn) {
+ assert.equal(event, EVENTS.shift());
+ emit[event] = fn;
+ return this;
+ });
+
+ form.parse(REQ);
+
+ (function testPause() {
+ gently.expect(REQ, 'pause');
+ assert.strictEqual(form.pause(), true);
+ })();
+
+ (function testPauseCriticalException() {
+ form.ended = false;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'pause', function() {
+ throw ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ assert.strictEqual(form.pause(), false);
+ })();
+
+ (function testPauseHarmlessException() {
+ form.ended = true;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'pause', function() {
+ throw ERR;
+ });
+
+ assert.strictEqual(form.pause(), false);
+ })();
+
+ (function testResume() {
+ gently.expect(REQ, 'resume');
+ assert.strictEqual(form.resume(), true);
+ })();
+
+ (function testResumeCriticalException() {
+ form.ended = false;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'resume', function() {
+ throw ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ assert.strictEqual(form.resume(), false);
+ })();
+
+ (function testResumeHarmlessException() {
+ form.ended = true;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'resume', function() {
+ throw ERR;
+ });
+
+ assert.strictEqual(form.resume(), false);
+ })();
+
+ (function testEmitError() {
+ var ERR = new Error('something bad happened');
+ gently.expect(form, '_error',function(err) {
+ assert.strictEqual(err, ERR);
+ });
+ emit.error(ERR);
+ })();
+
+ (function testEmitAborted() {
+ gently.expect(form, 'emit',function(event) {
+ assert.equal(event, 'aborted');
+ });
+ gently.expect(form, '_error');
+
+ emit.aborted();
+ })();
+
+
+ (function testEmitData() {
+ var BUFFER = [1, 2, 3];
+ gently.expect(form, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ });
+ emit.data(BUFFER);
+ })();
+
+ (function testEmitEnd() {
+ form._parser = {};
+
+ (function testWithError() {
+ var ERR = new Error('haha');
+ gently.expect(form._parser, 'end', function() {
+ return ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ emit.end();
+ })();
+
+ (function testWithoutError() {
+ gently.expect(form._parser, 'end');
+ emit.end();
+ })();
+
+ (function testAfterError() {
+ form.error = true;
+ emit.end();
+ })();
+ })();
+
+ (function testWithCallback() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = new IncomingForm(),
+ REQ = {headers: {}},
+ parseCalled = 0;
+
+ gently.expect(form, 'on', 4, function(event, fn) {
+ if (event == 'field') {
+ fn('field1', 'foo');
+ fn('field1', 'bar');
+ fn('field2', 'nice');
+ }
+
+ if (event == 'file') {
+ fn('file1', '1');
+ fn('file1', '2');
+ fn('file2', '3');
+ }
+
+ if (event == 'end') {
+ fn();
+ }
+ return this;
+ });
+
+ gently.expect(form, 'writeHeaders');
+
+ gently.expect(REQ, 'on', 4, function() {
+ return this;
+ });
+
+ var parseCbOk = function (err, fields, files) {
+ assert.deepEqual(fields, {field1: 'bar', field2: 'nice'});
+ assert.deepEqual(files, {file1: '2', file2: '3'});
+ };
+ form.parse(REQ, parseCbOk);
+
+ var ERR = new Error('test');
+ gently.expect(form, 'on', 3, function(event, fn) {
+ if (event == 'field') {
+ fn('foo', 'bar');
+ }
+
+ if (event == 'error') {
+ fn(ERR);
+ gently.expect(form, 'on');
+ gently.expect(form, 'writeHeaders');
+ gently.expect(REQ, 'on', 4, function() {
+ return this;
+ });
+ }
+ return this;
+ });
+
+ form.parse(REQ, function parseCbErr(err, fields, files) {
+ assert.strictEqual(err, ERR);
+ assert.deepEqual(fields, {foo: 'bar'});
+ });
+ })();
+
+ (function testWriteOrder() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = new IncomingForm();
+ var REQ = new events.EventEmitter();
+ var BUF = {};
+ var DATACB = null;
+
+ REQ.on('newListener', function(event, fn) {
+ if ('data' === event) fn(BUF);
+ });
+
+ gently.expect(form, 'writeHeaders');
+ gently.expect(form, 'write', function(buf) {
+ assert.strictEqual(buf, BUF);
+ });
+
+ form.parse(REQ);
+ })();
+});
+
+test(function pause() {
+ assert.strictEqual(form.pause(), false);
+});
+
+test(function resume() {
+ assert.strictEqual(form.resume(), false);
+});
+
+
+test(function writeHeaders() {
+ var HEADERS = {};
+ gently.expect(form, '_parseContentLength');
+ gently.expect(form, '_parseContentType');
+
+ form.writeHeaders(HEADERS);
+ assert.strictEqual(form.headers, HEADERS);
+});
+
+test(function write() {
+ var parser = {},
+ BUFFER = [1, 2, 3];
+
+ form._parser = parser;
+ form.bytesExpected = 523423;
+
+ (function testBasic() {
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, BUFFER.length);
+ assert.equal(bytesExpected, form.bytesExpected);
+ });
+
+ gently.expect(parser, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ return buffer.length;
+ });
+
+ assert.equal(form.write(BUFFER), BUFFER.length);
+ assert.equal(form.bytesReceived, BUFFER.length);
+ })();
+
+ (function testParserError() {
+ gently.expect(form, 'emit');
+
+ gently.expect(parser, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ return buffer.length - 1;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/parser error/i));
+ });
+
+ assert.equal(form.write(BUFFER), BUFFER.length - 1);
+ assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length);
+ })();
+
+ (function testUninitialized() {
+ delete form._parser;
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/unintialized parser/i));
+ });
+ form.write(BUFFER);
+ })();
+});
+
+test(function parseContentType() {
+ var HEADERS = {};
+
+ form.headers = {'content-type': 'application/x-www-form-urlencoded'};
+ gently.expect(form, '_initUrlencoded');
+ form._parseContentType();
+
+ // accept anything that has 'urlencoded' in it
+ form.headers = {'content-type': 'broken-client/urlencoded-stupid'};
+ gently.expect(form, '_initUrlencoded');
+ form._parseContentType();
+
+ var BOUNDARY = '---------------------------57814261102167618332366269';
+ form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY};
+
+ gently.expect(form, '_initMultipart', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+ form._parseContentType();
+
+ (function testQuotedBoundary() {
+ form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'};
+
+ gently.expect(form, '_initMultipart', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+ form._parseContentType();
+ })();
+
+ (function testNoBoundary() {
+ form.headers = {'content-type': 'multipart/form-data'};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/no multipart boundary/i));
+ });
+ form._parseContentType();
+ })();
+
+ (function testNoContentType() {
+ form.headers = {};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/no content-type/i));
+ });
+ form._parseContentType();
+ })();
+
+ (function testUnknownContentType() {
+ form.headers = {'content-type': 'invalid'};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/unknown content-type/i));
+ });
+ form._parseContentType();
+ })();
+});
+
+test(function parseContentLength() {
+ var HEADERS = {};
+
+ form.headers = {};
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, 0);
+ assert.equal(bytesExpected, 0);
+ });
+ form._parseContentLength();
+
+ form.headers['content-length'] = '8';
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, 0);
+ assert.equal(bytesExpected, 8);
+ });
+ form._parseContentLength();
+ assert.strictEqual(form.bytesReceived, 0);
+ assert.strictEqual(form.bytesExpected, 8);
+
+ // JS can be evil, lets make sure we are not
+ form.headers['content-length'] = '08';
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, 0);
+ assert.equal(bytesExpected, 8);
+ });
+ form._parseContentLength();
+ assert.strictEqual(form.bytesExpected, 8);
+});
+
+test(function _initMultipart() {
+ var BOUNDARY = '123',
+ PARSER;
+
+ gently.expect(MultipartParserStub, 'new', function() {
+ PARSER = this;
+ });
+
+ gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+
+ form._initMultipart(BOUNDARY);
+ assert.equal(form.type, 'multipart');
+ assert.strictEqual(form._parser, PARSER);
+
+ (function testRegularField() {
+ var PART;
+ gently.expect(StreamStub, 'new', function() {
+ PART = this;
+ });
+
+ gently.expect(form, 'onPart', function(part) {
+ assert.strictEqual(part, PART);
+ assert.deepEqual
+ ( part.headers
+ , { 'content-disposition': 'form-data; name="field1"'
+ , 'foo': 'bar'
+ }
+ );
+ assert.equal(part.name, 'field1');
+
+ var strings = ['hello', ' world'];
+ gently.expect(part, 'emit', 2, function(event, b) {
+ assert.equal(event, 'data');
+ assert.equal(b.toString(), strings.shift());
+ });
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'end');
+ });
+ });
+
+ PARSER.onPartBegin();
+ PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10);
+ PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24);
+ PARSER.onHeaderEnd();
+ PARSER.onHeaderField(new Buffer('foo'), 0, 3);
+ PARSER.onHeaderValue(new Buffer('bar'), 0, 3);
+ PARSER.onHeaderEnd();
+ PARSER.onHeadersEnd();
+ PARSER.onPartData(new Buffer('hello world'), 0, 5);
+ PARSER.onPartData(new Buffer('hello world'), 5, 11);
+ PARSER.onPartEnd();
+ })();
+
+ (function testFileField() {
+ var PART;
+ gently.expect(StreamStub, 'new', function() {
+ PART = this;
+ });
+
+ gently.expect(form, 'onPart', function(part) {
+ assert.deepEqual
+ ( part.headers
+ , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'
+ , 'content-type': 'text/plain'
+ }
+ );
+ assert.equal(part.name, 'field2');
+ assert.equal(part.filename, 'Sun"et.jpg');
+ assert.equal(part.mime, 'text/plain');
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'data');
+ assert.equal(b.toString(), '... contents of file1.txt ...');
+ });
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'end');
+ });
+ });
+
+ PARSER.onPartBegin();
+ PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85);
+ PARSER.onHeaderEnd();
+ PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12);
+ PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10);
+ PARSER.onHeaderEnd();
+ PARSER.onHeadersEnd();
+ PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29);
+ PARSER.onPartEnd();
+ })();
+
+ (function testEnd() {
+ gently.expect(form, '_maybeEnd');
+ PARSER.onEnd();
+ assert.ok(form.ended);
+ })();
+});
+
+test(function _fileName() {
+ // TODO
+ return;
+});
+
+test(function _initUrlencoded() {
+ var PARSER;
+
+ gently.expect(QuerystringParserStub, 'new', function() {
+ PARSER = this;
+ });
+
+ form._initUrlencoded();
+ assert.equal(form.type, 'urlencoded');
+ assert.strictEqual(form._parser, PARSER);
+
+ (function testOnField() {
+ var KEY = 'KEY', VAL = 'VAL';
+ gently.expect(form, 'emit', function(field, key, val) {
+ assert.equal(field, 'field');
+ assert.equal(key, KEY);
+ assert.equal(val, VAL);
+ });
+
+ PARSER.onField(KEY, VAL);
+ })();
+
+ (function testOnEnd() {
+ gently.expect(form, '_maybeEnd');
+
+ PARSER.onEnd();
+ assert.equal(form.ended, true);
+ })();
+});
+
+test(function _error() {
+ var ERR = new Error('bla');
+
+ gently.expect(form, 'pause');
+ gently.expect(form, 'emit', function(event, err) {
+ assert.equal(event, 'error');
+ assert.strictEqual(err, ERR);
+ });
+
+ form._error(ERR);
+ assert.strictEqual(form.error, ERR);
+
+ // make sure _error only does its thing once
+ form._error(ERR);
+});
+
+test(function onPart() {
+ var PART = {};
+ gently.expect(form, 'handlePart', function(part) {
+ assert.strictEqual(part, PART);
+ });
+
+ form.onPart(PART);
+});
+
+test(function handlePart() {
+ (function testUtf8Field() {
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field';
+
+ gently.expect(form, 'emit', function(event, field, value) {
+ assert.equal(event, 'field');
+ assert.equal(field, 'my_field');
+ assert.equal(value, 'hello world: €');
+ });
+
+ form.handlePart(PART);
+ PART.emit('data', new Buffer('hello'));
+ PART.emit('data', new Buffer(' world: '));
+ PART.emit('data', new Buffer([0xE2]));
+ PART.emit('data', new Buffer([0x82, 0xAC]));
+ PART.emit('end');
+ })();
+
+ (function testBinaryField() {
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field2';
+
+ gently.expect(form, 'emit', function(event, field, value) {
+ assert.equal(event, 'field');
+ assert.equal(field, 'my_field2');
+ assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary'));
+ });
+
+ form.encoding = 'binary';
+ form.handlePart(PART);
+ PART.emit('data', new Buffer('hello'));
+ PART.emit('data', new Buffer(' world: '));
+ PART.emit('data', new Buffer([0xE2]));
+ PART.emit('data', new Buffer([0x82, 0xAC]));
+ PART.emit('end');
+ })();
+
+ (function testFieldSize() {
+ form.maxFieldsSize = 8;
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field';
+
+ gently.expect(form, '_error', function(err) {
+ assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data');
+ });
+
+ form.handlePart(PART);
+ form._fieldsSize = 1;
+ PART.emit('data', new Buffer(7));
+ PART.emit('data', new Buffer(1));
+ })();
+
+ (function testFilePart() {
+ var PART = new events.EventEmitter(),
+ FILE = new events.EventEmitter(),
+ PATH = '/foo/bar';
+
+ PART.name = 'my_file';
+ PART.filename = 'sweet.txt';
+ PART.mime = 'sweet.txt';
+
+ gently.expect(form, '_uploadPath', function(filename) {
+ assert.equal(filename, PART.filename);
+ return PATH;
+ });
+
+ gently.expect(FileStub, 'new', function(properties) {
+ assert.equal(properties.path, PATH);
+ assert.equal(properties.name, PART.filename);
+ assert.equal(properties.type, PART.mime);
+ FILE = this;
+
+ gently.expect(form, 'emit', function (event, field, file) {
+ assert.equal(event, 'fileBegin');
+ assert.strictEqual(field, PART.name);
+ assert.strictEqual(file, FILE);
+ });
+
+ gently.expect(FILE, 'open');
+ });
+
+ form.handlePart(PART);
+ assert.equal(form._flushing, 1);
+
+ var BUFFER;
+ gently.expect(form, 'pause');
+ gently.expect(FILE, 'write', function(buffer, cb) {
+ assert.strictEqual(buffer, BUFFER);
+ gently.expect(form, 'resume');
+ // @todo handle cb(new Err)
+ cb();
+ });
+
+ PART.emit('data', BUFFER = new Buffer('test'));
+
+ gently.expect(FILE, 'end', function(cb) {
+ gently.expect(form, 'emit', function(event, field, file) {
+ assert.equal(event, 'file');
+ assert.strictEqual(file, FILE);
+ });
+
+ gently.expect(form, '_maybeEnd');
+
+ cb();
+ assert.equal(form._flushing, 0);
+ });
+
+ PART.emit('end');
+ })();
+});
+
+test(function _uploadPath() {
+ (function testUniqueId() {
+ var UUID_A, UUID_B;
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
+ assert.equal(uploadDir, form.uploadDir);
+ UUID_A = uuid;
+ });
+ form._uploadPath();
+
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
+ UUID_B = uuid;
+ });
+ form._uploadPath();
+
+ assert.notEqual(UUID_A, UUID_B);
+ })();
+
+ (function testFileExtension() {
+ form.keepExtensions = true;
+ var FILENAME = 'foo.jpg',
+ EXT = '.bar';
+
+ gently.expect(GENTLY.hijacked.path, 'extname', function(filename) {
+ assert.equal(filename, FILENAME);
+ gently.restore(path, 'extname');
+
+ return EXT;
+ });
+
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) {
+ assert.equal(path.extname(name), EXT);
+ });
+ form._uploadPath(FILENAME);
+ })();
+});
+
+test(function _maybeEnd() {
+ gently.expect(form, 'emit', 0);
+ form._maybeEnd();
+
+ form.ended = true;
+ form._flushing = 1;
+ form._maybeEnd();
+
+ gently.expect(form, 'emit', function(event) {
+ assert.equal(event, 'end');
+ });
+
+ form.ended = true;
+ form._flushing = 0;
+ form._maybeEnd();
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
new file mode 100644
index 0000000..bf2cd5e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
@@ -0,0 +1,50 @@
+var common = require('../common');
+var multipartParser = require(common.lib + '/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ events = require('events'),
+ Buffer = require('buffer').Buffer,
+ parser;
+
+function test(test) {
+ parser = new MultipartParser();
+ test();
+}
+
+test(function constructor() {
+ assert.equal(parser.boundary, null);
+ assert.equal(parser.state, 0);
+ assert.equal(parser.flags, 0);
+ assert.equal(parser.boundaryChars, null);
+ assert.equal(parser.index, null);
+ assert.equal(parser.lookbehind, null);
+ assert.equal(parser.constructor.name, 'MultipartParser');
+});
+
+test(function initWithBoundary() {
+ var boundary = 'abc';
+ parser.initWithBoundary(boundary);
+ assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]);
+ assert.equal(parser.state, multipartParser.START);
+
+ assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true});
+});
+
+test(function parserError() {
+ var boundary = 'abc',
+ buffer = new Buffer(5);
+
+ parser.initWithBoundary(boundary);
+ buffer.write('--ad', 'ascii', 0);
+ assert.equal(parser.write(buffer), 5);
+});
+
+test(function end() {
+ (function testError() {
+ assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain());
+ })();
+
+ (function testRegular() {
+ parser.state = multipartParser.END;
+ assert.strictEqual(parser.end(), undefined);
+ })();
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
new file mode 100644
index 0000000..54d3e2d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
@@ -0,0 +1,45 @@
+var common = require('../common');
+var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser,
+ Buffer = require('buffer').Buffer,
+ gently,
+ parser;
+
+function test(test) {
+ gently = new Gently();
+ parser = new QuerystringParser();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.equal(parser.buffer, '');
+ assert.equal(parser.constructor.name, 'QuerystringParser');
+});
+
+test(function write() {
+ var a = new Buffer('a=1');
+ assert.equal(parser.write(a), a.length);
+
+ var b = new Buffer('&b=2');
+ parser.write(b);
+ assert.equal(parser.buffer, a + b);
+});
+
+test(function end() {
+ var FIELDS = {a: ['b', {c: 'd'}], e: 'f'};
+
+ gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) {
+ assert.equal(str, parser.buffer);
+ return FIELDS;
+ });
+
+ gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) {
+ assert.deepEqual(FIELDS[key], val);
+ });
+
+ gently.expect(parser, 'onEnd');
+
+ parser.buffer = 'my buffer';
+ parser.end();
+ assert.equal(parser.buffer, '');
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
new file mode 100644
index 0000000..b35ffd6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
@@ -0,0 +1,71 @@
+var common = require('../common');
+var BOUNDARY = '---------------------------10102754414578508781458777923',
+ FIXTURE = TEST_FIXTURES+'/multi_video.upload',
+ fs = require('fs'),
+ http = require('http'),
+ formidable = require(common.lib + '/index'),
+ server = http.createServer();
+
+server.on('request', function(req, res) {
+ var form = new formidable.IncomingForm(),
+ uploads = {};
+
+ form.uploadDir = TEST_TMP;
+ form.hash = 'sha1';
+ form.parse(req);
+
+ form
+ .on('fileBegin', function(field, file) {
+ assert.equal(field, 'upload');
+
+ var tracker = {file: file, progress: [], ended: false};
+ uploads[file.name] = tracker;
+ file
+ .on('progress', function(bytesReceived) {
+ tracker.progress.push(bytesReceived);
+ assert.equal(bytesReceived, file.size);
+ })
+ .on('end', function() {
+ tracker.ended = true;
+ });
+ })
+ .on('field', function(field, value) {
+ assert.equal(field, 'title');
+ assert.equal(value, '');
+ })
+ .on('file', function(field, file) {
+ assert.equal(field, 'upload');
+ assert.strictEqual(uploads[file.name].file, file);
+ })
+ .on('end', function() {
+ assert.ok(uploads['shortest_video.flv']);
+ assert.ok(uploads['shortest_video.flv'].ended);
+ assert.ok(uploads['shortest_video.flv'].progress.length > 3);
+ assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a');
+ assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.size);
+ assert.ok(uploads['shortest_video.mp4']);
+ assert.ok(uploads['shortest_video.mp4'].ended);
+ assert.ok(uploads['shortest_video.mp4'].progress.length > 3);
+ assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f');
+
+ server.close();
+ res.writeHead(200);
+ res.end('good');
+ });
+});
+
+server.listen(TEST_PORT, function() {
+ var stat, headers, request, fixture;
+
+ stat = fs.statSync(FIXTURE);
+ request = http.request({
+ port: TEST_PORT,
+ path: '/',
+ method: 'POST',
+ headers: {
+ 'content-type': 'multipart/form-data; boundary='+BOUNDARY,
+ 'content-length': stat.size,
+ },
+ });
+ fs.createReadStream(FIXTURE).pipe(request);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
new file mode 100644
index 0000000..02d6d5c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
@@ -0,0 +1 @@
+require('urun')(__dirname)
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js
new file mode 100644
index 0000000..4ea4431
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js
@@ -0,0 +1,27 @@
+var assert = require('assert');
+var http = require('http');
+var net = require('net');
+var formidable = require('../../lib/index');
+
+var server = http.createServer(function (req, res) {
+ var form = new formidable.IncomingForm();
+ var aborted_received = false;
+ form.on('aborted', function () {
+ aborted_received = true;
+ });
+ form.on('error', function () {
+ assert(aborted_received, 'Error event should follow aborted');
+ server.close();
+ });
+ form.on('end', function () {
+ throw new Error('Unexpected "end" event');
+ });
+ form.parse(req);
+}).listen(0, 'localhost', function () {
+ var client = net.connect(server.address().port);
+ client.write(
+ "POST / HTTP/1.1\r\n" +
+ "Content-Length: 70\r\n" +
+ "Content-Type: multipart/form-data; boundary=foo\r\n\r\n");
+ client.end();
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js
new file mode 100644
index 0000000..165628a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js
@@ -0,0 +1,48 @@
+var assert = require('assert');
+var common = require('../common');
+var formidable = require('../../lib/index');
+var http = require('http');
+
+var server = http.createServer(function(req, res) {
+ var form = new formidable.IncomingForm();
+ form.uploadDir = common.dir.tmp;
+ form.on('end', function () {
+ throw new Error('Unexpected "end" event');
+ });
+ form.on('error', function (e) {
+ res.writeHead(500);
+ res.end(e.message);
+ });
+ form.parse(req);
+});
+
+server.listen(0, function() {
+ var body =
+ '--foo\r\n' +
+ 'Content-Disposition: form-data; name="file1"; filename="file1"\r\n' +
+ 'Content-Type: application/octet-stream\r\n' +
+ '\r\nThis is the first file\r\n' +
+ '--foo\r\n' +
+ 'Content-Type: application/octet-stream\r\n' +
+ 'Content-Disposition: form-data; name="file2"; filename="file2"\r\n' +
+ 'Content-Transfer-Encoding: unknown\r\n' +
+ '\r\nThis is the second file\r\n' +
+ '--foo--\r\n';
+
+ var req = http.request({
+ method: 'POST',
+ port: server.address().port,
+ headers: {
+ 'Content-Length': body.length,
+ 'Content-Type': 'multipart/form-data; boundary=foo'
+ }
+ });
+ req.on('response', function (res) {
+ assert.equal(res.statusCode, 500);
+ res.on('data', function () {});
+ res.on('end', function () {
+ server.close();
+ });
+ });
+ req.end(body);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js
new file mode 100644
index 0000000..1939328
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js
@@ -0,0 +1,49 @@
+var http = require('http'),
+ formidable = require('../../lib/index'),
+ request = require('request'),
+ assert = require('assert');
+
+var host = 'localhost';
+
+var index = [
+ '<form action="/" method="post" enctype="multipart/form-data">',
+ ' <input type="text" name="foo" />',
+ ' <input type="submit" />',
+ '</form>'
+].join("\n");
+
+var server = http.createServer(function(req, res) {
+
+ // Show a form for testing purposes.
+ if (req.method == 'GET') {
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(index);
+ return;
+ }
+
+ // Parse form and write results to response.
+ var form = new formidable.IncomingForm();
+ form.parse(req, function(err, fields, files) {
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.write(JSON.stringify({err: err, fields: fields, files: files}));
+ res.end();
+ });
+
+}).listen(0, host, function() {
+
+ console.log("Server up and running...");
+
+ var server = this,
+ url = 'http://' + host + ':' + server.address().port;
+
+ var parts = [
+ {'Content-Disposition': 'form-data; name="foo"', 'body': 'bar'}
+ ]
+
+ var req = request({method: 'POST', url: url, multipart: parts}, function(e, res, body) {
+ var obj = JSON.parse(body);
+ assert.equal("bar", obj.fields.foo);
+ server.close();
+ });
+
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html b/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html
new file mode 100644
index 0000000..48ad92e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html
@@ -0,0 +1,67 @@
+<html>
+<head>
+ <title>Convert a file to a base64 request</title>
+
+<script type="text/javascript">
+
+function form_submit(e){
+ console.log(e)
+
+ var resultOutput = document.getElementById('resultOutput');
+ var fileInput = document.getElementById('fileInput');
+ var fieldInput = document.getElementById('fieldInput');
+
+ makeRequestBase64(fileInput.files[0], fieldInput.value, function(err, result){
+ resultOutput.value = result;
+ });
+
+ return false;
+}
+
+function makeRequestBase64(file, fieldName, cb){
+ var boundary = '\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/';
+ var crlf = "\r\n";
+
+ var reader = new FileReader();
+ reader.onload = function(e){
+ var body = '';
+
+ body += '--' + boundary + crlf;
+ body += 'Content-Disposition: form-data; name="' + fieldName + '"; filename="' + escape(file.name)+ '"' + crlf;
+ body += 'Content-Type: ' + file.type + '' + crlf;
+ body += 'Content-Transfer-Encoding: base64' + crlf
+ body += crlf;
+ body += e.target.result.substring(e.target.result.indexOf(',') + 1) + crlf;
+
+ body += '--' + boundary + '--';
+
+ var head = '';
+ head += 'POST /upload HTTP/1.1' + crlf;
+ head += 'Host: localhost:8080' + crlf;
+ head += 'Content-Type: multipart/form-data; boundary=' + boundary + '' + crlf;
+ head += 'Content-Length: ' + body.length + '' + crlf;
+
+ cb(null, head + crlf + body);
+ };
+
+ reader.readAsDataURL(file);
+}
+
+</script>
+
+</head>
+
+<body>
+
+<form action="" onsubmit="return form_submit();">
+ <label>File: <input id="fileInput" type="file" /></label><br />
+ <label>Field: <input id="fieldInput" type="text" value="file" /></label><br />
+ <button type="submit">Ok!</button><br />
+ <label>Request: <textarea id="resultOutput" readonly="readonly" rows="20" cols="80"></textarea></label><br />
+</form>
+<p>
+Don't forget to save the output with windows (CRLF) line endings!
+</p>
+
+</body>
+</html>
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js
new file mode 100644
index 0000000..fc8f36e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js
@@ -0,0 +1,33 @@
+var common = require('../common');
+var test = require('utest');
+var assert = common.assert;
+var File = common.require('file');
+
+var file;
+var now = new Date;
+test('IncomingForm', {
+ before: function() {
+ file = new File({
+ size: 1024,
+ path: '/tmp/cat.png',
+ name: 'cat.png',
+ type: 'image/png',
+ lastModifiedDate: now,
+ filename: 'cat.png',
+ mime: 'image/png'
+ })
+ },
+
+ '#toJSON()': function() {
+ var obj = file.toJSON();
+ var len = Object.keys(obj).length;
+ assert.equal(1024, obj.size);
+ assert.equal('/tmp/cat.png', obj.path);
+ assert.equal('cat.png', obj.name);
+ assert.equal('image/png', obj.type);
+ assert.equal('image/png', obj.mime);
+ assert.equal('cat.png', obj.filename);
+ assert.equal(now, obj.mtime);
+ assert.equal(len, 8);
+ }
+}); \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
new file mode 100644
index 0000000..fe2ac1c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
@@ -0,0 +1,63 @@
+var common = require('../common');
+var test = require('utest');
+var assert = common.assert;
+var IncomingForm = common.require('incoming_form').IncomingForm;
+var path = require('path');
+
+var form;
+test('IncomingForm', {
+ before: function() {
+ form = new IncomingForm();
+ },
+
+ '#_fileName with regular characters': function() {
+ var filename = 'foo.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'foo.txt');
+ },
+
+ '#_fileName with unescaped quote': function() {
+ var filename = 'my".txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
+ },
+
+ '#_fileName with escaped quote': function() {
+ var filename = 'my%22.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
+ },
+
+ '#_fileName with bad quote and additional sub-header': function() {
+ var filename = 'my".txt';
+ var header = makeHeader(filename) + '; foo="bar"';
+ assert.equal(form._fileName(header), filename);
+ },
+
+ '#_fileName with semicolon': function() {
+ var filename = 'my;.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my;.txt');
+ },
+
+ '#_fileName with utf8 character': function() {
+ var filename = 'my&#9731;.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt');
+ },
+
+ '#_uploadPath strips harmful characters from extension when keepExtensions': function() {
+ form.keepExtensions = true;
+
+ var ext = path.extname(form._uploadPath('fine.jpg?foo=bar'));
+ assert.equal(ext, '.jpg');
+
+ var ext = path.extname(form._uploadPath('fine?foo=bar'));
+ assert.equal(ext, '');
+
+ var ext = path.extname(form._uploadPath('super.cr2+dsad'));
+ assert.equal(ext, '.cr2');
+
+ var ext = path.extname(form._uploadPath('super.bar'));
+ assert.equal(ext, '.bar');
+ },
+});
+
+function makeHeader(filename) {
+ return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"';
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
new file mode 100644
index 0000000..9f1cef8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
@@ -0,0 +1,47 @@
+var http = require('http');
+var fs = require('fs');
+var connections = 0;
+
+var server = http.createServer(function(req, res) {
+ var socket = req.socket;
+ console.log('Request: %s %s -> %s', req.method, req.url, socket.filename);
+
+ req.on('end', function() {
+ if (req.url !== '/') {
+ res.end(JSON.stringify({
+ method: req.method,
+ url: req.url,
+ filename: socket.filename,
+ }));
+ return;
+ }
+
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ '<form action="/upload" enctype="multipart/form-data" method="post">'+
+ '<input type="text" name="title"><br>'+
+ '<input type="file" name="upload" multiple="multiple"><br>'+
+ '<input type="submit" value="Upload">'+
+ '</form>'
+ );
+ });
+});
+
+server.on('connection', function(socket) {
+ connections++;
+
+ socket.id = connections;
+ socket.filename = 'connection-' + socket.id + '.http';
+ socket.file = fs.createWriteStream(socket.filename);
+ socket.pipe(socket.file);
+
+ console.log('--> %s', socket.filename);
+ socket.on('close', function() {
+ console.log('<-- %s', socket.filename);
+ });
+});
+
+var port = process.env.PORT || 8080;
+server.listen(port, function() {
+ console.log('Recording connections on port %s', port);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/History.md b/node_modules/express/node_modules/connect/node_modules/pause/History.md
new file mode 100644
index 0000000..c8aa68f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/History.md
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/node_modules/express/node_modules/connect/node_modules/pause/Makefile
new file mode 100644
index 0000000..4e9c8d3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
new file mode 100644
index 0000000..1cdd68a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
@@ -0,0 +1,29 @@
+
+# pause
+
+ Pause streams...
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/index.js b/node_modules/express/node_modules/connect/node_modules/pause/index.js
new file mode 100644
index 0000000..1b7b379
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/index.js
@@ -0,0 +1,29 @@
+
+module.exports = function(obj){
+ var onData
+ , onEnd
+ , events = [];
+
+ // buffer data
+ obj.on('data', onData = function(data, encoding){
+ events.push(['data', data, encoding]);
+ });
+
+ // buffer end
+ obj.on('end', onEnd = function(data, encoding){
+ events.push(['end', data, encoding]);
+ });
+
+ return {
+ end: function(){
+ obj.removeListener('data', onData);
+ obj.removeListener('end', onEnd);
+ },
+ resume: function(){
+ this.end();
+ for (var i = 0, len = events.length; i < len; ++i) {
+ obj.emit.apply(obj, events[i]);
+ }
+ }
+ };
+}; \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/package.json b/node_modules/express/node_modules/connect/node_modules/pause/package.json
new file mode 100644
index 0000000..c226dc9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "pause",
+ "version": "0.0.1",
+ "description": "Pause streams...",
+ "keywords": [],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "main": "index",
+ "readme": "\n# pause\n\n Pause streams...\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "_id": "pause@0.0.1",
+ "dist": {
+ "shasum": "72e37ac0cb13fba367af37d6ae2c37d75e3029b4"
+ },
+ "_from": "pause@0.0.1",
+ "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
new file mode 100644
index 0000000..49e31da
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "support/expresso"]
+ path = support/expresso
+ url = git://github.com/visionmedia/expresso.git
+[submodule "support/should"]
+ path = support/should
+ url = git://github.com/visionmedia/should.js.git
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
new file mode 100644
index 0000000..e85ce2a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
@@ -0,0 +1,7 @@
+test
+.travis.yml
+benchmark.js
+component.json
+examples.js
+History.md
+Makefile
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
new file mode 100644
index 0000000..27e54a4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
@@ -0,0 +1,58 @@
+# node-querystring
+
+ query string parser for node and the browser 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.
+
+## Installation
+
+ $ npm install qs
+
+## Examples
+
+```js
+var qs = require('qs');
+
+qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');
+// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }
+
+qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})
+// => user[name]=Tobi&user[email]=tobi%40learnboost.com
+```
+
+## Testing
+
+Install dev dependencies:
+
+ $ npm install -d
+
+and execute:
+
+ $ make test
+
+browser:
+
+ $ open test/browser/index.html
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/index.js b/node_modules/express/node_modules/connect/node_modules/qs/index.js
new file mode 100644
index 0000000..590491e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/index.js
@@ -0,0 +1,387 @@
+/**
+ * Object#toString() ref for stringify().
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Object#hasOwnProperty ref
+ */
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Array#indexOf shim.
+ */
+
+var indexOf = typeof Array.prototype.indexOf === 'function'
+ ? function(arr, el) { return arr.indexOf(el); }
+ : function(arr, el) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] === el) return i;
+ }
+ return -1;
+ };
+
+/**
+ * Array.isArray shim.
+ */
+
+var isArray = Array.isArray || function(arr) {
+ return toString.call(arr) == '[object Array]';
+};
+
+/**
+ * Object.keys shim.
+ */
+
+var objectKeys = Object.keys || function(obj) {
+ var ret = [];
+ for (var key in obj) ret.push(key);
+ return ret;
+};
+
+/**
+ * Array#forEach shim.
+ */
+
+var forEach = typeof Array.prototype.forEach === 'function'
+ ? function(arr, fn) { return arr.forEach(fn); }
+ : function(arr, fn) {
+ for (var i = 0; i < arr.length; i++) fn(arr[i]);
+ };
+
+/**
+ * Array#reduce shim.
+ */
+
+var reduce = function(arr, fn, initial) {
+ if (typeof arr.reduce === 'function') return arr.reduce(fn, initial);
+ var res = initial;
+ for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]);
+ return res;
+};
+
+/**
+ * Create a nullary object if possible
+ */
+
+function createObject() {
+ return Object.create
+ ? Object.create(null)
+ : {};
+}
+
+/**
+ * Cache non-integer test regexp.
+ */
+
+var isint = /^[0-9]+$/;
+
+function promote(parent, key) {
+ if (parent[key].length == 0) return parent[key] = createObject();
+ var t = createObject();
+ for (var i in parent[key]) {
+ if (hasOwnProperty.call(parent[key], i)) {
+ t[i] = parent[key][i];
+ }
+ }
+ parent[key] = t;
+ return t;
+}
+
+function parse(parts, parent, key, val) {
+ var part = parts.shift();
+ // end
+ if (!part) {
+ if (isArray(parent[key])) {
+ parent[key].push(val);
+ } else if ('object' == typeof parent[key]) {
+ parent[key] = val;
+ } else if ('undefined' == typeof parent[key]) {
+ parent[key] = val;
+ } else {
+ parent[key] = [parent[key], val];
+ }
+ // array
+ } else {
+ var obj = parent[key] = parent[key] || [];
+ if (']' == part) {
+ if (isArray(obj)) {
+ if ('' != val) obj.push(val);
+ } else if ('object' == typeof obj) {
+ obj[objectKeys(obj).length] = val;
+ } else {
+ obj = parent[key] = [parent[key], val];
+ }
+ // prop
+ } else if (~indexOf(part, ']')) {
+ part = part.substr(0, part.length - 1);
+ if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ // key
+ } else {
+ if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ }
+ }
+}
+
+/**
+ * Merge parent key/val pair.
+ */
+
+function merge(parent, key, val){
+ if (~indexOf(key, ']')) {
+ var parts = key.split('[')
+ , len = parts.length
+ , last = len - 1;
+ parse(parts, parent, 'base', val);
+ // optimize
+ } else {
+ if (!isint.test(key) && isArray(parent.base)) {
+ var t = createObject();
+ for (var k in parent.base) t[k] = parent.base[k];
+ parent.base = t;
+ }
+ set(parent.base, key, val);
+ }
+
+ return parent;
+}
+
+/**
+ * Compact sparse arrays.
+ */
+
+function compact(obj) {
+ if ('object' != typeof obj) return obj;
+
+ if (isArray(obj)) {
+ var ret = [];
+
+ for (var i in obj) {
+ if (hasOwnProperty.call(obj, i)) {
+ ret.push(obj[i]);
+ }
+ }
+
+ return ret;
+ }
+
+ for (var key in obj) {
+ obj[key] = compact(obj[key]);
+ }
+
+ return obj;
+}
+
+/**
+ * Restore Object.prototype.
+ * see pull-request #58
+ */
+
+function restoreProto(obj) {
+ if (!Object.create) return obj;
+ if (isArray(obj)) return obj;
+ if (obj && 'object' != typeof obj) return obj;
+
+ for (var key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ obj[key] = restoreProto(obj[key]);
+ }
+ }
+
+ obj.__proto__ = Object.prototype;
+ return obj;
+}
+
+/**
+ * Parse the given obj.
+ */
+
+function parseObject(obj){
+ var ret = { base: {} };
+
+ forEach(objectKeys(obj), function(name){
+ merge(ret, name, obj[name]);
+ });
+
+ return compact(ret.base);
+}
+
+/**
+ * Parse the given str.
+ */
+
+function parseString(str){
+ var ret = reduce(String(str).split('&'), function(ret, pair){
+ var eql = indexOf(pair, '=')
+ , brace = lastBraceInKey(pair)
+ , key = pair.substr(0, brace || eql)
+ , val = pair.substr(brace || eql, pair.length)
+ , val = val.substr(indexOf(val, '=') + 1, val.length);
+
+ // ?foo
+ if ('' == key) key = pair, val = '';
+ if ('' == key) return ret;
+
+ return merge(ret, decode(key), decode(val));
+ }, { base: createObject() }).base;
+
+ return restoreProto(compact(ret));
+}
+
+/**
+ * Parse the given query `str` or `obj`, returning an object.
+ *
+ * @param {String} str | {Object} obj
+ * @return {Object}
+ * @api public
+ */
+
+exports.parse = function(str){
+ if (null == str || '' == str) return {};
+ return 'object' == typeof str
+ ? parseObject(str)
+ : parseString(str);
+};
+
+/**
+ * Turn the given `obj` into a query string
+ *
+ * @param {Object} obj
+ * @return {String}
+ * @api public
+ */
+
+var stringify = exports.stringify = function(obj, prefix) {
+ if (isArray(obj)) {
+ return stringifyArray(obj, prefix);
+ } else if ('[object Object]' == toString.call(obj)) {
+ return stringifyObject(obj, prefix);
+ } else if ('string' == typeof obj) {
+ return stringifyString(obj, prefix);
+ } else {
+ return prefix + '=' + encodeURIComponent(String(obj));
+ }
+};
+
+/**
+ * Stringify the given `str`.
+ *
+ * @param {String} str
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyString(str, prefix) {
+ if (!prefix) throw new TypeError('stringify expects an object');
+ return prefix + '=' + encodeURIComponent(str);
+}
+
+/**
+ * Stringify the given `arr`.
+ *
+ * @param {Array} arr
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyArray(arr, prefix) {
+ var ret = [];
+ if (!prefix) throw new TypeError('stringify expects an object');
+ for (var i = 0; i < arr.length; i++) {
+ ret.push(stringify(arr[i], prefix + '[' + i + ']'));
+ }
+ return ret.join('&');
+}
+
+/**
+ * Stringify the given `obj`.
+ *
+ * @param {Object} obj
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyObject(obj, prefix) {
+ var ret = []
+ , keys = objectKeys(obj)
+ , key;
+
+ for (var i = 0, len = keys.length; i < len; ++i) {
+ key = keys[i];
+ if ('' == key) continue;
+ if (null == obj[key]) {
+ ret.push(encodeURIComponent(key) + '=');
+ } else {
+ ret.push(stringify(obj[key], prefix
+ ? prefix + '[' + encodeURIComponent(key) + ']'
+ : encodeURIComponent(key)));
+ }
+ }
+
+ return ret.join('&');
+}
+
+/**
+ * Set `obj`'s `key` to `val` respecting
+ * the weird and wonderful syntax of a qs,
+ * where "foo=bar&foo=baz" becomes an array.
+ *
+ * @param {Object} obj
+ * @param {String} key
+ * @param {String} val
+ * @api private
+ */
+
+function set(obj, key, val) {
+ var v = obj[key];
+ if (undefined === v) {
+ obj[key] = val;
+ } else if (isArray(v)) {
+ v.push(val);
+ } else {
+ obj[key] = [v, val];
+ }
+}
+
+/**
+ * Locate last brace in `str` within the key.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function lastBraceInKey(str) {
+ var len = str.length
+ , brace
+ , c;
+ for (var i = 0; i < len; ++i) {
+ c = str[i];
+ if (']' == c) brace = false;
+ if ('[' == c) brace = true;
+ if ('=' == c && !brace) return i;
+ }
+}
+
+/**
+ * Decode `str`.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+function decode(str) {
+ try {
+ return decodeURIComponent(str.replace(/\+/g, ' '));
+ } catch (err) {
+ return str;
+ }
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/package.json b/node_modules/express/node_modules/connect/node_modules/qs/package.json
new file mode 100644
index 0000000..b72410c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "qs",
+ "description": "querystring parser",
+ "version": "0.6.5",
+ "keywords": [
+ "query string",
+ "parser",
+ "component"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/node-querystring.git"
+ },
+ "devDependencies": {
+ "mocha": "*",
+ "expect.js": "*"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "main": "index",
+ "engines": {
+ "node": "*"
+ },
+ "readme": "# node-querystring\n\n query string parser for node and the browser 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.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/node-querystring/issues"
+ },
+ "_id": "qs@0.6.5",
+ "dist": {
+ "shasum": "8e3ecc3aa34363888bd3ab99a71e4babfddc34e2"
+ },
+ "_from": "qs@0.6.5",
+ "_resolved": "https://registry.npmjs.org/qs/-/qs-0.6.5.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/uid2/index.js b/node_modules/express/node_modules/connect/node_modules/uid2/index.js
new file mode 100644
index 0000000..d665f51
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/uid2/index.js
@@ -0,0 +1,49 @@
+/**
+ * Module dependencies
+ */
+
+var crypto = require('crypto');
+
+/**
+ * The size ratio between a base64 string and the equivalent byte buffer
+ */
+
+var ratio = Math.log(64) / Math.log(256);
+
+/**
+ * Make a Base64 string ready for use in URLs
+ *
+ * @param {String}
+ * @returns {String}
+ * @api private
+ */
+
+function urlReady(str) {
+ return str.replace(/\+/g, '_').replace(/\//g, '-');
+}
+
+/**
+ * Generate an Unique Id
+ *
+ * @param {Number} length The number of chars of the uid
+ * @param {Number} cb (optional) Callback for async uid generation
+ * @api public
+ */
+
+function uid(length, cb) {
+ var numbytes = Math.ceil(length * ratio);
+ if (typeof cb === 'undefined') {
+ return urlReady(crypto.randomBytes(numbytes).toString('base64').slice(0, length));
+ } else {
+ crypto.randomBytes(numbytes, function(err, bytes) {
+ if (err) return cb(err);
+ cb(null, urlReady(bytes.toString('base64').slice(0, length)));
+ })
+ }
+}
+
+/**
+ * Exports
+ */
+
+module.exports = uid;
diff --git a/node_modules/express/node_modules/connect/node_modules/uid2/package.json b/node_modules/express/node_modules/connect/node_modules/uid2/package.json
new file mode 100644
index 0000000..12ab8c8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/uid2/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "uid2",
+ "description": "strong uid",
+ "tags": [
+ "uid"
+ ],
+ "version": "0.0.2",
+ "dependencies": {},
+ "readme": "ERROR: No README data found!",
+ "_id": "uid2@0.0.2",
+ "dist": {
+ "shasum": "7b0863f685a8552f0a0250ce5b82570f4fb0f87e"
+ },
+ "_from": "uid2@0.0.2",
+ "_resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.2.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/package.json b/node_modules/express/node_modules/connect/package.json
new file mode 100644
index 0000000..7a9c533
--- /dev/null
+++ b/node_modules/express/node_modules/connect/package.json
@@ -0,0 +1,59 @@
+{
+ "name": "connect",
+ "version": "2.8.4",
+ "description": "High performance middleware framework",
+ "keywords": [
+ "framework",
+ "web",
+ "middleware",
+ "connect",
+ "rack"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/senchalabs/connect.git"
+ },
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "dependencies": {
+ "qs": "0.6.5",
+ "formidable": "1.0.14",
+ "cookie-signature": "1.0.1",
+ "buffer-crc32": "0.2.1",
+ "cookie": "0.1.0",
+ "send": "0.1.3",
+ "bytes": "0.2.0",
+ "fresh": "0.1.0",
+ "pause": "0.0.1",
+ "uid2": "0.0.2",
+ "debug": "*",
+ "methods": "0.0.1"
+ },
+ "devDependencies": {
+ "should": "*",
+ "mocha": "*",
+ "jade": "*",
+ "dox": "*"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "scripts": {
+ "test": "make"
+ },
+ "readme": "[![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect)\n# Connect\n\n Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance \"plugins\" known as _middleware_.\n\n Connect is bundled with over _20_ commonly used middleware, including\n a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/).\n\n```js\nvar connect = require('connect')\n , http = require('http');\n\nvar app = connect()\n .use(connect.favicon())\n .use(connect.logger('dev'))\n .use(connect.static('public'))\n .use(connect.directory('public'))\n .use(connect.cookieParser())\n .use(connect.session({ secret: 'my secret here' }))\n .use(function(req, res){\n res.end('Hello from Connect!\\n');\n });\n\nhttp.createServer(app).listen(3000);\n```\n\n## Middleware\n\n - [csrf](http://www.senchalabs.org/connect/csrf.html)\n - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)\n - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)\n - [json](http://www.senchalabs.org/connect/json.html)\n - [multipart](http://www.senchalabs.org/connect/multipart.html)\n - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)\n - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)\n - [directory](http://www.senchalabs.org/connect/directory.html)\n - [compress](http://www.senchalabs.org/connect/compress.html)\n - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)\n - [favicon](http://www.senchalabs.org/connect/favicon.html)\n - [limit](http://www.senchalabs.org/connect/limit.html)\n - [logger](http://www.senchalabs.org/connect/logger.html)\n - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)\n - [query](http://www.senchalabs.org/connect/query.html)\n - [responseTime](http://www.senchalabs.org/connect/responseTime.html)\n - [session](http://www.senchalabs.org/connect/session.html)\n - [static](http://www.senchalabs.org/connect/static.html)\n - [staticCache](http://www.senchalabs.org/connect/staticCache.html)\n - [vhost](http://www.senchalabs.org/connect/vhost.html)\n - [subdomains](http://www.senchalabs.org/connect/subdomains.html)\n - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)\n\n## Running Tests\n\nfirst:\n\n $ npm install -d\n\nthen:\n\n $ make test\n\n## Authors\n\n Below is the output from [git-summary](http://github.com/visionmedia/git-extras).\n\n\n project: connect\n commits: 2033\n active : 301 days\n files : 171\n authors: \n 1414\tTj Holowaychuk 69.6%\n 298\tvisionmedia 14.7%\n 191\tTim Caswell 9.4%\n 51\tTJ Holowaychuk 2.5%\n 10\tRyan Olds 0.5%\n 8\tAstro 0.4%\n 5\tNathan Rajlich 0.2%\n 5\tJakub Nešetřil 0.2%\n 3\tDaniel Dickison 0.1%\n 3\tDavid Rio Deiros 0.1%\n 3\tAlexander Simmerl 0.1%\n 3\tAndreas Lind Petersen 0.1%\n 2\tAaron Heckmann 0.1%\n 2\tJacques Crocker 0.1%\n 2\tFabian Jakobs 0.1%\n 2\tBrian J Brennan 0.1%\n 2\tAdam Malcontenti-Wilson 0.1%\n 2\tGlen Mailer 0.1%\n 2\tJames Campos 0.1%\n 1\tTrent Mick 0.0%\n 1\tTroy Kruthoff 0.0%\n 1\tWei Zhu 0.0%\n 1\tcomerc 0.0%\n 1\tdarobin 0.0%\n 1\tnateps 0.0%\n 1\tMarco Sanson 0.0%\n 1\tArthur Taylor 0.0%\n 1\tAseem Kishore 0.0%\n 1\tBart Teeuwisse 0.0%\n 1\tCameron Howey 0.0%\n 1\tChad Weider 0.0%\n 1\tCraig Barnes 0.0%\n 1\tEran Hammer-Lahav 0.0%\n 1\tGregory McWhirter 0.0%\n 1\tGuillermo Rauch 0.0%\n 1\tJae Kwon 0.0%\n 1\tJakub Nesetril 0.0%\n 1\tJoshua Peek 0.0%\n 1\tJxck 0.0%\n 1\tAJ ONeal 0.0%\n 1\tMichael Hemesath 0.0%\n 1\tMorten Siebuhr 0.0%\n 1\tSamori Gorse 0.0%\n 1\tTom Jensen 0.0%\n\n## Node Compatibility\n\n Connect `< 1.x` is compatible with node 0.2.x\n\n\n Connect `1.x` is compatible with node 0.4.x\n\n\n Connect (_master_) `2.x` is compatible with node 0.6.x\n\n## CLA\n\n [http://sencha.com/cla](http://sencha.com/cla)\n\n## License\n\nView the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).\n",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/senchalabs/connect/issues"
+ },
+ "_id": "connect@2.8.4",
+ "dist": {
+ "shasum": "3a7ee41144e9bd2a16724d7ac563f3d041cefa74"
+ },
+ "_from": "connect@2.8.4",
+ "_resolved": "https://registry.npmjs.org/connect/-/connect-2.8.4.tgz"
+}
diff --git a/node_modules/express/node_modules/connect/test.js b/node_modules/express/node_modules/connect/test.js
new file mode 100644
index 0000000..ef743f2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/test.js
@@ -0,0 +1,8 @@
+var crypto = require('crypto')
+
+exports.uid = function(len) {
+ return crypto.randomBytes(Math.ceil(len * 3 / 4))
+ .toString('hex')
+};
+
+console.log(exports.uid(10));
diff --git a/node_modules/express/node_modules/cookie-signature/.npmignore b/node_modules/express/node_modules/cookie-signature/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/express/node_modules/cookie-signature/History.md b/node_modules/express/node_modules/cookie-signature/History.md
new file mode 100644
index 0000000..9e30179
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/History.md
@@ -0,0 +1,11 @@
+
+1.0.1 / 2013-04-15
+==================
+
+ * Revert "Changed underlying HMAC algo. to sha512."
+ * Revert "Fix for timing attacks on MAC verification."
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/cookie-signature/Makefile b/node_modules/express/node_modules/cookie-signature/Makefile
new file mode 100644
index 0000000..4e9c8d3
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/cookie-signature/Readme.md b/node_modules/express/node_modules/cookie-signature/Readme.md
new file mode 100644
index 0000000..2559e84
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/Readme.md
@@ -0,0 +1,42 @@
+
+# cookie-signature
+
+ Sign and unsign cookies.
+
+## Example
+
+```js
+var cookie = require('cookie-signature');
+
+var val = cookie.sign('hello', 'tobiiscool');
+val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
+
+var val = cookie.sign('hello', 'tobiiscool');
+cookie.unsign(val, 'tobiiscool').should.equal('hello');
+cookie.unsign(val, 'luna').should.be.false;
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 LearnBoost &lt;tj@learnboost.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/cookie-signature/index.js b/node_modules/express/node_modules/cookie-signature/index.js
new file mode 100644
index 0000000..ed62814
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/index.js
@@ -0,0 +1,42 @@
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto');
+
+/**
+ * Sign the given `val` with `secret`.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(val, secret){
+ if ('string' != typeof val) throw new TypeError('cookie required');
+ if ('string' != typeof secret) throw new TypeError('secret required');
+ return val + '.' + crypto
+ .createHmac('sha256', secret)
+ .update(val)
+ .digest('base64')
+ .replace(/\=+$/, '');
+};
+
+/**
+ * Unsign and decode the given `val` with `secret`,
+ * returning `false` if the signature is invalid.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String|Boolean}
+ * @api private
+ */
+
+exports.unsign = function(val, secret){
+ if ('string' != typeof val) throw new TypeError('cookie required');
+ if ('string' != typeof secret) throw new TypeError('secret required');
+ var str = val.slice(0, val.lastIndexOf('.'));
+ return exports.sign(str, secret) == val ? str : false;
+};
diff --git a/node_modules/express/node_modules/cookie-signature/package.json b/node_modules/express/node_modules/cookie-signature/package.json
new file mode 100644
index 0000000..03b4718
--- /dev/null
+++ b/node_modules/express/node_modules/cookie-signature/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "cookie-signature",
+ "version": "1.0.1",
+ "description": "Sign and unsign cookies",
+ "keywords": [
+ "cookie",
+ "sign",
+ "unsign"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@learnboost.com"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "main": "index",
+ "readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost &lt;tj@learnboost.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "_id": "cookie-signature@1.0.1",
+ "dist": {
+ "shasum": "95214a8d107a85a32f3eaa98b908ddd99af75bd2"
+ },
+ "_from": "cookie-signature@1.0.1",
+ "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz"
+}
diff --git a/node_modules/express/node_modules/cookie/.npmignore b/node_modules/express/node_modules/cookie/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/express/node_modules/cookie/.travis.yml b/node_modules/express/node_modules/cookie/.travis.yml
new file mode 100644
index 0000000..9400c11
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - "0.6"
+ - "0.8"
+ - "0.10"
diff --git a/node_modules/express/node_modules/cookie/LICENSE b/node_modules/express/node_modules/cookie/LICENSE
new file mode 100644
index 0000000..249d9de
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/LICENSE
@@ -0,0 +1,9 @@
+// MIT License
+
+Copyright (C) Roman Shtylman <shtylman@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/cookie/README.md b/node_modules/express/node_modules/cookie/README.md
new file mode 100644
index 0000000..5187ed1
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/README.md
@@ -0,0 +1,44 @@
+# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) #
+
+cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.
+
+See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.
+
+## how?
+
+```
+npm install cookie
+```
+
+```javascript
+var cookie = require('cookie');
+
+var hdr = cookie.serialize('foo', 'bar');
+// hdr = 'foo=bar';
+
+var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
+// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };
+```
+
+## more
+
+The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.
+
+### path
+> cookie path
+
+### expires
+> absolute expiration date for the cookie (Date object)
+
+### maxAge
+> relative max age of the cookie from when the client receives it (seconds)
+
+### domain
+> domain for the cookie
+
+### secure
+> true or false
+
+### httpOnly
+> true or false
+
diff --git a/node_modules/express/node_modules/cookie/index.js b/node_modules/express/node_modules/cookie/index.js
new file mode 100644
index 0000000..16bdb65
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/index.js
@@ -0,0 +1,70 @@
+
+/// Serialize the a name value pair into a cookie string suitable for
+/// http headers. An optional options object specified cookie parameters
+///
+/// serialize('foo', 'bar', { httpOnly: true })
+/// => "foo=bar; httpOnly"
+///
+/// @param {String} name
+/// @param {String} val
+/// @param {Object} options
+/// @return {String}
+var serialize = function(name, val, opt){
+ opt = opt || {};
+ var enc = opt.encode || encode;
+ var pairs = [name + '=' + enc(val)];
+
+ if (opt.maxAge) pairs.push('Max-Age=' + opt.maxAge);
+ if (opt.domain) pairs.push('Domain=' + opt.domain);
+ if (opt.path) pairs.push('Path=' + opt.path);
+ if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString());
+ if (opt.httpOnly) pairs.push('HttpOnly');
+ if (opt.secure) pairs.push('Secure');
+
+ return pairs.join('; ');
+};
+
+/// Parse the given cookie header string into an object
+/// The object has the various cookies as keys(names) => values
+/// @param {String} str
+/// @return {Object}
+var parse = function(str, opt) {
+ opt = opt || {};
+ var obj = {}
+ var pairs = str.split(/[;,] */);
+ var dec = opt.decode || decode;
+
+ pairs.forEach(function(pair) {
+ var eq_idx = pair.indexOf('=')
+
+ // skip things that don't look like key=value
+ if (eq_idx < 0) {
+ return;
+ }
+
+ var key = pair.substr(0, eq_idx).trim()
+ var val = pair.substr(++eq_idx, pair.length).trim();
+
+ // quoted values
+ if ('"' == val[0]) {
+ val = val.slice(1, -1);
+ }
+
+ // only assign once
+ if (undefined == obj[key]) {
+ try {
+ obj[key] = dec(val);
+ } catch (e) {
+ obj[key] = val;
+ }
+ }
+ });
+
+ return obj;
+};
+
+var encode = encodeURIComponent;
+var decode = decodeURIComponent;
+
+module.exports.serialize = serialize;
+module.exports.parse = parse;
diff --git a/node_modules/express/node_modules/cookie/package.json b/node_modules/express/node_modules/cookie/package.json
new file mode 100644
index 0000000..df900a0
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/package.json
@@ -0,0 +1,40 @@
+{
+ "author": {
+ "name": "Roman Shtylman",
+ "email": "shtylman@gmail.com"
+ },
+ "name": "cookie",
+ "description": "cookie parsing and serialization",
+ "version": "0.1.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/shtylman/node-cookie.git"
+ },
+ "keywords": [
+ "cookie",
+ "cookies"
+ ],
+ "main": "index.js",
+ "scripts": {
+ "test": "mocha"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "1.x.x"
+ },
+ "optionalDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "readme": "# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) #\n\ncookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.\n\nSee [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.\n\n## how?\n\n```\nnpm install cookie\n```\n\n```javascript\nvar cookie = require('cookie');\n\nvar hdr = cookie.serialize('foo', 'bar');\n// hdr = 'foo=bar';\n\nvar cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');\n// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };\n```\n\n## more\n\nThe serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.\n\n### path\n> cookie path\n\n### expires\n> absolute expiration date for the cookie (Date object)\n\n### maxAge\n> relative max age of the cookie from when the client receives it (seconds)\n\n### domain\n> domain for the cookie\n\n### secure\n> true or false\n\n### httpOnly\n> true or false\n\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/shtylman/node-cookie/issues"
+ },
+ "_id": "cookie@0.1.0",
+ "dist": {
+ "shasum": "5b90266eae9967ea1524d1374274aa2078d8b527"
+ },
+ "_from": "cookie@0.1.0",
+ "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz"
+}
diff --git a/node_modules/express/node_modules/cookie/test/mocha.opts b/node_modules/express/node_modules/cookie/test/mocha.opts
new file mode 100644
index 0000000..e2bfcc5
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/test/mocha.opts
@@ -0,0 +1 @@
+--ui qunit
diff --git a/node_modules/express/node_modules/cookie/test/parse.js b/node_modules/express/node_modules/cookie/test/parse.js
new file mode 100644
index 0000000..c6c27a2
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/test/parse.js
@@ -0,0 +1,44 @@
+
+var assert = require('assert');
+
+var cookie = require('..');
+
+suite('parse');
+
+test('basic', function() {
+ assert.deepEqual({ foo: 'bar' }, cookie.parse('foo=bar'));
+ assert.deepEqual({ foo: '123' }, cookie.parse('foo=123'));
+});
+
+test('ignore spaces', function() {
+ assert.deepEqual({ FOO: 'bar', baz: 'raz' },
+ cookie.parse('FOO = bar; baz = raz'));
+});
+
+test('escaping', function() {
+ assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' },
+ cookie.parse('foo="bar=123456789&name=Magic+Mouse"'));
+
+ assert.deepEqual({ email: ' ",;/' },
+ cookie.parse('email=%20%22%2c%3b%2f'));
+});
+
+test('ignore escaping error and return original value', function() {
+ assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar'));
+});
+
+test('ignore non values', function() {
+ assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar;HttpOnly;Secure'));
+});
+
+test('unencoded', function() {
+ assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' },
+ cookie.parse('foo="bar=123456789&name=Magic+Mouse"',{
+ decode: function(value) { return value; }
+ }));
+
+ assert.deepEqual({ email: '%20%22%2c%3b%2f' },
+ cookie.parse('email=%20%22%2c%3b%2f',{
+ decode: function(value) { return value; }
+ }));
+})
diff --git a/node_modules/express/node_modules/cookie/test/serialize.js b/node_modules/express/node_modules/cookie/test/serialize.js
new file mode 100644
index 0000000..86bb8c9
--- /dev/null
+++ b/node_modules/express/node_modules/cookie/test/serialize.js
@@ -0,0 +1,64 @@
+// builtin
+var assert = require('assert');
+
+var cookie = require('..');
+
+suite('serialize');
+
+test('basic', function() {
+ assert.equal('foo=bar', cookie.serialize('foo', 'bar'));
+ assert.equal('foo=bar%20baz', cookie.serialize('foo', 'bar baz'));
+});
+
+test('path', function() {
+ assert.equal('foo=bar; Path=/', cookie.serialize('foo', 'bar', {
+ path: '/'
+ }));
+});
+
+test('secure', function() {
+ assert.equal('foo=bar; Secure', cookie.serialize('foo', 'bar', {
+ secure: true
+ }));
+
+ assert.equal('foo=bar', cookie.serialize('foo', 'bar', {
+ secure: false
+ }));
+});
+
+test('domain', function() {
+ assert.equal('foo=bar; Domain=example.com', cookie.serialize('foo', 'bar', {
+ domain: 'example.com'
+ }));
+});
+
+test('httpOnly', function() {
+ assert.equal('foo=bar; HttpOnly', cookie.serialize('foo', 'bar', {
+ httpOnly: true
+ }));
+});
+
+test('maxAge', function() {
+ assert.equal('foo=bar; Max-Age=1000', cookie.serialize('foo', 'bar', {
+ maxAge: 1000
+ }));
+});
+
+test('escaping', function() {
+ assert.deepEqual('cat=%2B%20', cookie.serialize('cat', '+ '));
+});
+
+test('parse->serialize', function() {
+
+ assert.deepEqual({ cat: 'foo=123&name=baz five' }, cookie.parse(
+ cookie.serialize('cat', 'foo=123&name=baz five')));
+
+ assert.deepEqual({ cat: ' ";/' }, cookie.parse(
+ cookie.serialize('cat', ' ";/')));
+});
+
+test('unencoded', function() {
+ assert.deepEqual('cat=+ ', cookie.serialize('cat', '+ ', {
+ encode: function(value) { return value; }
+ }));
+})
diff --git a/node_modules/express/node_modules/debug/.npmignore b/node_modules/express/node_modules/debug/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/express/node_modules/debug/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/express/node_modules/debug/History.md b/node_modules/express/node_modules/debug/History.md
new file mode 100644
index 0000000..f023269
--- /dev/null
+++ b/node_modules/express/node_modules/debug/History.md
@@ -0,0 +1,62 @@
+
+0.7.2 / 2013-02-06
+==================
+
+ * fix package.json
+ * fix: Mobile Safari (private mode) is broken with debug
+ * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
+
+0.7.1 / 2013-02-05
+==================
+
+ * add repository URL to package.json
+ * add DEBUG_COLORED to force colored output
+ * add browserify support
+ * fix component. Closes #24
+
+0.7.0 / 2012-05-04
+==================
+
+ * Added .component to package.json
+ * Added debug.component.js build
+
+0.6.0 / 2012-03-16
+==================
+
+ * Added support for "-" prefix in DEBUG [Vinay Pulim]
+ * Added `.enabled` flag to the node version [TooTallNate]
+
+0.5.0 / 2012-02-02
+==================
+
+ * Added: humanize diffs. Closes #8
+ * Added `debug.disable()` to the CS variant
+ * Removed padding. Closes #10
+ * Fixed: persist client-side variant again. Closes #9
+
+0.4.0 / 2012-02-01
+==================
+
+ * Added browser variant support for older browsers [TooTallNate]
+ * Added `debug.enable('project:*')` to browser variant [TooTallNate]
+ * Added padding to diff (moved it to the right)
+
+0.3.0 / 2012-01-26
+==================
+
+ * Added millisecond diff when isatty, otherwise UTC string
+
+0.2.0 / 2012-01-22
+==================
+
+ * Added wildcard support
+
+0.1.0 / 2011-12-02
+==================
+
+ * Added: remove colors unless stderr isatty [TooTallNate]
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/debug/Readme.md b/node_modules/express/node_modules/debug/Readme.md
new file mode 100644
index 0000000..15ee501
--- /dev/null
+++ b/node_modules/express/node_modules/debug/Readme.md
@@ -0,0 +1,115 @@
+
+# debug
+
+ tiny node.js debugging utility modelled after node core's debugging technique.
+
+## Installation
+
+```
+$ npm install debug
+```
+
+## Usage
+
+ With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
+
+Example _app.js_:
+
+```js
+var debug = require('debug')('http')
+ , http = require('http')
+ , name = 'My App';
+
+// fake app
+
+debug('booting %s', name);
+
+http.createServer(function(req, res){
+ debug(req.method + ' ' + req.url);
+ res.end('hello\n');
+}).listen(3000, function(){
+ debug('listening');
+});
+
+// fake worker of some kind
+
+require('./worker');
+```
+
+Example _worker.js_:
+
+```js
+var debug = require('debug')('worker');
+
+setInterval(function(){
+ debug('doing some work');
+}, 1000);
+```
+
+ The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
+
+ ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
+
+ ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
+
+## Millisecond diff
+
+ When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
+
+ ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
+
+ When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
+
+ ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
+
+## Conventions
+
+ If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
+
+## Wildcards
+
+ The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
+
+ You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:".
+
+## Browser support
+
+ Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
+
+```js
+a = debug('worker:a');
+b = debug('worker:b');
+
+setInterval(function(){
+ a('doing some work');
+}, 1000);
+
+setInterval(function(){
+ a('doing some work');
+}, 1200);
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/express/node_modules/debug/component.json b/node_modules/express/node_modules/debug/component.json
new file mode 100644
index 0000000..4ad0971
--- /dev/null
+++ b/node_modules/express/node_modules/debug/component.json
@@ -0,0 +1,9 @@
+{
+ "name": "debug",
+ "repo": "visionmedia/debug",
+ "description": "small debugging utility",
+ "version": "0.7.2",
+ "keywords": ["debug", "log", "debugger"],
+ "scripts": ["index.js", "debug.js"],
+ "dependencies": {}
+}
diff --git a/node_modules/express/node_modules/debug/debug.js b/node_modules/express/node_modules/debug/debug.js
new file mode 100644
index 0000000..e47ba5b
--- /dev/null
+++ b/node_modules/express/node_modules/debug/debug.js
@@ -0,0 +1,124 @@
+
+/**
+ * Expose `debug()` as the module.
+ */
+
+module.exports = debug;
+
+/**
+ * Create a debugger with the given `name`.
+ *
+ * @param {String} name
+ * @return {Type}
+ * @api public
+ */
+
+function debug(name) {
+ if (!debug.enabled(name)) return function(){};
+
+ return function(fmt){
+ var curr = new Date;
+ var ms = curr - (debug[name] || curr);
+ debug[name] = curr;
+
+ fmt = name
+ + ' '
+ + fmt
+ + ' +' + debug.humanize(ms);
+
+ // This hackery is required for IE8
+ // where `console.log` doesn't have 'apply'
+ window.console
+ && console.log
+ && Function.prototype.apply.call(console.log, console, arguments);
+ }
+}
+
+/**
+ * The currently active debug mode names.
+ */
+
+debug.names = [];
+debug.skips = [];
+
+/**
+ * Enables a debug mode by name. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+debug.enable = function(name) {
+ try {
+ localStorage.debug = name;
+ } catch(e){}
+
+ var split = (name || '').split(/[\s,]+/)
+ , len = split.length;
+
+ for (var i = 0; i < len; i++) {
+ name = split[i].replace('*', '.*?');
+ if (name[0] === '-') {
+ debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
+ }
+ else {
+ debug.names.push(new RegExp('^' + name + '$'));
+ }
+ }
+};
+
+/**
+ * Disable debug output.
+ *
+ * @api public
+ */
+
+debug.disable = function(){
+ debug.enable('');
+};
+
+/**
+ * Humanize the given `ms`.
+ *
+ * @param {Number} m
+ * @return {String}
+ * @api private
+ */
+
+debug.humanize = function(ms) {
+ var sec = 1000
+ , min = 60 * 1000
+ , hour = 60 * min;
+
+ if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
+ if (ms >= min) return (ms / min).toFixed(1) + 'm';
+ if (ms >= sec) return (ms / sec | 0) + 's';
+ return ms + 'ms';
+};
+
+/**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+
+debug.enabled = function(name) {
+ for (var i = 0, len = debug.skips.length; i < len; i++) {
+ if (debug.skips[i].test(name)) {
+ return false;
+ }
+ }
+ for (var i = 0, len = debug.names.length; i < len; i++) {
+ if (debug.names[i].test(name)) {
+ return true;
+ }
+ }
+ return false;
+};
+
+// persist
+
+if (window.localStorage) debug.enable(localStorage.debug);
diff --git a/node_modules/express/node_modules/debug/example/app.js b/node_modules/express/node_modules/debug/example/app.js
new file mode 100644
index 0000000..05374d9
--- /dev/null
+++ b/node_modules/express/node_modules/debug/example/app.js
@@ -0,0 +1,19 @@
+
+var debug = require('../')('http')
+ , http = require('http')
+ , name = 'My App';
+
+// fake app
+
+debug('booting %s', name);
+
+http.createServer(function(req, res){
+ debug(req.method + ' ' + req.url);
+ res.end('hello\n');
+}).listen(3000, function(){
+ debug('listening');
+});
+
+// fake worker of some kind
+
+require('./worker'); \ No newline at end of file
diff --git a/node_modules/express/node_modules/debug/example/browser.html b/node_modules/express/node_modules/debug/example/browser.html
new file mode 100644
index 0000000..7510eee
--- /dev/null
+++ b/node_modules/express/node_modules/debug/example/browser.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>debug()</title>
+ <script src="../debug.js"></script>
+ <script>
+ // type debug.enable('*') in
+ // the console and refresh :)
+
+ a = debug('worker:a');
+ b = debug('worker:b');
+
+ setInterval(function(){
+ a('doing some work');
+ }, 1000);
+
+ setInterval(function(){
+ a('doing some work');
+ }, 1200);
+ </script>
+ </head>
+ <body>
+
+ </body>
+</html>
diff --git a/node_modules/express/node_modules/debug/example/wildcards.js b/node_modules/express/node_modules/debug/example/wildcards.js
new file mode 100644
index 0000000..1fdac20
--- /dev/null
+++ b/node_modules/express/node_modules/debug/example/wildcards.js
@@ -0,0 +1,10 @@
+
+var debug = {
+ foo: require('../')('test:foo'),
+ bar: require('../')('test:bar'),
+ baz: require('../')('test:baz')
+};
+
+debug.foo('foo')
+debug.bar('bar')
+debug.baz('baz') \ No newline at end of file
diff --git a/node_modules/express/node_modules/debug/example/worker.js b/node_modules/express/node_modules/debug/example/worker.js
new file mode 100644
index 0000000..7f6d288
--- /dev/null
+++ b/node_modules/express/node_modules/debug/example/worker.js
@@ -0,0 +1,22 @@
+
+// DEBUG=* node example/worker
+// DEBUG=worker:* node example/worker
+// DEBUG=worker:a node example/worker
+// DEBUG=worker:b node example/worker
+
+var a = require('../')('worker:a')
+ , b = require('../')('worker:b');
+
+function work() {
+ a('doing lots of uninteresting work');
+ setTimeout(work, Math.random() * 1000);
+}
+
+work();
+
+function workb() {
+ b('doing some work');
+ setTimeout(workb, Math.random() * 2000);
+}
+
+workb(); \ No newline at end of file
diff --git a/node_modules/express/node_modules/debug/index.js b/node_modules/express/node_modules/debug/index.js
new file mode 100644
index 0000000..e02c13b
--- /dev/null
+++ b/node_modules/express/node_modules/debug/index.js
@@ -0,0 +1,5 @@
+if ('undefined' == typeof window) {
+ module.exports = require('./lib/debug');
+} else {
+ module.exports = require('./debug');
+}
diff --git a/node_modules/express/node_modules/debug/lib/debug.js b/node_modules/express/node_modules/debug/lib/debug.js
new file mode 100644
index 0000000..0b07aa1
--- /dev/null
+++ b/node_modules/express/node_modules/debug/lib/debug.js
@@ -0,0 +1,134 @@
+/**
+ * Module dependencies.
+ */
+
+var tty = require('tty');
+
+/**
+ * Expose `debug()` as the module.
+ */
+
+module.exports = debug;
+
+/**
+ * Enabled debuggers.
+ */
+
+var names = []
+ , skips = [];
+
+(process.env.DEBUG || '')
+ .split(/[\s,]+/)
+ .forEach(function(name){
+ name = name.replace('*', '.*?');
+ if (name[0] === '-') {
+ skips.push(new RegExp('^' + name.substr(1) + '$'));
+ } else {
+ names.push(new RegExp('^' + name + '$'));
+ }
+ });
+
+/**
+ * Colors.
+ */
+
+var colors = [6, 2, 3, 4, 5, 1];
+
+/**
+ * Previous debug() call.
+ */
+
+var prev = {};
+
+/**
+ * Previously assigned color.
+ */
+
+var prevColor = 0;
+
+/**
+ * Is stdout a TTY? Colored output is disabled when `true`.
+ */
+
+var isatty = tty.isatty(2);
+
+/**
+ * Select a color.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+function color() {
+ return colors[prevColor++ % colors.length];
+}
+
+/**
+ * Humanize the given `ms`.
+ *
+ * @param {Number} m
+ * @return {String}
+ * @api private
+ */
+
+function humanize(ms) {
+ var sec = 1000
+ , min = 60 * 1000
+ , hour = 60 * min;
+
+ if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
+ if (ms >= min) return (ms / min).toFixed(1) + 'm';
+ if (ms >= sec) return (ms / sec | 0) + 's';
+ return ms + 'ms';
+}
+
+/**
+ * Create a debugger with the given `name`.
+ *
+ * @param {String} name
+ * @return {Type}
+ * @api public
+ */
+
+function debug(name) {
+ function disabled(){}
+ disabled.enabled = false;
+
+ var match = skips.some(function(re){
+ return re.test(name);
+ });
+
+ if (match) return disabled;
+
+ match = names.some(function(re){
+ return re.test(name);
+ });
+
+ if (!match) return disabled;
+ var c = color();
+
+ function colored(fmt) {
+ var curr = new Date;
+ var ms = curr - (prev[name] || curr);
+ prev[name] = curr;
+
+ fmt = ' \u001b[9' + c + 'm' + name + ' '
+ + '\u001b[3' + c + 'm\u001b[90m'
+ + fmt + '\u001b[3' + c + 'm'
+ + ' +' + humanize(ms) + '\u001b[0m';
+
+ console.error.apply(this, arguments);
+ }
+
+ function plain(fmt) {
+ fmt = new Date().toUTCString()
+ + ' ' + name + ' ' + fmt;
+ console.error.apply(this, arguments);
+ }
+
+ colored.enabled = plain.enabled = true;
+
+ return isatty || process.env.DEBUG_COLORS
+ ? colored
+ : plain;
+}
diff --git a/node_modules/express/node_modules/debug/package.json b/node_modules/express/node_modules/debug/package.json
new file mode 100644
index 0000000..adcadad
--- /dev/null
+++ b/node_modules/express/node_modules/debug/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "debug",
+ "version": "0.7.2",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/debug.git"
+ },
+ "description": "small debugging utility",
+ "keywords": [
+ "debug",
+ "log",
+ "debugger"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*"
+ },
+ "main": "lib/debug.js",
+ "browserify": "debug.js",
+ "engines": {
+ "node": "*"
+ },
+ "component": {
+ "scripts": {
+ "debug/index.js": "index.js",
+ "debug/debug.js": "debug.js"
+ }
+ },
+ "readme": "\n# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Usage\n\n With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/debug/issues"
+ },
+ "_id": "debug@0.7.2",
+ "dist": {
+ "shasum": "87611f055831a342fffa832ddb46d8ba85d70153"
+ },
+ "_from": "debug@*",
+ "_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.2.tgz"
+}
diff --git a/node_modules/express/node_modules/fresh/.npmignore b/node_modules/express/node_modules/fresh/.npmignore
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/node_modules/express/node_modules/fresh/.npmignore
@@ -0,0 +1 @@
+test
diff --git a/node_modules/express/node_modules/fresh/Makefile b/node_modules/express/node_modules/fresh/Makefile
new file mode 100644
index 0000000..8e8640f
--- /dev/null
+++ b/node_modules/express/node_modules/fresh/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec \
+ --require should
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/fresh/Readme.md b/node_modules/express/node_modules/fresh/Readme.md
new file mode 100644
index 0000000..273130d
--- /dev/null
+++ b/node_modules/express/node_modules/fresh/Readme.md
@@ -0,0 +1,32 @@
+
+# node-fresh
+
+ HTTP response freshness testing
+
+## fresh(req, res)
+
+ Check freshness of `req` and `res` headers.
+
+ When the cache is "fresh" __true__ is returned,
+ otherwise __false__ is returned to indicate that
+ the cache is now stale.
+
+## Example:
+
+```js
+var req = { 'if-none-match': 'tobi' };
+var res = { 'etag': 'luna' };
+fresh(req, res);
+// => false
+
+var req = { 'if-none-match': 'tobi' };
+var res = { 'etag': 'tobi' };
+fresh(req, res);
+// => true
+```
+
+## Installation
+
+```
+$ npm install fresh
+``` \ No newline at end of file
diff --git a/node_modules/express/node_modules/fresh/index.js b/node_modules/express/node_modules/fresh/index.js
new file mode 100644
index 0000000..b2f4d41
--- /dev/null
+++ b/node_modules/express/node_modules/fresh/index.js
@@ -0,0 +1,49 @@
+
+/**
+ * Expose `fresh()`.
+ */
+
+module.exports = fresh;
+
+/**
+ * Check freshness of `req` and `res` headers.
+ *
+ * When the cache is "fresh" __true__ is returned,
+ * otherwise __false__ is returned to indicate that
+ * the cache is now stale.
+ *
+ * @param {Object} req
+ * @param {Object} res
+ * @return {Boolean}
+ * @api public
+ */
+
+function fresh(req, res) {
+ // defaults
+ var etagMatches = true;
+ var notModified = true;
+
+ // fields
+ var modifiedSince = req['if-modified-since'];
+ var noneMatch = req['if-none-match'];
+ var lastModified = res['last-modified'];
+ var etag = res['etag'];
+
+ // unconditional request
+ if (!modifiedSince && !noneMatch) return false;
+
+ // parse if-none-match
+ if (noneMatch) noneMatch = noneMatch.split(/ *, */);
+
+ // if-none-match
+ if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
+
+ // if-modified-since
+ if (modifiedSince) {
+ modifiedSince = new Date(modifiedSince);
+ lastModified = new Date(lastModified);
+ notModified = lastModified <= modifiedSince;
+ }
+
+ return !! (etagMatches && notModified);
+} \ No newline at end of file
diff --git a/node_modules/express/node_modules/fresh/package.json b/node_modules/express/node_modules/fresh/package.json
new file mode 100644
index 0000000..027de28
--- /dev/null
+++ b/node_modules/express/node_modules/fresh/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "fresh",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "description": "HTTP response freshness testing",
+ "version": "0.1.0",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "readme": "\n# node-fresh\n\n HTTP response freshness testing\n\n## fresh(req, res)\n\n Check freshness of `req` and `res` headers.\n\n When the cache is \"fresh\" __true__ is returned,\n otherwise __false__ is returned to indicate that\n the cache is now stale.\n\n## Example:\n\n```js\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'luna' };\nfresh(req, res);\n// => false\n\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'tobi' };\nfresh(req, res);\n// => true\n```\n\n## Installation\n\n```\n$ npm install fresh\n```",
+ "readmeFilename": "Readme.md",
+ "_id": "fresh@0.1.0",
+ "dist": {
+ "shasum": "88d3ada742d47e42baf7b4c0a3288e08986414e2"
+ },
+ "_from": "fresh@0.1.0",
+ "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz"
+}
diff --git a/node_modules/express/node_modules/methods/index.js b/node_modules/express/node_modules/methods/index.js
new file mode 100644
index 0000000..297d022
--- /dev/null
+++ b/node_modules/express/node_modules/methods/index.js
@@ -0,0 +1,26 @@
+
+module.exports = [
+ 'get'
+ , 'post'
+ , 'put'
+ , 'head'
+ , 'delete'
+ , 'options'
+ , 'trace'
+ , 'copy'
+ , 'lock'
+ , 'mkcol'
+ , 'move'
+ , 'propfind'
+ , 'proppatch'
+ , 'unlock'
+ , 'report'
+ , 'mkactivity'
+ , 'checkout'
+ , 'merge'
+ , 'm-search'
+ , 'notify'
+ , 'subscribe'
+ , 'unsubscribe'
+ , 'patch'
+]; \ No newline at end of file
diff --git a/node_modules/express/node_modules/methods/package.json b/node_modules/express/node_modules/methods/package.json
new file mode 100644
index 0000000..00901f4
--- /dev/null
+++ b/node_modules/express/node_modules/methods/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "methods",
+ "version": "0.0.1",
+ "description": "HTTP methods that node supports",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "http",
+ "methods"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk"
+ },
+ "license": "MIT",
+ "readme": "ERROR: No README data found!",
+ "_id": "methods@0.0.1",
+ "dist": {
+ "shasum": "a7b41634ec7800d4a6fc25c10de5d0c538af98fd"
+ },
+ "_from": "methods@0.0.1",
+ "_resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz"
+}
diff --git a/node_modules/express/node_modules/mkdirp/.npmignore b/node_modules/express/node_modules/mkdirp/.npmignore
new file mode 100644
index 0000000..9303c34
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/.npmignore
@@ -0,0 +1,2 @@
+node_modules/
+npm-debug.log \ No newline at end of file
diff --git a/node_modules/express/node_modules/mkdirp/.travis.yml b/node_modules/express/node_modules/mkdirp/.travis.yml
new file mode 100644
index 0000000..84fd7ca
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
+ - 0.9
diff --git a/node_modules/express/node_modules/mkdirp/LICENSE b/node_modules/express/node_modules/mkdirp/LICENSE
new file mode 100644
index 0000000..432d1ae
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/LICENSE
@@ -0,0 +1,21 @@
+Copyright 2010 James Halliday (mail@substack.net)
+
+This project is free software released under the MIT/X11 license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/express/node_modules/mkdirp/examples/pow.js b/node_modules/express/node_modules/mkdirp/examples/pow.js
new file mode 100644
index 0000000..e692421
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/examples/pow.js
@@ -0,0 +1,6 @@
+var mkdirp = require('mkdirp');
+
+mkdirp('/tmp/foo/bar/baz', function (err) {
+ if (err) console.error(err)
+ else console.log('pow!')
+});
diff --git a/node_modules/express/node_modules/mkdirp/index.js b/node_modules/express/node_modules/mkdirp/index.js
new file mode 100644
index 0000000..fda6de8
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/index.js
@@ -0,0 +1,82 @@
+var path = require('path');
+var fs = require('fs');
+
+module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
+
+function mkdirP (p, mode, f, made) {
+ if (typeof mode === 'function' || mode === undefined) {
+ f = mode;
+ mode = 0777 & (~process.umask());
+ }
+ if (!made) made = null;
+
+ var cb = f || function () {};
+ if (typeof mode === 'string') mode = parseInt(mode, 8);
+ p = path.resolve(p);
+
+ fs.mkdir(p, mode, function (er) {
+ if (!er) {
+ made = made || p;
+ return cb(null, made);
+ }
+ switch (er.code) {
+ case 'ENOENT':
+ mkdirP(path.dirname(p), mode, function (er, made) {
+ if (er) cb(er, made);
+ else mkdirP(p, mode, cb, made);
+ });
+ break;
+
+ // In the case of any other error, just see if there's a dir
+ // there already. If so, then hooray! If not, then something
+ // is borked.
+ default:
+ fs.stat(p, function (er2, stat) {
+ // if the stat fails, then that's super weird.
+ // let the original error be the failure reason.
+ if (er2 || !stat.isDirectory()) cb(er, made)
+ else cb(null, made);
+ });
+ break;
+ }
+ });
+}
+
+mkdirP.sync = function sync (p, mode, made) {
+ if (mode === undefined) {
+ mode = 0777 & (~process.umask());
+ }
+ if (!made) made = null;
+
+ if (typeof mode === 'string') mode = parseInt(mode, 8);
+ p = path.resolve(p);
+
+ try {
+ fs.mkdirSync(p, mode);
+ made = made || p;
+ }
+ catch (err0) {
+ switch (err0.code) {
+ case 'ENOENT' :
+ made = sync(path.dirname(p), mode, made);
+ sync(p, mode, made);
+ break;
+
+ // In the case of any other error, just see if there's a dir
+ // there already. If so, then hooray! If not, then something
+ // is borked.
+ default:
+ var stat;
+ try {
+ stat = fs.statSync(p);
+ }
+ catch (err1) {
+ throw err0;
+ }
+ if (!stat.isDirectory()) throw err0;
+ break;
+ }
+ }
+
+ return made;
+};
diff --git a/node_modules/express/node_modules/mkdirp/package.json b/node_modules/express/node_modules/mkdirp/package.json
new file mode 100644
index 0000000..598383e
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "mkdirp",
+ "description": "Recursively mkdir, like `mkdir -p`",
+ "version": "0.3.5",
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "main": "./index",
+ "keywords": [
+ "mkdir",
+ "directory"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/substack/node-mkdirp.git"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "devDependencies": {
+ "tap": "~0.4.0"
+ },
+ "license": "MIT",
+ "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, mode, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\n## mkdirp.sync(dir, mode)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\n# license\n\nMIT\n",
+ "readmeFilename": "readme.markdown",
+ "bugs": {
+ "url": "https://github.com/substack/node-mkdirp/issues"
+ },
+ "_id": "mkdirp@0.3.5",
+ "dist": {
+ "shasum": "b272e3946023e206f8e6f60fb26d39bd3fc78d1c"
+ },
+ "_from": "mkdirp@0.3.5",
+ "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
+}
diff --git a/node_modules/express/node_modules/mkdirp/readme.markdown b/node_modules/express/node_modules/mkdirp/readme.markdown
new file mode 100644
index 0000000..83b0216
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/readme.markdown
@@ -0,0 +1,63 @@
+# mkdirp
+
+Like `mkdir -p`, but in node.js!
+
+[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
+
+# example
+
+## pow.js
+
+```js
+var mkdirp = require('mkdirp');
+
+mkdirp('/tmp/foo/bar/baz', function (err) {
+ if (err) console.error(err)
+ else console.log('pow!')
+});
+```
+
+Output
+
+```
+pow!
+```
+
+And now /tmp/foo/bar/baz exists, huzzah!
+
+# methods
+
+```js
+var mkdirp = require('mkdirp');
+```
+
+## mkdirp(dir, mode, cb)
+
+Create a new directory and any necessary subdirectories at `dir` with octal
+permission string `mode`.
+
+If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+`cb(err, made)` fires with the error or the first directory `made`
+that had to be created, if any.
+
+## mkdirp.sync(dir, mode)
+
+Synchronously create a new directory and any necessary subdirectories at `dir`
+with octal permission string `mode`.
+
+If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+Returns the first directory that had to be created, if any.
+
+# install
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install mkdirp
+```
+
+# license
+
+MIT
diff --git a/node_modules/express/node_modules/mkdirp/test/chmod.js b/node_modules/express/node_modules/mkdirp/test/chmod.js
new file mode 100644
index 0000000..520dcb8
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/chmod.js
@@ -0,0 +1,38 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ ps.push(dir);
+}
+
+var file = ps.join('/');
+
+test('chmod-pre', function (t) {
+ var mode = 0744
+ mkdirp(file, mode, function (er) {
+ t.ifError(er, 'should not error');
+ fs.stat(file, function (er, stat) {
+ t.ifError(er, 'should exist');
+ t.ok(stat && stat.isDirectory(), 'should be directory');
+ t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
+ t.end();
+ });
+ });
+});
+
+test('chmod', function (t) {
+ var mode = 0755
+ mkdirp(file, mode, function (er) {
+ t.ifError(er, 'should not error');
+ fs.stat(file, function (er, stat) {
+ t.ifError(er, 'should exist');
+ t.ok(stat && stat.isDirectory(), 'should be directory');
+ t.end();
+ });
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/clobber.js b/node_modules/express/node_modules/mkdirp/test/clobber.js
new file mode 100644
index 0000000..0eb7099
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/clobber.js
@@ -0,0 +1,37 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ ps.push(dir);
+}
+
+var file = ps.join('/');
+
+// a file in the way
+var itw = ps.slice(0, 3).join('/');
+
+
+test('clobber-pre', function (t) {
+ console.error("about to write to "+itw)
+ fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
+
+ fs.stat(itw, function (er, stat) {
+ t.ifError(er)
+ t.ok(stat && stat.isFile(), 'should be file')
+ t.end()
+ })
+})
+
+test('clobber', function (t) {
+ t.plan(2);
+ mkdirp(file, 0755, function (err) {
+ t.ok(err);
+ t.equal(err.code, 'ENOTDIR');
+ t.end();
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/mkdirp.js b/node_modules/express/node_modules/mkdirp/test/mkdirp.js
new file mode 100644
index 0000000..b07cd70
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/mkdirp.js
@@ -0,0 +1,28 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('woo', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ mkdirp(file, 0755, function (err) {
+ if (err) t.fail(err);
+ else path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ })
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/perm.js b/node_modules/express/node_modules/mkdirp/test/perm.js
new file mode 100644
index 0000000..23a7abb
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/perm.js
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('async perm', function (t) {
+ t.plan(2);
+ var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
+
+ mkdirp(file, 0755, function (err) {
+ if (err) t.fail(err);
+ else path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ })
+ });
+});
+
+test('async root perm', function (t) {
+ mkdirp('/tmp', 0755, function (err) {
+ if (err) t.fail(err);
+ t.end();
+ });
+ t.end();
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/perm_sync.js b/node_modules/express/node_modules/mkdirp/test/perm_sync.js
new file mode 100644
index 0000000..f685f60
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/perm_sync.js
@@ -0,0 +1,39 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync perm', function (t) {
+ t.plan(2);
+ var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
+
+ mkdirp.sync(file, 0755);
+ path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ });
+});
+
+test('sync root perm', function (t) {
+ t.plan(1);
+
+ var file = '/tmp';
+ mkdirp.sync(file, 0755);
+ path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/race.js b/node_modules/express/node_modules/mkdirp/test/race.js
new file mode 100644
index 0000000..96a0447
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/race.js
@@ -0,0 +1,41 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('race', function (t) {
+ t.plan(4);
+ var ps = [ '', 'tmp' ];
+
+ for (var i = 0; i < 25; i++) {
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ ps.push(dir);
+ }
+ var file = ps.join('/');
+
+ var res = 2;
+ mk(file, function () {
+ if (--res === 0) t.end();
+ });
+
+ mk(file, function () {
+ if (--res === 0) t.end();
+ });
+
+ function mk (file, cb) {
+ mkdirp(file, 0755, function (err) {
+ if (err) t.fail(err);
+ else path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ if (cb) cb();
+ }
+ })
+ })
+ });
+ }
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/rel.js b/node_modules/express/node_modules/mkdirp/test/rel.js
new file mode 100644
index 0000000..7985824
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/rel.js
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('rel', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var cwd = process.cwd();
+ process.chdir('/tmp');
+
+ var file = [x,y,z].join('/');
+
+ mkdirp(file, 0755, function (err) {
+ if (err) t.fail(err);
+ else path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ process.chdir(cwd);
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ })
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/return.js b/node_modules/express/node_modules/mkdirp/test/return.js
new file mode 100644
index 0000000..bce68e5
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/return.js
@@ -0,0 +1,25 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+ t.plan(4);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ // should return the first dir created.
+ // By this point, it would be profoundly surprising if /tmp didn't
+ // already exist, since every other test makes things in there.
+ mkdirp(file, function (err, made) {
+ t.ifError(err);
+ t.equal(made, '/tmp/' + x);
+ mkdirp(file, function (err, made) {
+ t.ifError(err);
+ t.equal(made, null);
+ });
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/return_sync.js b/node_modules/express/node_modules/mkdirp/test/return_sync.js
new file mode 100644
index 0000000..7c222d3
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/return_sync.js
@@ -0,0 +1,24 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ // should return the first dir created.
+ // By this point, it would be profoundly surprising if /tmp didn't
+ // already exist, since every other test makes things in there.
+ // Note that this will throw on failure, which will fail the test.
+ var made = mkdirp.sync(file);
+ t.equal(made, '/tmp/' + x);
+
+ // making the same file again should have no effect.
+ made = mkdirp.sync(file);
+ t.equal(made, null);
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/root.js b/node_modules/express/node_modules/mkdirp/test/root.js
new file mode 100644
index 0000000..97ad7a2
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/root.js
@@ -0,0 +1,18 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('root', function (t) {
+ // '/' on unix, 'c:/' on windows.
+ var file = path.resolve('/');
+
+ mkdirp(file, 0755, function (err) {
+ if (err) throw err
+ fs.stat(file, function (er, stat) {
+ if (er) throw er
+ t.ok(stat.isDirectory(), 'target is a directory');
+ t.end();
+ })
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/sync.js b/node_modules/express/node_modules/mkdirp/test/sync.js
new file mode 100644
index 0000000..7530cad
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/sync.js
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ try {
+ mkdirp.sync(file, 0755);
+ } catch (err) {
+ t.fail(err);
+ return t.end();
+ }
+
+ path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0755);
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ });
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/umask.js b/node_modules/express/node_modules/mkdirp/test/umask.js
new file mode 100644
index 0000000..64ccafe
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/umask.js
@@ -0,0 +1,28 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('implicit mode from umask', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ mkdirp(file, function (err) {
+ if (err) t.fail(err);
+ else path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, 0777 & (~process.umask()));
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ })
+ })
+ });
+});
diff --git a/node_modules/express/node_modules/mkdirp/test/umask_sync.js b/node_modules/express/node_modules/mkdirp/test/umask_sync.js
new file mode 100644
index 0000000..35bd5cb
--- /dev/null
+++ b/node_modules/express/node_modules/mkdirp/test/umask_sync.js
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('umask sync modes', function (t) {
+ t.plan(2);
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+ var file = '/tmp/' + [x,y,z].join('/');
+
+ try {
+ mkdirp.sync(file);
+ } catch (err) {
+ t.fail(err);
+ return t.end();
+ }
+
+ path.exists(file, function (ex) {
+ if (!ex) t.fail('file not created')
+ else fs.stat(file, function (err, stat) {
+ if (err) t.fail(err)
+ else {
+ t.equal(stat.mode & 0777, (0777 & (~process.umask())));
+ t.ok(stat.isDirectory(), 'target not a directory');
+ t.end();
+ }
+ });
+ });
+});
diff --git a/node_modules/express/node_modules/range-parser/.npmignore b/node_modules/express/node_modules/range-parser/.npmignore
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/.npmignore
@@ -0,0 +1 @@
+test
diff --git a/node_modules/express/node_modules/range-parser/History.md b/node_modules/express/node_modules/range-parser/History.md
new file mode 100644
index 0000000..82df7b1
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/History.md
@@ -0,0 +1,15 @@
+
+0.0.4 / 2012-06-17
+==================
+
+ * changed: ret -1 for unsatisfiable and -2 when invalid
+
+0.0.3 / 2012-06-17
+==================
+
+ * fix last-byte-pos default to len - 1
+
+0.0.2 / 2012-06-14
+==================
+
+ * add `.type`
diff --git a/node_modules/express/node_modules/range-parser/Makefile b/node_modules/express/node_modules/range-parser/Makefile
new file mode 100644
index 0000000..8e8640f
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec \
+ --require should
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/range-parser/Readme.md b/node_modules/express/node_modules/range-parser/Readme.md
new file mode 100644
index 0000000..b2a67fe
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/Readme.md
@@ -0,0 +1,28 @@
+
+# node-range-parser
+
+ Range header field parser.
+
+## Example:
+
+```js
+assert(-1 == parse(200, 'bytes=500-20'));
+assert(-2 == parse(200, 'bytes=malformed'));
+parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));
+parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));
+parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));
+parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
+parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));
+parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
+parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));
+parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));
+parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));
+parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));
+parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));
+```
+
+## Installation
+
+```
+$ npm install range-parser
+``` \ No newline at end of file
diff --git a/node_modules/express/node_modules/range-parser/index.js b/node_modules/express/node_modules/range-parser/index.js
new file mode 100644
index 0000000..9b0f7a8
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/index.js
@@ -0,0 +1,49 @@
+
+/**
+ * Parse "Range" header `str` relative to the given file `size`.
+ *
+ * @param {Number} size
+ * @param {String} str
+ * @return {Array}
+ * @api public
+ */
+
+module.exports = function(size, str){
+ var valid = true;
+ var i = str.indexOf('=');
+
+ if (-1 == i) return -2;
+
+ var arr = str.slice(i + 1).split(',').map(function(range){
+ var range = range.split('-')
+ , start = parseInt(range[0], 10)
+ , end = parseInt(range[1], 10);
+
+ // -nnn
+ if (isNaN(start)) {
+ start = size - end;
+ end = size - 1;
+ // nnn-
+ } else if (isNaN(end)) {
+ end = size - 1;
+ }
+
+ // limit last-byte-pos to current length
+ if (end > size - 1) end = size - 1;
+
+ // invalid
+ if (isNaN(start)
+ || isNaN(end)
+ || start > end
+ || start < 0) valid = false;
+
+ return {
+ start: start,
+ end: end
+ };
+ });
+
+ arr.type = str.slice(0, i);
+
+ return valid ? arr : -1;
+}; \ No newline at end of file
diff --git a/node_modules/express/node_modules/range-parser/package.json b/node_modules/express/node_modules/range-parser/package.json
new file mode 100644
index 0000000..b7a4c46
--- /dev/null
+++ b/node_modules/express/node_modules/range-parser/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "range-parser",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "description": "Range header field string parser",
+ "version": "0.0.4",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "readme": "\n# node-range-parser\n\n Range header field parser.\n\n## Example:\n\n```js\nassert(-1 == parse(200, 'bytes=500-20'));\nassert(-2 == parse(200, 'bytes=malformed'));\nparse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));\nparse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));\nparse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));\nparse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));\nparse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));\nparse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));\nparse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));\nparse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));\nparse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));\n```\n\n## Installation\n\n```\n$ npm install range-parser\n```",
+ "readmeFilename": "Readme.md",
+ "_id": "range-parser@0.0.4",
+ "dist": {
+ "shasum": "8aae102e1035de1c98dfc67147b6672510097e8c"
+ },
+ "_from": "range-parser@0.0.4",
+ "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz"
+}
diff --git a/node_modules/express/node_modules/send/.npmignore b/node_modules/express/node_modules/send/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/express/node_modules/send/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/express/node_modules/send/History.md b/node_modules/express/node_modules/send/History.md
new file mode 100644
index 0000000..e348db5
--- /dev/null
+++ b/node_modules/express/node_modules/send/History.md
@@ -0,0 +1,35 @@
+
+0.1.3 / 2013-07-08
+==================
+
+ * Revert "Fix fd leak"
+
+0.1.2 / 2013-07-03
+==================
+
+ * Fix fd leak
+
+0.1.0 / 2012-08-25
+==================
+
+ * add options parameter to send() that is passed to fs.createReadStream() [kanongil]
+
+0.0.4 / 2012-08-16
+==================
+
+ * allow custom "Accept-Ranges" definition
+
+0.0.3 / 2012-07-16
+==================
+
+ * fix normalization of the root directory. Closes #3
+
+0.0.2 / 2012-07-09
+==================
+
+ * add passing of req explicitly for now (YUCK)
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/send/Makefile b/node_modules/express/node_modules/send/Makefile
new file mode 100644
index 0000000..a9dcfd5
--- /dev/null
+++ b/node_modules/express/node_modules/send/Makefile
@@ -0,0 +1,8 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec \
+ --bail
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/express/node_modules/send/Readme.md b/node_modules/express/node_modules/send/Readme.md
new file mode 100644
index 0000000..ea7b234
--- /dev/null
+++ b/node_modules/express/node_modules/send/Readme.md
@@ -0,0 +1,128 @@
+# send
+
+ Send is Connect's `static()` extracted for generalized use, a streaming static file
+ server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.
+
+## Installation
+
+ $ npm install send
+
+## Examples
+
+ Small:
+
+```js
+var http = require('http');
+var send = require('send');
+
+var app = http.createServer(function(req, res){
+ send(req, req.url).pipe(res);
+}).listen(3000);
+```
+
+ Serving from a root directory with custom error-handling:
+
+```js
+var http = require('http');
+var send = require('send');
+var url = require('url');
+
+var app = http.createServer(function(req, res){
+ // your custom error-handling logic:
+ function error(err) {
+ res.statusCode = err.status || 500;
+ res.end(err.message);
+ }
+
+ // your custom directory handling logic:
+ function redirect() {
+ res.statusCode = 301;
+ res.setHeader('Location', req.url + '/');
+ res.end('Redirecting to ' + req.url + '/');
+ }
+
+ // transfer arbitrary files from within
+ // /www/example.com/public/*
+ send(req, url.parse(req.url).pathname)
+ .root('/www/example.com/public')
+ .on('error', error)
+ .on('directory', redirect)
+ .pipe(res);
+}).listen(3000);
+```
+
+## API
+
+### Events
+
+ - `error` an error occurred `(err)`
+ - `directory` a directory was requested
+ - `file` a file was requested `(path, stat)`
+ - `stream` file streaming has started `(stream)`
+ - `end` streaming has completed
+
+### .root(dir)
+
+ Serve files relative to `path`. Aliased as `.from(dir)`.
+
+### .index(path)
+
+ By default send supports "index.html" files, to disable this
+ invoke `.index(false)` or to supply a new index pass a string.
+
+### .maxage(ms)
+
+ Provide a max-age in milliseconds for http caching, defaults to 0.
+
+### .hidden(bool)
+
+ Enable or disable transfer of hidden files, defaults to false.
+
+## Error-handling
+
+ By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.
+
+## Caching
+
+ It does _not_ perform internal caching, you should use a reverse proxy cache such
+ as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).
+
+## Debugging
+
+ To enable `debug()` instrumentation output export __DEBUG__:
+
+```
+$ DEBUG=send node app
+```
+
+## Running tests
+
+```
+$ npm install
+$ make test
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js
new file mode 100644
index 0000000..f17158d
--- /dev/null
+++ b/node_modules/express/node_modules/send/index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/send'); \ No newline at end of file
diff --git a/node_modules/express/node_modules/send/lib/send.js b/node_modules/express/node_modules/send/lib/send.js
new file mode 100644
index 0000000..a3d94a6
--- /dev/null
+++ b/node_modules/express/node_modules/send/lib/send.js
@@ -0,0 +1,474 @@
+
+/**
+ * Module dependencies.
+ */
+
+var debug = require('debug')('send')
+ , parseRange = require('range-parser')
+ , Stream = require('stream')
+ , mime = require('mime')
+ , fresh = require('fresh')
+ , path = require('path')
+ , http = require('http')
+ , fs = require('fs')
+ , basename = path.basename
+ , normalize = path.normalize
+ , join = path.join
+ , utils = require('./utils');
+
+/**
+ * Expose `send`.
+ */
+
+exports = module.exports = send;
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = mime;
+
+/**
+ * Return a `SendStream` for `req` and `path`.
+ *
+ * @param {Request} req
+ * @param {String} path
+ * @param {Object} options
+ * @return {SendStream}
+ * @api public
+ */
+
+function send(req, path, options) {
+ return new SendStream(req, path, options);
+}
+
+/**
+ * Initialize a `SendStream` with the given `path`.
+ *
+ * Events:
+ *
+ * - `error` an error occurred
+ * - `stream` file streaming has started
+ * - `end` streaming has completed
+ * - `directory` a directory was requested
+ *
+ * @param {Request} req
+ * @param {String} path
+ * @param {Object} options
+ * @api private
+ */
+
+function SendStream(req, path, options) {
+ var self = this;
+ this.req = req;
+ this.path = path;
+ this.options = options || {};
+ this.maxage(0);
+ this.hidden(false);
+ this.index('index.html');
+}
+
+/**
+ * Inherits from `Stream.prototype`.
+ */
+
+SendStream.prototype.__proto__ = Stream.prototype;
+
+/**
+ * Enable or disable "hidden" (dot) files.
+ *
+ * @param {Boolean} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.hidden = function(val){
+ debug('hidden %s', val);
+ this._hidden = val;
+ return this;
+};
+
+/**
+ * Set index `path`, set to a falsy
+ * value to disable index support.
+ *
+ * @param {String|Boolean} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.index = function(path){
+ debug('index %s', path);
+ this._index = path;
+ return this;
+};
+
+/**
+ * Set root `path`.
+ *
+ * @param {String} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.root =
+SendStream.prototype.from = function(path){
+ this._root = normalize(path);
+ return this;
+};
+
+/**
+ * Set max-age to `ms`.
+ *
+ * @param {Number} ms
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.maxage = function(ms){
+ if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000;
+ debug('max-age %d', ms);
+ this._maxage = ms;
+ return this;
+};
+
+/**
+ * Emit error with `status`.
+ *
+ * @param {Number} status
+ * @api private
+ */
+
+SendStream.prototype.error = function(status, err){
+ var res = this.res;
+ var msg = http.STATUS_CODES[status];
+ err = err || new Error(msg);
+ err.status = status;
+ if (this.listeners('error').length) return this.emit('error', err);
+ res.statusCode = err.status;
+ res.end(msg);
+};
+
+/**
+ * Check if the pathname is potentially malicious.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isMalicious = function(){
+ return !this._root && ~this.path.indexOf('..');
+};
+
+/**
+ * Check if the pathname ends with "/".
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.hasTrailingSlash = function(){
+ return '/' == this.path[this.path.length - 1];
+};
+
+/**
+ * Check if the basename leads with ".".
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.hasLeadingDot = function(){
+ return '.' == basename(this.path)[0];
+};
+
+/**
+ * Check if this is a conditional GET request.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isConditionalGET = function(){
+ return this.req.headers['if-none-match']
+ || this.req.headers['if-modified-since'];
+};
+
+/**
+ * Strip content-* header fields.
+ *
+ * @api private
+ */
+
+SendStream.prototype.removeContentHeaderFields = function(){
+ var res = this.res;
+ Object.keys(res._headers).forEach(function(field){
+ if (0 == field.indexOf('content')) {
+ res.removeHeader(field);
+ }
+ });
+};
+
+/**
+ * Respond with 304 not modified.
+ *
+ * @api private
+ */
+
+SendStream.prototype.notModified = function(){
+ var res = this.res;
+ debug('not modified');
+ this.removeContentHeaderFields();
+ res.statusCode = 304;
+ res.end();
+};
+
+/**
+ * Check if the request is cacheable, aka
+ * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isCachable = function(){
+ var res = this.res;
+ return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode;
+};
+
+/**
+ * Handle stat() error.
+ *
+ * @param {Error} err
+ * @api private
+ */
+
+SendStream.prototype.onStatError = function(err){
+ var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR'];
+ if (~notfound.indexOf(err.code)) return this.error(404, err);
+ this.error(500, err);
+};
+
+/**
+ * Check if the cache is fresh.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isFresh = function(){
+ return fresh(this.req.headers, this.res._headers);
+};
+
+/**
+ * Redirect to `path`.
+ *
+ * @param {String} path
+ * @api private
+ */
+
+SendStream.prototype.redirect = function(path){
+ if (this.listeners('directory').length) return this.emit('directory');
+ var res = this.res;
+ path += '/';
+ res.statusCode = 301;
+ res.setHeader('Location', path);
+ res.end('Redirecting to ' + utils.escape(path));
+};
+
+/**
+ * Pipe to `res.
+ *
+ * @param {Stream} res
+ * @return {Stream} res
+ * @api public
+ */
+
+SendStream.prototype.pipe = function(res){
+ var self = this
+ , args = arguments
+ , path = this.path
+ , root = this._root;
+
+ // references
+ this.res = res;
+
+ // invalid request uri
+ path = utils.decode(path);
+ if (-1 == path) return this.error(400);
+
+ // null byte(s)
+ if (~path.indexOf('\0')) return this.error(400);
+
+ // join / normalize from optional root dir
+ if (root) path = normalize(join(this._root, path));
+
+ // ".." is malicious without "root"
+ if (this.isMalicious()) return this.error(403);
+
+ // malicious path
+ if (root && 0 != path.indexOf(root)) return this.error(403);
+
+ // hidden file support
+ if (!this._hidden && this.hasLeadingDot()) return this.error(404);
+
+ // index file support
+ if (this._index && this.hasTrailingSlash()) path += this._index;
+
+ debug('stat "%s"', path);
+ fs.stat(path, function(err, stat){
+ if (err) return self.onStatError(err);
+ if (stat.isDirectory()) return self.redirect(self.path);
+ self.emit('file', path, stat);
+ self.send(path, stat);
+ });
+
+ return res;
+};
+
+/**
+ * Transfer `path`.
+ *
+ * @param {String} path
+ * @api public
+ */
+
+SendStream.prototype.send = function(path, stat){
+ var options = this.options;
+ var len = stat.size;
+ var res = this.res;
+ var req = this.req;
+ var ranges = req.headers.range;
+ var offset = options.start || 0;
+
+ // set header fields
+ this.setHeader(stat);
+
+ // set content-type
+ this.type(path);
+
+ // conditional GET support
+ if (this.isConditionalGET()
+ && this.isCachable()
+ && this.isFresh()) {
+ return this.notModified();
+ }
+
+ // adjust len to start/end options
+ len = Math.max(0, len - offset);
+ if (options.end !== undefined) {
+ var bytes = options.end - offset + 1;
+ if (len > bytes) len = bytes;
+ }
+
+ // Range support
+ if (ranges) {
+ ranges = parseRange(len, ranges);
+
+ // unsatisfiable
+ if (-1 == ranges) {
+ res.setHeader('Content-Range', 'bytes */' + stat.size);
+ return this.error(416);
+ }
+
+ // valid (syntactically invalid ranges are treated as a regular response)
+ if (-2 != ranges) {
+ options.start = offset + ranges[0].start;
+ options.end = offset + ranges[0].end;
+
+ // Content-Range
+ res.statusCode = 206;
+ res.setHeader('Content-Range', 'bytes '
+ + ranges[0].start
+ + '-'
+ + ranges[0].end
+ + '/'
+ + len);
+ len = options.end - options.start + 1;
+ }
+ }
+
+ // content-length
+ res.setHeader('Content-Length', len);
+
+ // HEAD support
+ if ('HEAD' == req.method) return res.end();
+
+ this.stream(path, options);
+};
+
+/**
+ * Stream `path` to the response.
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @api private
+ */
+
+SendStream.prototype.stream = function(path, options){
+ // TODO: this is all lame, refactor meeee
+ var self = this;
+ var res = this.res;
+ var req = this.req;
+
+ // pipe
+ var stream = fs.createReadStream(path, options);
+ this.emit('stream', stream);
+ stream.pipe(res);
+
+ // socket closed, done with the fd
+ req.on('close', stream.destroy.bind(stream));
+
+ // error handling code-smell
+ stream.on('error', function(err){
+ // no hope in responding
+ if (res._header) {
+ console.error(err.stack);
+ req.destroy();
+ return;
+ }
+
+ // 500
+ err.status = 500;
+ self.emit('error', err);
+ });
+
+ // end
+ stream.on('end', function(){
+ self.emit('end');
+ });
+};
+
+/**
+ * Set content-type based on `path`
+ * if it hasn't been explicitly set.
+ *
+ * @param {String} path
+ * @api private
+ */
+
+SendStream.prototype.type = function(path){
+ var res = this.res;
+ if (res.getHeader('Content-Type')) return;
+ var type = mime.lookup(path);
+ var charset = mime.charsets.lookup(type);
+ debug('content-type %s', type);
+ res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
+};
+
+/**
+ * Set reaponse header fields, most
+ * fields may be pre-defined.
+ *
+ * @param {Object} stat
+ * @api private
+ */
+
+SendStream.prototype.setHeader = function(stat){
+ var res = this.res;
+ if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
+ if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat));
+ if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString());
+ if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000));
+ if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString());
+};
diff --git a/node_modules/express/node_modules/send/lib/utils.js b/node_modules/express/node_modules/send/lib/utils.js
new file mode 100644
index 0000000..950e5a2
--- /dev/null
+++ b/node_modules/express/node_modules/send/lib/utils.js
@@ -0,0 +1,47 @@
+
+/**
+ * Return an ETag in the form of `"<size>-<mtime>"`
+ * from the given `stat`.
+ *
+ * @param {Object} stat
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(stat) {
+ return '"' + stat.size + '-' + Number(stat.mtime) + '"';
+};
+
+/**
+ * decodeURIComponent.
+ *
+ * Allows V8 to only deoptimize this fn instead of all
+ * of send().
+ *
+ * @param {String} path
+ * @api private
+ */
+
+exports.decode = function(path){
+ try {
+ return decodeURIComponent(path);
+ } catch (err) {
+ return -1;
+ }
+};
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+}; \ No newline at end of file
diff --git a/node_modules/express/node_modules/send/node_modules/mime/LICENSE b/node_modules/express/node_modules/send/node_modules/mime/LICENSE
new file mode 100644
index 0000000..451fc45
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/express/node_modules/send/node_modules/mime/README.md b/node_modules/express/node_modules/send/node_modules/mime/README.md
new file mode 100644
index 0000000..6ca19bd
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/README.md
@@ -0,0 +1,66 @@
+# mime
+
+Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.
+
+## Install
+
+Install with [npm](http://github.com/isaacs/npm):
+
+ npm install mime
+
+## API - Queries
+
+### mime.lookup(path)
+Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
+
+ var mime = require('mime');
+
+ mime.lookup('/path/to/file.txt'); // => 'text/plain'
+ mime.lookup('file.txt'); // => 'text/plain'
+ mime.lookup('.TXT'); // => 'text/plain'
+ mime.lookup('htm'); // => 'text/html'
+
+### mime.default_type
+Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
+
+### mime.extension(type)
+Get the default extension for `type`
+
+ mime.extension('text/html'); // => 'html'
+ mime.extension('application/octet-stream'); // => 'bin'
+
+### mime.charsets.lookup()
+
+Map mime-type to charset
+
+ mime.charsets.lookup('text/plain'); // => 'UTF-8'
+
+(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
+
+## API - Defining Custom Types
+
+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/broofa/node-mime/wiki/Requesting-New-Types).
+
+### mime.define()
+
+Add custom mime/extension mappings
+
+ mime.define({
+ 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
+ 'application/x-my-type': ['x-mt', 'x-mtt'],
+ // etc ...
+ });
+
+ mime.lookup('x-sft'); // => 'text/x-some-format'
+
+The first entry in the extensions array is returned by `mime.extension()`. E.g.
+
+ mime.extension('text/x-some-format'); // => 'x-sf'
+
+### mime.load(filepath)
+
+Load mappings from an Apache ".types" format file
+
+ mime.load('./my_project.types');
+
+The .types file format is simple - See the `types` dir for examples.
diff --git a/node_modules/express/node_modules/send/node_modules/mime/mime.js b/node_modules/express/node_modules/send/node_modules/mime/mime.js
new file mode 100644
index 0000000..8a7eb09
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/mime.js
@@ -0,0 +1,114 @@
+var path = require('path');
+var fs = require('fs');
+
+function Mime() {
+ // Map of extension -> mime type
+ this.types = Object.create(null);
+
+ // Map of mime type -> extension
+ this.extensions = Object.create(null);
+}
+
+/**
+ * Define mimetype -> extension mappings. Each key is a mime-type that maps
+ * to an array of extensions associated with the type. The first extension is
+ * used as the default extension for the type.
+ *
+ * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
+ *
+ * @param map (Object) type definitions
+ */
+Mime.prototype.define = function (map) {
+ for (var type in map) {
+ var exts = map[type];
+
+ for (var i = 0; i < exts.length; i++) {
+ if (process.env.DEBUG_MIME && this.types[exts]) {
+ console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
+ this.types[exts] + ' to ' + type);
+ }
+
+ this.types[exts[i]] = type;
+ }
+
+ // Default extension is the first one we encounter
+ if (!this.extensions[type]) {
+ this.extensions[type] = exts[0];
+ }
+ }
+};
+
+/**
+ * Load an Apache2-style ".types" file
+ *
+ * This may be called multiple times (it's expected). Where files declare
+ * overlapping types/extensions, the last file wins.
+ *
+ * @param file (String) path of file to load.
+ */
+Mime.prototype.load = function(file) {
+
+ this._loading = file;
+ // Read file and split into lines
+ var map = {},
+ content = fs.readFileSync(file, 'ascii'),
+ lines = content.split(/[\r\n]+/);
+
+ lines.forEach(function(line) {
+ // Clean up whitespace/comments, and split into fields
+ var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
+ map[fields.shift()] = fields;
+ });
+
+ this.define(map);
+
+ this._loading = null;
+};
+
+/**
+ * Lookup a mime type based on extension
+ */
+Mime.prototype.lookup = function(path, fallback) {
+ var ext = path.replace(/.*[\.\/]/, '').toLowerCase();
+
+ return this.types[ext] || fallback || this.default_type;
+};
+
+/**
+ * Return file extension associated with a mime type
+ */
+Mime.prototype.extension = function(mimeType) {
+ var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
+ return this.extensions[type];
+};
+
+// Default instance
+var mime = new Mime();
+
+// Load local copy of
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+mime.load(path.join(__dirname, 'types/mime.types'));
+
+// Load additional types from node.js community
+mime.load(path.join(__dirname, 'types/node.types'));
+
+// Default type
+mime.default_type = mime.lookup('bin');
+
+//
+// Additional API specific to the default instance
+//
+
+mime.Mime = Mime;
+
+/**
+ * Lookup a charset based on mime type.
+ */
+mime.charsets = {
+ lookup: function(mimeType, fallback) {
+ // Assume text types are utf8
+ return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
+ }
+};
+
+module.exports = mime;
diff --git a/node_modules/express/node_modules/send/node_modules/mime/package.json b/node_modules/express/node_modules/send/node_modules/mime/package.json
new file mode 100644
index 0000000..63b94d3
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/package.json
@@ -0,0 +1,39 @@
+{
+ "author": {
+ "name": "Robert Kieffer",
+ "email": "robert@broofa.com",
+ "url": "http://github.com/broofa"
+ },
+ "contributors": [
+ {
+ "name": "Benjamin Thomas",
+ "email": "benjamin@benjaminthomas.org",
+ "url": "http://github.com/bentomas"
+ }
+ ],
+ "dependencies": {},
+ "description": "A comprehensive library for mime-type mapping",
+ "devDependencies": {},
+ "keywords": [
+ "util",
+ "mime"
+ ],
+ "main": "mime.js",
+ "name": "mime",
+ "repository": {
+ "url": "https://github.com/broofa/node-mime",
+ "type": "git"
+ },
+ "version": "1.2.10",
+ "readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.default_type\nSets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe 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/broofa/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/broofa/node-mime/issues"
+ },
+ "_id": "mime@1.2.10",
+ "dist": {
+ "shasum": "53e34f228990f1f6975a3aeeb15dfb1e0404a581"
+ },
+ "_from": "mime@~1.2.9",
+ "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.10.tgz"
+}
diff --git a/node_modules/express/node_modules/send/node_modules/mime/test.js b/node_modules/express/node_modules/send/node_modules/mime/test.js
new file mode 100644
index 0000000..27df440
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/test.js
@@ -0,0 +1,84 @@
+/**
+ * Usage: node test.js
+ */
+
+var mime = require('./mime');
+var assert = require('assert');
+var path = require('path');
+
+function eq(a, b) {
+ console.log('Test: ' + a + ' === ' + b);
+ assert.strictEqual.apply(null, arguments);
+}
+
+console.log(Object.keys(mime.extensions).length + ' types');
+console.log(Object.keys(mime.types).length + ' extensions\n');
+
+//
+// Test mime lookups
+//
+
+eq('text/plain', mime.lookup('text.txt'));
+eq('text/plain', mime.lookup('.text.txt'));
+eq('text/plain', mime.lookup('.txt'));
+eq('text/plain', mime.lookup('txt'));
+eq('application/octet-stream', mime.lookup('text.nope'));
+eq('fallback', mime.lookup('text.fallback', 'fallback'));
+eq('application/octet-stream', mime.lookup('constructor'));
+eq('text/plain', mime.lookup('TEXT.TXT'));
+eq('text/event-stream', mime.lookup('text/event-stream'));
+eq('application/x-web-app-manifest+json', mime.lookup('text.webapp'));
+
+//
+// Test extensions
+//
+
+eq('txt', mime.extension(mime.types.text));
+eq('html', mime.extension(mime.types.htm));
+eq('bin', mime.extension('application/octet-stream'));
+eq('bin', mime.extension('application/octet-stream '));
+eq('html', mime.extension(' text/html; charset=UTF-8'));
+eq('html', mime.extension('text/html; charset=UTF-8 '));
+eq('html', mime.extension('text/html; charset=UTF-8'));
+eq('html', mime.extension('text/html ; charset=UTF-8'));
+eq('html', mime.extension('text/html;charset=UTF-8'));
+eq('html', mime.extension('text/Html;charset=UTF-8'));
+eq(undefined, mime.extension('constructor'));
+
+//
+// Test node types
+//
+
+eq('application/font-woff', mime.lookup('file.woff'));
+eq('application/octet-stream', mime.lookup('file.buffer'));
+eq('audio/mp4', mime.lookup('file.m4a'));
+eq('font/opentype', mime.lookup('file.otf'));
+
+//
+// Test charsets
+//
+
+eq('UTF-8', mime.charsets.lookup('text/plain'));
+eq(undefined, mime.charsets.lookup(mime.types.js));
+eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
+
+//
+// Test for overlaps between mime.types and node.types
+//
+
+var apacheTypes = new mime.Mime(), nodeTypes = new mime.Mime();
+apacheTypes.load(path.join(__dirname, 'types/mime.types'));
+nodeTypes.load(path.join(__dirname, 'types/node.types'));
+
+var keys = [].concat(Object.keys(apacheTypes.types))
+ .concat(Object.keys(nodeTypes.types));
+keys.sort();
+for (var i = 1; i < keys.length; i++) {
+ if (keys[i] == keys[i-1]) {
+ console.warn('Warning: ' +
+ 'node.types defines ' + keys[i] + '->' + nodeTypes.types[keys[i]] +
+ ', mime.types defines ' + keys[i] + '->' + apacheTypes.types[keys[i]]);
+ }
+}
+
+console.log('\nOK');
diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/mime.types b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types
new file mode 100644
index 0000000..da8cd69
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types
@@ -0,0 +1,1588 @@
+# This file maps Internet media types to unique file extension(s).
+# Although created for httpd, this file is used by many software systems
+# and has been placed in the public domain for unlimited redisribution.
+#
+# The table below contains both registered and (common) unregistered types.
+# A type that has no unique extension can be ignored -- they are listed
+# here to guide configurations toward known types and to make it easier to
+# identify "new" types. File extensions are also commonly used to indicate
+# content languages and encodings, so choose them carefully.
+#
+# Internet media types should be registered as described in RFC 4288.
+# The registry is at <http://www.iana.org/assignments/media-types/>.
+#
+# MIME type (lowercased) Extensions
+# ============================================ ==========
+# application/1d-interleaved-parityfec
+# application/3gpp-ims+xml
+# application/activemessage
+application/andrew-inset ez
+# application/applefile
+application/applixware aw
+application/atom+xml atom
+application/atomcat+xml atomcat
+# application/atomicmail
+application/atomsvc+xml atomsvc
+# application/auth-policy+xml
+# application/batch-smtp
+# application/beep+xml
+# application/calendar+xml
+# application/cals-1840
+# application/ccmp+xml
+application/ccxml+xml ccxml
+application/cdmi-capability cdmia
+application/cdmi-container cdmic
+application/cdmi-domain cdmid
+application/cdmi-object cdmio
+application/cdmi-queue cdmiq
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cfw
+# application/cnrp+xml
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csta+xml
+# application/cstadata+xml
+application/cu-seeme cu
+# application/cybercash
+application/davmount+xml davmount
+# application/dca-rft
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dns
+application/docbook+xml dbk
+# application/dskpp+xml
+application/dssc+der dssc
+application/dssc+xml xdssc
+# application/dvcs
+application/ecmascript ecma
+# application/edi-consent
+# application/edi-x12
+# application/edifact
+application/emma+xml emma
+# application/epp+xml
+application/epub+zip epub
+# application/eshop
+# application/example
+application/exi exi
+# application/fastinfoset
+# application/fastsoap
+# application/fits
+application/font-tdpfr pfr
+# application/framework-attributes+xml
+application/gml+xml gml
+application/gpx+xml gpx
+application/gxf gxf
+# application/h224
+# application/held+xml
+# application/http
+application/hyperstudio stk
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+application/inkml+xml ink inkml
+# application/iotp
+application/ipfix ipfix
+# application/ipp
+# application/isup
+application/java-archive jar
+application/java-serialized-object ser
+application/java-vm class
+application/javascript js
+application/json json
+application/jsonml+json jsonml
+# application/kpml-request+xml
+# application/kpml-response+xml
+application/lost+xml lostxml
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+# application/macwriteii
+application/mads+xml mads
+application/marc mrc
+application/marcxml+xml mrcx
+application/mathematica ma nb mb
+# application/mathml-content+xml
+# application/mathml-presentation+xml
+application/mathml+xml mathml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-user-service-description+xml
+application/mbox mbox
+# application/media_control+xml
+application/mediaservercontrol+xml mscml
+application/metalink+xml metalink
+application/metalink4+xml meta4
+application/mets+xml mets
+# application/mikey
+application/mods+xml mods
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
+application/mp21 m21 mp21
+application/mp4 mp4s
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
+# application/msc-ivr+xml
+# application/msc-mixer+xml
+application/msword doc dot
+application/mxf mxf
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy
+application/oda oda
+application/oebps-package+xml opf
+application/ogg ogx
+application/omdoc+xml omdoc
+application/onenote onetoc onetoc2 onetmp onepkg
+application/oxps oxps
+# application/parityfec
+application/patch-ops-error+xml xer
+application/pdf pdf
+application/pgp-encrypted pgp
+# application/pgp-keys
+application/pgp-signature asc sig
+application/pics-rules prf
+# application/pidf+xml
+# application/pidf-diff+xml
+application/pkcs10 p10
+application/pkcs7-mime p7m p7c
+application/pkcs7-signature p7s
+application/pkcs8 p8
+application/pkix-attr-cert ac
+application/pkix-cert cer
+application/pkix-crl crl
+application/pkix-pkipath pkipath
+application/pkixcmp pki
+application/pls+xml pls
+# application/poc-settings+xml
+application/postscript ai eps ps
+# application/prs.alvestrand.titrax-sheet
+application/prs.cww cww
+# application/prs.nprend
+# application/prs.plucker
+# application/prs.rdf-xml-crypt
+# application/prs.xsf+xml
+application/pskc+xml pskcxml
+# application/qsig
+application/rdf+xml rdf
+application/reginfo+xml rif
+application/relax-ng-compact-syntax rnc
+# application/remote-printing
+application/resource-lists+xml rl
+application/resource-lists-diff+xml rld
+# application/riscos
+# application/rlmi+xml
+application/rls-services+xml rs
+application/rpki-ghostbusters gbr
+application/rpki-manifest mft
+application/rpki-roa roa
+# application/rpki-updown
+application/rsd+xml rsd
+application/rss+xml rss
+application/rtf rtf
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
+application/sbml+xml sbml
+application/scvp-cv-request scq
+application/scvp-cv-response scs
+application/scvp-vp-request spq
+application/scvp-vp-response spp
+application/sdp sdp
+# application/set-payment
+application/set-payment-initiation setpay
+# application/set-registration
+application/set-registration-initiation setreg
+# application/sgml
+# application/sgml-open-catalog
+application/shf+xml shf
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
+application/smil+xml smi smil
+# application/soap+fastinfoset
+# application/soap+xml
+application/sparql-query rq
+application/sparql-results+xml srx
+# application/spirits-event+xml
+application/srgs gram
+application/srgs+xml grxml
+application/sru+xml sru
+application/ssdl+xml ssdl
+application/ssml+xml ssml
+# application/tamp-apex-update
+# application/tamp-apex-update-confirm
+# application/tamp-community-update
+# application/tamp-community-update-confirm
+# application/tamp-error
+# application/tamp-sequence-adjust
+# application/tamp-sequence-adjust-confirm
+# application/tamp-status-query
+# application/tamp-status-response
+# application/tamp-update
+# application/tamp-update-confirm
+application/tei+xml tei teicorpus
+application/thraud+xml tfi
+# application/timestamp-query
+# application/timestamp-reply
+application/timestamped-data tsd
+# application/tve-trigger
+# application/ulpfec
+# application/vcard+xml
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp.bsf+xml
+application/vnd.3gpp.pic-bw-large plb
+application/vnd.3gpp.pic-bw-small psb
+application/vnd.3gpp.pic-bw-var pvb
+# application/vnd.3gpp.sms
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap tcap
+application/vnd.3m.post-it-notes pwn
+application/vnd.accpac.simply.aso aso
+application/vnd.accpac.simply.imp imp
+application/vnd.acucobol acu
+application/vnd.acucorp atc acutc
+application/vnd.adobe.air-application-installer-package+zip air
+application/vnd.adobe.formscentral.fcdt fcdt
+application/vnd.adobe.fxp fxp fxpl
+# application/vnd.adobe.partial-upload
+application/vnd.adobe.xdp+xml xdp
+application/vnd.adobe.xfdf xfdf
+# application/vnd.aether.imp
+# application/vnd.ah-barcode
+application/vnd.ahead.space ahead
+application/vnd.airzip.filesecure.azf azf
+application/vnd.airzip.filesecure.azs azs
+application/vnd.amazon.ebook azw
+application/vnd.americandynamics.acc acc
+application/vnd.amiga.ami ami
+# application/vnd.amundsen.maze+xml
+application/vnd.android.package-archive apk
+application/vnd.anser-web-certificate-issue-initiation cii
+application/vnd.anser-web-funds-transfer-initiation fti
+application/vnd.antix.game-component atx
+application/vnd.apple.installer+xml mpkg
+application/vnd.apple.mpegurl m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi swi
+application/vnd.astraea-software.iota iota
+application/vnd.audiograph aep
+# application/vnd.autopackage
+# application/vnd.avistar+xml
+application/vnd.blueice.multipass mpm
+# application/vnd.bluetooth.ep.oob
+application/vnd.bmi bmi
+application/vnd.businessobjects rep
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
+application/vnd.chemdraw+xml cdxml
+application/vnd.chipnuts.karaoke-mmd mmd
+application/vnd.cinderella cdy
+# application/vnd.cirpack.isdn-ext
+application/vnd.claymore cla
+application/vnd.cloanto.rp9 rp9
+application/vnd.clonk.c4group c4g c4d c4f c4p c4u
+application/vnd.cluetrust.cartomobile-config c11amc
+application/vnd.cluetrust.cartomobile-config-pkg c11amz
+# application/vnd.collection+json
+# application/vnd.commerce-battelle
+application/vnd.commonspace csp
+application/vnd.contact.cmsg cdbcmsg
+application/vnd.cosmocaller cmc
+application/vnd.crick.clicker clkx
+application/vnd.crick.clicker.keyboard clkk
+application/vnd.crick.clicker.palette clkp
+application/vnd.crick.clicker.template clkt
+application/vnd.crick.clicker.wordbank clkw
+application/vnd.criticaltools.wbs+xml wbs
+application/vnd.ctc-posml pml
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
+application/vnd.cups-ppd ppd
+# application/vnd.cups-raster
+# application/vnd.cups-raw
+# application/vnd.curl
+application/vnd.curl.car car
+application/vnd.curl.pcurl pcurl
+# application/vnd.cybank
+application/vnd.dart dart
+application/vnd.data-vision.rdz rdz
+application/vnd.dece.data uvf uvvf uvd uvvd
+application/vnd.dece.ttml+xml uvt uvvt
+application/vnd.dece.unspecified uvx uvvx
+application/vnd.dece.zip uvz uvvz
+application/vnd.denovo.fcselayout-link fe_launch
+# application/vnd.dir-bi.plate-dl-nosuffix
+application/vnd.dna dna
+application/vnd.dolby.mlp mlp
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
+application/vnd.dpgraph dpg
+application/vnd.dreamfactory dfac
+application/vnd.ds-keypoint kpxx
+application/vnd.dvb.ait ait
+# application/vnd.dvb.dvbj
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcesgaccess2
+# application/vnd.dvb.ipdcesgpdd
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dvb.pfr
+application/vnd.dvb.service svc
+# application/vnd.dxr
+application/vnd.dynageo geo
+# application/vnd.easykaraoke.cdgdownload
+# application/vnd.ecdis-update
+application/vnd.ecowin.chart mag
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
+application/vnd.enliven nml
+# application/vnd.eprints.data+xml
+application/vnd.epson.esf esf
+application/vnd.epson.msf msf
+application/vnd.epson.quickanime qam
+application/vnd.epson.salt slt
+application/vnd.epson.ssf ssf
+# application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml es3 et3
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvservice+xml
+# application/vnd.etsi.iptvsync+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.overload-control-policy-dataset+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
+application/vnd.ezpix-album ez2
+application/vnd.ezpix-package ez3
+# application/vnd.f-secure.mobile
+application/vnd.fdf fdf
+application/vnd.fdsn.mseed mseed
+application/vnd.fdsn.seed seed dataless
+# application/vnd.ffsns
+# application/vnd.fints
+application/vnd.flographit gph
+application/vnd.fluxtime.clip ftc
+# application/vnd.font-fontforge-sfd
+application/vnd.framemaker fm frame maker book
+application/vnd.frogans.fnc fnc
+application/vnd.frogans.ltf ltf
+application/vnd.fsc.weblaunch fsc
+application/vnd.fujitsu.oasys oas
+application/vnd.fujitsu.oasys2 oa2
+application/vnd.fujitsu.oasys3 oa3
+application/vnd.fujitsu.oasysgp fg5
+application/vnd.fujitsu.oasysprs bh2
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+# application/vnd.fujixerox.hbpl
+application/vnd.fujixerox.ddd ddd
+application/vnd.fujixerox.docuworks xdw
+application/vnd.fujixerox.docuworks.binder xbd
+# application/vnd.fut-misnet
+application/vnd.fuzzysheet fzs
+application/vnd.genomatix.tuxedo txd
+# application/vnd.geocube+xml
+application/vnd.geogebra.file ggb
+application/vnd.geogebra.tool ggt
+application/vnd.geometry-explorer gex gre
+application/vnd.geonext gxt
+application/vnd.geoplan g2w
+application/vnd.geospace g3w
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
+application/vnd.gmx gmx
+application/vnd.google-earth.kml+xml kml
+application/vnd.google-earth.kmz kmz
+application/vnd.grafeq gqf gqs
+# application/vnd.gridmp
+application/vnd.groove-account gac
+application/vnd.groove-help ghf
+application/vnd.groove-identity-message gim
+application/vnd.groove-injector grv
+application/vnd.groove-tool-message gtm
+application/vnd.groove-tool-template tpl
+application/vnd.groove-vcard vcg
+# application/vnd.hal+json
+application/vnd.hal+xml hal
+application/vnd.handheld-entertainment+xml zmm
+application/vnd.hbci hbci
+# application/vnd.hcl-bireports
+application/vnd.hhe.lesson-player les
+application/vnd.hp-hpgl hpgl
+application/vnd.hp-hpid hpid
+application/vnd.hp-hps hps
+application/vnd.hp-jlyt jlt
+application/vnd.hp-pcl pcl
+application/vnd.hp-pclxl pclxl
+# application/vnd.httphone
+application/vnd.hydrostatix.sof-data sfd-hdstx
+# application/vnd.hzn-3d-crossword
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay mpy
+application/vnd.ibm.modcap afp listafp list3820
+application/vnd.ibm.rights-management irm
+application/vnd.ibm.secure-container sc
+application/vnd.iccprofile icc icm
+application/vnd.igloader igl
+application/vnd.immervision-ivp ivp
+application/vnd.immervision-ivu ivu
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
+# application/vnd.infotech.project
+# application/vnd.infotech.project+xml
+# application/vnd.innopath.wamp.notification
+application/vnd.insors.igm igm
+application/vnd.intercon.formnet xpw xpx
+application/vnd.intergeo i2g
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
+application/vnd.intu.qbo qbo
+application/vnd.intu.qfx qfx
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.newsmessage+xml
+# application/vnd.iptc.g2.packageitem+xml
+# application/vnd.iptc.g2.planningitem+xml
+application/vnd.ipunplugged.rcprofile rcprofile
+application/vnd.irepository.package+xml irp
+application/vnd.is-xpr xpr
+application/vnd.isac.fcs fcs
+application/vnd.jam jam
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms rms
+application/vnd.jisp jisp
+application/vnd.joost.joda-archive joda
+application/vnd.kahootz ktz ktr
+application/vnd.kde.karbon karbon
+application/vnd.kde.kchart chrt
+application/vnd.kde.kformula kfo
+application/vnd.kde.kivio flw
+application/vnd.kde.kontour kon
+application/vnd.kde.kpresenter kpr kpt
+application/vnd.kde.kspread ksp
+application/vnd.kde.kword kwd kwt
+application/vnd.kenameaapp htke
+application/vnd.kidspiration kia
+application/vnd.kinar kne knp
+application/vnd.koan skp skd skt skm
+application/vnd.kodak-descriptor sse
+application/vnd.las.las+xml lasxml
+# application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop lbd
+application/vnd.llamagraphics.life-balance.exchange+xml lbe
+application/vnd.lotus-1-2-3 123
+application/vnd.lotus-approach apr
+application/vnd.lotus-freelance pre
+application/vnd.lotus-notes nsf
+application/vnd.lotus-organizer org
+application/vnd.lotus-screencam scm
+application/vnd.lotus-wordpro lwp
+application/vnd.macports.portpkg portpkg
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
+application/vnd.mcd mcd
+application/vnd.medcalcdata mc1
+application/vnd.mediastation.cdkey cdkey
+# application/vnd.meridian-slingshot
+application/vnd.mfer mwf
+application/vnd.mfmp mfm
+application/vnd.micrografx.flo flo
+application/vnd.micrografx.igx igx
+application/vnd.mif mif
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf daf
+application/vnd.mobius.dis dis
+application/vnd.mobius.mbk mbk
+application/vnd.mobius.mqy mqy
+application/vnd.mobius.msl msl
+application/vnd.mobius.plc plc
+application/vnd.mobius.txf txf
+application/vnd.mophun.application mpn
+application/vnd.mophun.certificate mpc
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml xul
+application/vnd.ms-artgalry cil
+# application/vnd.ms-asf
+application/vnd.ms-cab-compressed cab
+# application/vnd.ms-color.iccprofile
+application/vnd.ms-excel xls xlm xla xlc xlt xlw
+application/vnd.ms-excel.addin.macroenabled.12 xlam
+application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb
+application/vnd.ms-excel.sheet.macroenabled.12 xlsm
+application/vnd.ms-excel.template.macroenabled.12 xltm
+application/vnd.ms-fontobject eot
+application/vnd.ms-htmlhelp chm
+application/vnd.ms-ims ims
+application/vnd.ms-lrm lrm
+# application/vnd.ms-office.activex+xml
+application/vnd.ms-officetheme thmx
+# application/vnd.ms-opentype
+# application/vnd.ms-package.obfuscated-opentype
+application/vnd.ms-pki.seccat cat
+application/vnd.ms-pki.stl stl
+# application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint ppt pps pot
+application/vnd.ms-powerpoint.addin.macroenabled.12 ppam
+application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
+application/vnd.ms-powerpoint.slide.macroenabled.12 sldm
+application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm
+application/vnd.ms-powerpoint.template.macroenabled.12 potm
+# application/vnd.ms-printing.printticket+xml
+application/vnd.ms-project mpp mpt
+# application/vnd.ms-tnef
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-word.document.macroenabled.12 docm
+application/vnd.ms-word.template.macroenabled.12 dotm
+application/vnd.ms-works wps wks wcm wdb
+application/vnd.ms-wpl wpl
+application/vnd.ms-xpsdocument xps
+application/vnd.mseq mseq
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
+application/vnd.musician mus
+application/vnd.muvee.style msty
+application/vnd.mynfc taglet
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
+application/vnd.neurolanguage.nlu nlu
+application/vnd.nitf ntf nitf
+application/vnd.noblenet-directory nnd
+application/vnd.noblenet-sealer nns
+application/vnd.noblenet-web nnw
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data ngdat
+application/vnd.nokia.n-gage.symbian.install n-gage
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset rpst
+application/vnd.nokia.radio-presets rpss
+application/vnd.novadigm.edm edm
+application/vnd.novadigm.edx edx
+application/vnd.novadigm.ext ext
+# application/vnd.ntt-local.file-transfer
+# application/vnd.ntt-local.sip-ta_remote
+# application/vnd.ntt-local.sip-ta_tcp_stream
+application/vnd.oasis.opendocument.chart odc
+application/vnd.oasis.opendocument.chart-template otc
+application/vnd.oasis.opendocument.database odb
+application/vnd.oasis.opendocument.formula odf
+application/vnd.oasis.opendocument.formula-template odft
+application/vnd.oasis.opendocument.graphics odg
+application/vnd.oasis.opendocument.graphics-template otg
+application/vnd.oasis.opendocument.image odi
+application/vnd.oasis.opendocument.image-template oti
+application/vnd.oasis.opendocument.presentation odp
+application/vnd.oasis.opendocument.presentation-template otp
+application/vnd.oasis.opendocument.spreadsheet ods
+application/vnd.oasis.opendocument.spreadsheet-template ots
+application/vnd.oasis.opendocument.text odt
+application/vnd.oasis.opendocument.text-master odm
+application/vnd.oasis.opendocument.text-template ott
+application/vnd.oasis.opendocument.text-web oth
+# application/vnd.obn
+# application/vnd.oftn.l10n+json
+# application/vnd.oipf.contentaccessdownload+xml
+# application/vnd.oipf.contentaccessstreaming+xml
+# application/vnd.oipf.cspg-hexbinary
+# application/vnd.oipf.dae.svg+xml
+# application/vnd.oipf.dae.xhtml+xml
+# application/vnd.oipf.mippvcontrolmessage+xml
+# application/vnd.oipf.pae.gem
+# application/vnd.oipf.spdiscovery+xml
+# application/vnd.oipf.spdlist+xml
+# application/vnd.oipf.ueprofile+xml
+# application/vnd.oipf.userprofile+xml
+application/vnd.olpc-sugar xo
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.cab-address-book+xml
+# application/vnd.oma.cab-feature-handler+xml
+# application/vnd.oma.cab-pcc+xml
+# application/vnd.oma.cab-user-prefs+xml
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml dd2
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.pal+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
+application/vnd.openofficeorg.extension oxt
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
+application/vnd.openxmlformats-officedocument.presentationml.slide sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
+application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
+application/vnd.openxmlformats-officedocument.presentationml.template potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.vmldrawing
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.openxmlformats-package.relationships+xml
+# application/vnd.quobject-quoxdocument
+# application/vnd.osa.netdeploy
+application/vnd.osgeo.mapguide.package mgp
+# application/vnd.osgi.bundle
+application/vnd.osgi.dp dp
+application/vnd.osgi.subsystem esa
+# application/vnd.otps.ct-kip+xml
+application/vnd.palm pdb pqa oprc
+# application/vnd.paos.xml
+application/vnd.pawaafile paw
+application/vnd.pg.format str
+application/vnd.pg.osasli ei6
+# application/vnd.piaccess.application-licence
+application/vnd.picsel efif
+application/vnd.pmi.widget wg
+# application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn plf
+application/vnd.powerbuilder6 pbd
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
+application/vnd.previewsystems.box box
+application/vnd.proteus.magazine mgz
+application/vnd.publishare-delta-tree qps
+application/vnd.pvi.ptid1 ptid
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
+application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rainstor.data
+# application/vnd.rapid
+application/vnd.realvnc.bed bed
+application/vnd.recordare.musicxml mxl
+application/vnd.recordare.musicxml+xml musicxml
+# application/vnd.renlearn.rlprint
+application/vnd.rig.cryptonote cryptonote
+application/vnd.rim.cod cod
+application/vnd.rn-realmedia rm
+application/vnd.rn-realmedia-vbr rmvb
+application/vnd.route66.link66+xml link66
+# application/vnd.rs-274x
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail see
+application/vnd.sema sema
+application/vnd.semd semd
+application/vnd.semf semf
+application/vnd.shana.informed.formdata ifm
+application/vnd.shana.informed.formtemplate itp
+application/vnd.shana.informed.interchange iif
+application/vnd.shana.informed.package ipk
+application/vnd.simtech-mindmapper twd twds
+application/vnd.smaf mmf
+# application/vnd.smart.notebook
+application/vnd.smart.teacher teacher
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml sdkm sdkd
+application/vnd.spotfire.dxp dxp
+application/vnd.spotfire.sfs sfs
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
+application/vnd.stardivision.calc sdc
+application/vnd.stardivision.draw sda
+application/vnd.stardivision.impress sdd
+application/vnd.stardivision.math smf
+application/vnd.stardivision.writer sdw vor
+application/vnd.stardivision.writer-global sgl
+application/vnd.stepmania.package smzip
+application/vnd.stepmania.stepchart sm
+# application/vnd.street-stream
+application/vnd.sun.xml.calc sxc
+application/vnd.sun.xml.calc.template stc
+application/vnd.sun.xml.draw sxd
+application/vnd.sun.xml.draw.template std
+application/vnd.sun.xml.impress sxi
+application/vnd.sun.xml.impress.template sti
+application/vnd.sun.xml.math sxm
+application/vnd.sun.xml.writer sxw
+application/vnd.sun.xml.writer.global sxg
+application/vnd.sun.xml.writer.template stw
+# application/vnd.sun.wadl+xml
+application/vnd.sus-calendar sus susp
+application/vnd.svd svd
+# application/vnd.swiftview-ics
+application/vnd.symbian.install sis sisx
+application/vnd.syncml+xml xsm
+application/vnd.syncml.dm+wbxml bdm
+application/vnd.syncml.dm+xml xdm
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive tao
+application/vnd.tcpdump.pcap pcap cap dmp
+application/vnd.tmobile-livetv tmo
+application/vnd.trid.tpt tpt
+application/vnd.triscape.mxs mxs
+application/vnd.trueapp tra
+# application/vnd.truedoc
+# application/vnd.ubisoft.webplayer
+application/vnd.ufdl ufd ufdl
+application/vnd.uiq.theme utz
+application/vnd.umajin umj
+application/vnd.unity unityweb
+application/vnd.uoml+xml uoml
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
+application/vnd.vcx vcx
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.verimatrix.vcas
+# application/vnd.vidsoft.vidconference
+application/vnd.visio vsd vst vss vsw
+application/vnd.visionary vis
+# application/vnd.vividence.scriptfile
+application/vnd.vsf vsf
+# application/vnd.wap.sic
+# application/vnd.wap.slc
+application/vnd.wap.wbxml wbxml
+application/vnd.wap.wmlc wmlc
+application/vnd.wap.wmlscriptc wmlsc
+application/vnd.webturbo wtb
+# application/vnd.wfa.wsc
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player nbp
+application/vnd.wordperfect wpd
+application/vnd.wqd wqd
+# application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf stf
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
+application/vnd.xara xar
+application/vnd.xfdl xfdl
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic hvd
+application/vnd.yamaha.hv-script hvs
+application/vnd.yamaha.hv-voice hvp
+application/vnd.yamaha.openscoreformat osf
+application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg
+# application/vnd.yamaha.remote-setup
+application/vnd.yamaha.smaf-audio saf
+application/vnd.yamaha.smaf-phrase spf
+# application/vnd.yamaha.through-ngn
+# application/vnd.yamaha.tunnel-udpencap
+application/vnd.yellowriver-custom-menu cmp
+application/vnd.zul zir zirz
+application/vnd.zzazz.deck+xml zaz
+application/voicexml+xml vxml
+# application/vq-rtcpxr
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
+application/widget wgt
+application/winhlp hlp
+# application/wita
+# application/wordperfect5.1
+application/wsdl+xml wsdl
+application/wspolicy+xml wspolicy
+application/x-7z-compressed 7z
+application/x-abiword abw
+application/x-ace-compressed ace
+# application/x-amf
+application/x-apple-diskimage dmg
+application/x-authorware-bin aab x32 u32 vox
+application/x-authorware-map aam
+application/x-authorware-seg aas
+application/x-bcpio bcpio
+application/x-bittorrent torrent
+application/x-blorb blb blorb
+application/x-bzip bz
+application/x-bzip2 bz2 boz
+application/x-cbr cbr cba cbt cbz cb7
+application/x-cdlink vcd
+application/x-cfs-compressed cfs
+application/x-chat chat
+application/x-chess-pgn pgn
+application/x-conference nsc
+# application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-debian-package deb udeb
+application/x-dgc-compressed dgc
+application/x-director dir dcr dxr cst cct cxt w3d fgd swa
+application/x-doom wad
+application/x-dtbncx+xml ncx
+application/x-dtbook+xml dtb
+application/x-dtbresource+xml res
+application/x-dvi dvi
+application/x-envoy evy
+application/x-eva eva
+application/x-font-bdf bdf
+# application/x-font-dos
+# application/x-font-framemaker
+application/x-font-ghostscript gsf
+# application/x-font-libgrx
+application/x-font-linux-psf psf
+application/x-font-otf otf
+application/x-font-pcf pcf
+application/x-font-snf snf
+# application/x-font-speedo
+# application/x-font-sunos-news
+application/x-font-ttf ttf ttc
+application/x-font-type1 pfa pfb pfm afm
+application/font-woff woff
+# application/x-font-vfont
+application/x-freearc arc
+application/x-futuresplash spl
+application/x-gca-compressed gca
+application/x-glulx ulx
+application/x-gnumeric gnumeric
+application/x-gramps-xml gramps
+application/x-gtar gtar
+# application/x-gzip
+application/x-hdf hdf
+application/x-install-instructions install
+application/x-iso9660-image iso
+application/x-java-jnlp-file jnlp
+application/x-latex latex
+application/x-lzh-compressed lzh lha
+application/x-mie mie
+application/x-mobipocket-ebook prc mobi
+application/x-ms-application application
+application/x-ms-shortcut lnk
+application/x-ms-wmd wmd
+application/x-ms-wmz wmz
+application/x-ms-xbap xbap
+application/x-msaccess mdb
+application/x-msbinder obd
+application/x-mscardfile crd
+application/x-msclip clp
+application/x-msdownload exe dll com bat msi
+application/x-msmediaview mvb m13 m14
+application/x-msmetafile wmf wmz emf emz
+application/x-msmoney mny
+application/x-mspublisher pub
+application/x-msschedule scd
+application/x-msterminal trm
+application/x-mswrite wri
+application/x-netcdf nc cdf
+application/x-nzb nzb
+application/x-pkcs12 p12 pfx
+application/x-pkcs7-certificates p7b spc
+application/x-pkcs7-certreqresp p7r
+application/x-rar-compressed rar
+application/x-research-info-systems ris
+application/x-sh sh
+application/x-shar shar
+application/x-shockwave-flash swf
+application/x-silverlight-app xap
+application/x-sql sql
+application/x-stuffit sit
+application/x-stuffitx sitx
+application/x-subrip srt
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-t3vm-image t3
+application/x-tads gam
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-tex-tfm tfm
+application/x-texinfo texinfo texi
+application/x-tgif obj
+application/x-ustar ustar
+application/x-wais-source src
+application/x-x509-ca-cert der crt
+application/x-xfig fig
+application/x-xliff+xml xlf
+application/x-xpinstall xpi
+application/x-xz xz
+application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8
+# application/x400-bp
+application/xaml+xml xaml
+# application/xcap-att+xml
+# application/xcap-caps+xml
+application/xcap-diff+xml xdf
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info-diff+xml
+# application/xcon-conference-info+xml
+application/xenc+xml xenc
+application/xhtml+xml xhtml xht
+# application/xhtml-voice+xml
+application/xml xml xsl
+application/xml-dtd dtd
+# application/xml-external-parsed-entity
+# application/xmpp+xml
+application/xop+xml xop
+application/xproc+xml xpl
+application/xslt+xml xslt
+application/xspf+xml xspf
+application/xv+xml mxml xhvml xvml xvm
+application/yang yang
+application/yin+xml yin
+application/zip zip
+# audio/1d-interleaved-parityfec
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
+audio/adpcm adp
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
+audio/basic au snd
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dv
+# audio/dvi4
+# audio/eac3
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/example
+# audio/fwdred
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/gsm-hr-08
+# audio/ilbc
+# audio/ip-mr_v2.5
+# audio/isac
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
+audio/midi mid midi kar rmi
+# audio/mobile-xmf
+audio/mp4 mp4a
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
+audio/mpeg mpga mp2 mp2a mp3 m2a m3a
+# audio/mpeg4-generic
+# audio/musepack
+audio/ogg oga ogg spx
+# audio/opus
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu-wb
+# audio/pcmu
+# audio/prs.sid
+# audio/qcelp
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtx
+audio/s3m s3m
+audio/silk sil
+# audio/smv
+# audio/smv0
+# audio/smv-qcp
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
+audio/vnd.dece.audio uva uvva
+audio/vnd.digital-winds eol
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra dra
+audio/vnd.dts dts
+audio/vnd.dts.hd dtshd
+# audio/vnd.dvb.file
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
+audio/vnd.lucent.voice lvp
+audio/vnd.ms-playready.media.pya pya
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800 ecelp4800
+audio/vnd.nuera.ecelp7470 ecelp7470
+audio/vnd.nuera.ecelp9600 ecelp9600
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+audio/vnd.rip rip
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
+audio/webm weba
+audio/x-aac aac
+audio/x-aiff aif aiff aifc
+audio/x-caf caf
+audio/x-flac flac
+audio/x-matroska mka
+audio/x-mpegurl m3u
+audio/x-ms-wax wax
+audio/x-ms-wma wma
+audio/x-pn-realaudio ram ra
+audio/x-pn-realaudio-plugin rmp
+# audio/x-tta
+audio/x-wav wav
+audio/xm xm
+chemical/x-cdx cdx
+chemical/x-cif cif
+chemical/x-cmdf cmdf
+chemical/x-cml cml
+chemical/x-csml csml
+# chemical/x-pdb
+chemical/x-xyz xyz
+image/bmp bmp
+image/cgm cgm
+# image/example
+# image/fits
+image/g3fax g3
+image/gif gif
+image/ief ief
+# image/jp2
+image/jpeg jpeg jpg jpe
+# image/jpm
+# image/jpx
+image/ktx ktx
+# image/naplps
+image/png png
+image/prs.btif btif
+# image/prs.pti
+image/sgi sgi
+image/svg+xml svg svgz
+# image/t38
+image/tiff tiff tif
+# image/tiff-fx
+image/vnd.adobe.photoshop psd
+# image/vnd.cns.inf2
+image/vnd.dece.graphic uvi uvvi uvg uvvg
+image/vnd.dvb.subtitle sub
+image/vnd.djvu djvu djv
+image/vnd.dwg dwg
+image/vnd.dxf dxf
+image/vnd.fastbidsheet fbs
+image/vnd.fpx fpx
+image/vnd.fst fst
+image/vnd.fujixerox.edmics-mmr mmr
+image/vnd.fujixerox.edmics-rlc rlc
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
+image/vnd.ms-modi mdi
+image/vnd.ms-photo wdp
+image/vnd.net-fpx npx
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
+image/vnd.wap.wbmp wbmp
+image/vnd.xiff xif
+image/webp webp
+image/x-3ds 3ds
+image/x-cmu-raster ras
+image/x-cmx cmx
+image/x-freehand fh fhc fh4 fh5 fh7
+image/x-icon ico
+image/x-mrsid-image sid
+image/x-pcx pcx
+image/x-pict pic pct
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-tga tga
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/feedback-report
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
+message/rfc822 eml mime
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# model/example
+model/iges igs iges
+model/mesh msh mesh silo
+model/vnd.collada+xml dae
+model/vnd.dwf dwf
+# model/vnd.flatland.3dml
+model/vnd.gdl gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
+model/vnd.gtw gtw
+# model/vnd.moml+xml
+model/vnd.mts mts
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
+model/vnd.vtu vtu
+model/vrml wrl vrml
+model/x3d+binary x3db x3dbz
+model/x3d+vrml x3dv x3dvz
+model/x3d+xml x3d x3dz
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
+# text/1d-interleaved-parityfec
+text/cache-manifest appcache
+text/calendar ics ifb
+text/css css
+text/csv csv
+# text/directory
+# text/dns
+# text/ecmascript
+# text/enriched
+# text/example
+# text/fwdred
+text/html html htm
+# text/javascript
+text/n3 n3
+# text/parityfec
+text/plain txt text conf def list log in
+# text/prs.fallenstein.rst
+text/prs.lines.tag dsc
+# text/vnd.radisys.msml-basic-layout
+# text/red
+# text/rfc822-headers
+text/richtext rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtx
+text/sgml sgml sgm
+# text/t140
+text/tab-separated-values tsv
+text/troff t tr roff man me ms
+text/turtle ttl
+# text/ulpfec
+text/uri-list uri uris urls
+text/vcard vcard
+# text/vnd.abc
+text/vnd.curl curl
+text/vnd.curl.dcurl dcurl
+text/vnd.curl.scurl scurl
+text/vnd.curl.mcurl mcurl
+# text/vnd.dmclientscript
+text/vnd.dvb.subtitle sub
+# text/vnd.esmertec.theme-descriptor
+text/vnd.fly fly
+text/vnd.fmi.flexstor flx
+text/vnd.graphviz gv
+text/vnd.in3d.3dml 3dml
+text/vnd.in3d.spot spot
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor jad
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
+text/vnd.wap.wml wml
+text/vnd.wap.wmlscript wmls
+text/x-asm s asm
+text/x-c c cc cxx cpp h hh dic
+text/x-fortran f for f77 f90
+text/x-java-source java
+text/x-opml opml
+text/x-pascal p pas
+text/x-nfo nfo
+text/x-setext etx
+text/x-sfv sfv
+text/x-uuencode uu
+text/x-vcalendar vcs
+text/x-vcard vcf
+# text/xml
+# text/xml-external-parsed-entity
+# video/1d-interleaved-parityfec
+video/3gpp 3gp
+# video/3gpp-tt
+video/3gpp2 3g2
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/example
+video/h261 h261
+video/h263 h263
+# video/h263-1998
+# video/h263-2000
+video/h264 h264
+# video/h264-rcdo
+# video/h264-svc
+video/jpeg jpgv
+# video/jpeg2000
+video/jpm jpm jpgm
+video/mj2 mj2 mjp2
+# video/mp1s
+# video/mp2p
+# video/mp2t
+video/mp4 mp4 mp4v mpg4
+# video/mp4v-es
+video/mpeg mpeg mpg mpe m1v m2v
+# video/mpeg4-generic
+# video/mpv
+# video/nv
+video/ogg ogv
+# video/parityfec
+# video/pointer
+video/quicktime qt mov
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+video/vnd.dece.hd uvh uvvh
+video/vnd.dece.mobile uvm uvvm
+# video/vnd.dece.mp4
+video/vnd.dece.pd uvp uvvp
+video/vnd.dece.sd uvs uvvs
+video/vnd.dece.video uvv uvvv
+# video/vnd.directv.mpeg
+# video/vnd.directv.mpeg-tts
+# video/vnd.dlna.mpeg-tts
+video/vnd.dvb.file dvb
+video/vnd.fvt fvt
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
+video/vnd.mpegurl mxu m4u
+video/vnd.ms-playready.media.pyv pyv
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
+video/vnd.uvvu.mp4 uvu uvvu
+video/vnd.vivo viv
+video/webm webm
+video/x-f4v f4v
+video/x-fli fli
+video/x-flv flv
+video/x-m4v m4v
+video/x-matroska mkv mk3d mks
+video/x-mng mng
+video/x-ms-asf asf asx
+video/x-ms-vob vob
+video/x-ms-wm wm
+video/x-ms-wmv wmv
+video/x-ms-wmx wmx
+video/x-ms-wvx wvx
+video/x-msvideo avi
+video/x-sgi-movie movie
+video/x-smv smv
+x-conference/x-cooltalk ice
diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/node.types b/node_modules/express/node_modules/send/node_modules/mime/types/node.types
new file mode 100644
index 0000000..55b2cf7
--- /dev/null
+++ b/node_modules/express/node_modules/send/node_modules/mime/types/node.types
@@ -0,0 +1,77 @@
+# What: WebVTT
+# Why: To allow formats intended for marking up external text track resources.
+# http://dev.w3.org/html5/webvtt/
+# Added by: niftylettuce
+text/vtt vtt
+
+# What: Google Chrome Extension
+# Why: To allow apps to (work) be served with the right content type header.
+# http://codereview.chromium.org/2830017
+# Added by: niftylettuce
+application/x-chrome-extension crx
+
+# What: HTC support
+# Why: To properly render .htc files such as CSS3PIE
+# Added by: niftylettuce
+text/x-component htc
+
+# What: HTML5 application cache manifes ('.manifest' extension)
+# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
+# per https://developer.mozilla.org/en/offline_resources_in_firefox
+# Added by: louisremi
+text/cache-manifest manifest
+
+# What: node binary buffer format
+# Why: semi-standard extension w/in the node community
+# Added by: tootallnate
+application/octet-stream buffer
+
+# What: The "protected" MP-4 formats used by iTunes.
+# Why: Required for streaming music to browsers (?)
+# Added by: broofa
+application/mp4 m4p
+audio/mp4 m4a
+
+# What: Video format, Part of RFC1890
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+video/MP2T ts
+
+# What: EventSource mime type
+# Why: mime type of Server-Sent Events stream
+# http://www.w3.org/TR/eventsource/#text-event-stream
+# Added by: francois2metz
+text/event-stream event-stream
+
+# What: Mozilla App manifest mime type
+# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests
+# Added by: ednapiranha
+application/x-web-app-manifest+json webapp
+
+# What: Lua file types
+# Why: Googling around shows de-facto consensus on these
+# Added by: creationix (Issue #45)
+text/x-lua lua
+application/x-lua-bytecode luac
+
+# What: Markdown files, as per http://daringfireball.net/projects/markdown/syntax
+# Why: http://stackoverflow.com/questions/10701983/what-is-the-mime-type-for-markdown
+# Added by: avoidwork
+text/x-markdown markdown md mkd
+
+# What: ini files
+# Why: because they're just text files
+# Added by: Matthew Kastor
+text/plain ini
+
+# What: DASH Adaptive Streaming manifest
+# Why: https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video
+# Added by: eelcocramer
+application/dash+xml mdp
+
+# What: OpenType font files - http://www.microsoft.com/typography/otspec/
+# Why: Browsers usually ignore the font MIME types and sniff the content,
+# but Chrome, shows a warning if OpenType fonts aren't served with
+# the `font/opentype` MIME type: http://i.imgur.com/8c5RN8M.png.
+# Added by: alrra
+font/opentype otf
diff --git a/node_modules/express/node_modules/send/package.json b/node_modules/express/node_modules/send/package.json
new file mode 100644
index 0000000..a53f5a6
--- /dev/null
+++ b/node_modules/express/node_modules/send/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "send",
+ "version": "0.1.3",
+ "description": "Better streaming static file server with Range and conditional-GET support",
+ "keywords": [
+ "static",
+ "file",
+ "server"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "dependencies": {
+ "debug": "*",
+ "mime": "~1.2.9",
+ "fresh": "0.1.0",
+ "range-parser": "0.0.4"
+ },
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*",
+ "supertest": "0.0.1",
+ "connect": "2.x"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/send.git"
+ },
+ "main": "index",
+ "readme": "# send\n\n Send is Connect's `static()` extracted for generalized use, a streaming static file\n server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.\n\n## Installation\n\n $ npm install send\n\n## Examples\n\n Small:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n send(req, req.url).pipe(res);\n}).listen(3000);\n```\n\n Serving from a root directory with custom error-handling:\n\n```js\nvar http = require('http');\nvar send = require('send');\nvar url = require('url');\n\nvar app = http.createServer(function(req, res){\n // your custom error-handling logic:\n function error(err) {\n res.statusCode = err.status || 500;\n res.end(err.message);\n }\n\n // your custom directory handling logic:\n function redirect() {\n res.statusCode = 301;\n res.setHeader('Location', req.url + '/');\n res.end('Redirecting to ' + req.url + '/');\n }\n\n // transfer arbitrary files from within\n // /www/example.com/public/*\n send(req, url.parse(req.url).pathname)\n .root('/www/example.com/public')\n .on('error', error)\n .on('directory', redirect)\n .pipe(res);\n}).listen(3000);\n```\n\n## API\n\n### Events\n\n - `error` an error occurred `(err)`\n - `directory` a directory was requested\n - `file` a file was requested `(path, stat)`\n - `stream` file streaming has started `(stream)`\n - `end` streaming has completed\n\n### .root(dir)\n\n Serve files relative to `path`. Aliased as `.from(dir)`.\n\n### .index(path)\n\n By default send supports \"index.html\" files, to disable this\n invoke `.index(false)` or to supply a new index pass a string.\n\n### .maxage(ms)\n\n Provide a max-age in milliseconds for http caching, defaults to 0.\n\n### .hidden(bool)\n\n Enable or disable transfer of hidden files, defaults to false.\n\n## Error-handling\n\n By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.\n\n## Caching\n\n It does _not_ perform internal caching, you should use a reverse proxy cache such\n as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).\n\n## Debugging\n\n To enable `debug()` instrumentation output export __DEBUG__:\n\n```\n$ DEBUG=send node app\n```\n\n## Running tests\n\n```\n$ npm install\n$ make test\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/send/issues"
+ },
+ "_id": "send@0.1.3",
+ "dist": {
+ "shasum": "d9803d3472c0708ff9874dd3e2bebc5476f61fcf"
+ },
+ "_from": "send@0.1.3",
+ "_resolved": "https://registry.npmjs.org/send/-/send-0.1.3.tgz"
+}
diff --git a/node_modules/express/package.json b/node_modules/express/package.json
new file mode 100644
index 0000000..ebce440
--- /dev/null
+++ b/node_modules/express/package.json
@@ -0,0 +1,88 @@
+{
+ "name": "express",
+ "description": "Sinatra inspired web development framework",
+ "version": "3.3.4",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "contributors": [
+ {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ {
+ "name": "Aaron Heckmann",
+ "email": "aaron.heckmann+github@gmail.com"
+ },
+ {
+ "name": "Ciaran Jessup",
+ "email": "ciaranj@gmail.com"
+ },
+ {
+ "name": "Guillermo Rauch",
+ "email": "rauchg@gmail.com"
+ }
+ ],
+ "dependencies": {
+ "connect": "2.8.4",
+ "commander": "1.2.0",
+ "range-parser": "0.0.4",
+ "mkdirp": "0.3.5",
+ "cookie": "0.1.0",
+ "buffer-crc32": "0.2.1",
+ "fresh": "0.1.0",
+ "methods": "0.0.1",
+ "send": "0.1.3",
+ "cookie-signature": "1.0.1",
+ "debug": "*"
+ },
+ "devDependencies": {
+ "ejs": "*",
+ "mocha": "*",
+ "jade": "0.30.0",
+ "hjs": "*",
+ "stylus": "*",
+ "should": "*",
+ "connect-redis": "*",
+ "marked": "*",
+ "supertest": "0.6.0"
+ },
+ "keywords": [
+ "express",
+ "framework",
+ "sinatra",
+ "web",
+ "rest",
+ "restful",
+ "router",
+ "app",
+ "api"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/express"
+ },
+ "main": "index",
+ "bin": {
+ "express": "./bin/express"
+ },
+ "scripts": {
+ "prepublish": "npm prune",
+ "test": "make test"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "readme": "![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)\n\n Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express)\n\n```js\nvar express = require('express');\nvar app = express();\n\napp.get('/', function(req, res){\n res.send('Hello World');\n});\n\napp.listen(3000);\n```\n\n## Installation\n\n $ npm install -g express\n\n## Quick Start\n\n The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:\n\n Create the app:\n\n $ npm install -g express\n $ express /tmp/foo && cd /tmp/foo\n\n Install dependencies:\n\n $ npm install\n\n Start the server:\n\n $ node app\n\n## Features\n\n * Built on [Connect](http://github.com/senchalabs/connect)\n * Robust routing\n * HTTP helpers (redirection, caching, etc)\n * View system supporting 14+ template engines\n * Content negotiation\n * Focus on high performance\n * Environment based configuration\n * Executable for generating applications quickly\n * High test coverage\n\n## Philosophy\n\n The Express philosophy is to provide small, robust tooling for HTTP servers. Making\n it a great solution for single page applications, web sites, hybrids, or public\n HTTP APIs.\n\n Built on Connect you can use _only_ what you need, and nothing more, applications\n can be as big or as small as you like, even a single file. Express does\n not force you to use any specific ORM or template engine. With support for over\n 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)\n you can quickly craft your perfect framework.\n\n## More Information\n\n * Join #express on freenode\n * [Google Group](http://groups.google.com/group/express-js) for discussion\n * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates\n * Visit the [Wiki](http://github.com/visionmedia/express/wiki)\n * [Русскоязычная документация](http://jsman.ru/express/)\n * Run express examples [online](https://runnable.com/express)\n\n## Viewing Examples\n\nClone the Express repo, then install the dev dependencies to install all the example / test suite deps:\n\n $ git clone git://github.com/visionmedia/express.git --depth 1\n $ cd express\n $ npm install\n\nthen run whichever tests you want:\n\n $ node examples/content-negotiation\n\n## Running Tests\n\nTo run the test suite first invoke the following command within the repo, installing the development dependencies:\n\n $ npm install\n\nthen run the tests:\n\n $ make test\n\n## Contributors\n\n```\nproject: express\ncommits: 3559\nactive : 468 days\nfiles : 237\nauthors:\n 1891\tTj Holowaychuk 53.1%\n 1285\tvisionmedia 36.1%\n 182\tTJ Holowaychuk 5.1%\n 54\tAaron Heckmann 1.5%\n 34\tcsausdev 1.0%\n 26\tciaranj 0.7%\n 21\tRobert Sköld 0.6%\n 6\tGuillermo Rauch 0.2%\n 3\tDav Glass 0.1%\n 3\tNick Poulden 0.1%\n 2\tRandy Merrill 0.1%\n 2\tBenny Wong 0.1%\n 2\tHunter Loftis 0.1%\n 2\tJake Gordon 0.1%\n 2\tBrian McKinney 0.1%\n 2\tRoman Shtylman 0.1%\n 2\tBen Weaver 0.1%\n 2\tDave Hoover 0.1%\n 2\tEivind Fjeldstad 0.1%\n 2\tDaniel Shaw 0.1%\n 1\tMatt Colyer 0.0%\n 1\tPau Ramon 0.0%\n 1\tPero Pejovic 0.0%\n 1\tPeter Rekdal Sunde 0.0%\n 1\tRaynos 0.0%\n 1\tTeng Siong Ong 0.0%\n 1\tViktor Kelemen 0.0%\n 1\tctide 0.0%\n 1\t8bitDesigner 0.0%\n 1\tisaacs 0.0%\n 1\tmgutz 0.0%\n 1\tpikeas 0.0%\n 1\tshuwatto 0.0%\n 1\ttstrimple 0.0%\n 1\tewoudj 0.0%\n 1\tAdam Sanderson 0.0%\n 1\tAndrii Kostenko 0.0%\n 1\tAndy Hiew 0.0%\n 1\tArpad Borsos 0.0%\n 1\tAshwin Purohit 0.0%\n 1\tBenjen 0.0%\n 1\tDarren Torpey 0.0%\n 1\tGreg Ritter 0.0%\n 1\tGregory Ritter 0.0%\n 1\tJames Herdman 0.0%\n 1\tJim Snodgrass 0.0%\n 1\tJoe McCann 0.0%\n 1\tJonathan Dumaine 0.0%\n 1\tJonathan Palardy 0.0%\n 1\tJonathan Zacsh 0.0%\n 1\tJustin Lilly 0.0%\n 1\tKen Sato 0.0%\n 1\tMaciej Małecki 0.0%\n 1\tMasahiro Hayashi 0.0%\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2009-2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/express/issues"
+ },
+ "_id": "express@3.3.4",
+ "dist": {
+ "shasum": "e07a8793345fbbc59d0c54be11bee60bd98c9ad2"
+ },
+ "_from": "express@",
+ "_resolved": "https://registry.npmjs.org/express/-/express-3.3.4.tgz"
+}
diff --git a/node_modules/express/test.js b/node_modules/express/test.js
new file mode 100644
index 0000000..e7dca26
--- /dev/null
+++ b/node_modules/express/test.js
@@ -0,0 +1,17 @@
+var http = require('http');
+var express = require('express');
+
+var app = express();
+var sub = express();
+
+app.use('/', function (req, res, next) {
+ next(new Error('something broke'));
+});
+
+sub.use(function (err, req, res, next) {
+ res.send('error handled');
+});
+
+app.use(sub);
+
+http.createServer(app).listen(4000);
diff --git a/node_modules/ws/.npmignore b/node_modules/ws/.npmignore
new file mode 100644
index 0000000..8233793
--- /dev/null
+++ b/node_modules/ws/.npmignore
@@ -0,0 +1,6 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build
+
diff --git a/node_modules/ws/.travis.yml b/node_modules/ws/.travis.yml
new file mode 100644
index 0000000..08e4dad
--- /dev/null
+++ b/node_modules/ws/.travis.yml
@@ -0,0 +1,6 @@
+language: node_js
+npm_args: --ws:native
+node_js:
+ - "0.6"
+ - "0.8"
+ - "0.10"
diff --git a/node_modules/ws/History.md b/node_modules/ws/History.md
new file mode 100644
index 0000000..97c6ec2
--- /dev/null
+++ b/node_modules/ws/History.md
@@ -0,0 +1,260 @@
+v0.4.25 - December 17th, 2012
+=====================
+* Removed install.js. [shtylman]
+* Added browser field to package.json. [shtylman]
+* Support overwriting host header. [Raynos]
+* Emit 'listening' also with custom http server. [sebiq]
+
+v0.4.24 - December 6th, 2012
+=====================
+* Yet another intermediate release, to not delay minor features any longer.
+* Native support installation issues further circumvented. [einaros]
+
+v0.4.23 - November 19th, 2012
+=====================
+* Service release - last before major upgrade.
+* Changes default host from 127.0.0.1 to 0.0.0.0. [einaros]
+
+v0.4.22 - October 3rd, 2012
+=====================
+* clear failsafe cleanup timeout once cleanup is called [AndreasMadsen]
+* added w3c compatible CloseEvent for onclose / addEventListener("close", ...). [einaros]
+* fix the sub protocol header handler [sonnyp]
+* fix unhandled exception if socket closes and 'error' is emitted [jmatthewsr-ms]
+
+v0.4.21 - July 14th, 2012
+=====================
+* Emit error if server reponds with anything other than status code 101. [einaros]
+* Added 'headers' event to server. [rauchg]
+* path.exists moved to fs.exists. [blakmatrix]
+
+v0.4.20 - June 26th, 2012
+=====================
+* node v0.8.0 compatibility release.
+
+v0.4.19 - June 19th, 2012
+=====================
+* Change sender to merge buffers for relatively small payloads, may improve perf in some cases [einaros]
+* Avoid EventEmitter for Receiver classes. As above this may improve perf. [einaros]
+* Renamed fallback files from the somewhat misleading '*Windows'. [einaros]
+
+v0.4.18 - June 14th 2012
+=====================
+* Fixed incorrect md5 digest encoding in Hixie handshake [nicokaiser]
+* Added example of use with Express 3 [einaros]
+* Change installation procedure to not require --ws:native to build native extensions. They will now build if a compiler is available. [einaros]
+
+v0.4.17 - June 13th 2012
+=====================
+* Improve error handling during connection handshaking [einaros]
+* Ensure that errors are caught also after connection teardown [nicokaiser]
+* Update 'mocha' version to 1.1.0. [einaros]
+* Stop showing 'undefined' for some error logs. [tricknotes]
+* Update 'should' version to 0.6.3 [tricknotes]
+
+v0.4.16 - June 1st 2012
+=====================
+* Build fix for Windows. [einaros]
+
+v0.4.15 - May 20th 2012
+=====================
+* Enable fauxe streaming for hixie tansport. [einaros]
+* Allow hixie sender to deal with buffers. [einaros/pigne]
+* Allow error code 1011. [einaros]
+* Fix framing for empty packets (empty pings and pongs might break). [einaros]
+* Improve error and close handling, to avoid connections lingering in CLOSING state. [einaros]
+
+v0.4.14 - Apr 30th 2012
+=====================
+* use node-gyp instead of node-waf [TooTallNate]
+* remove old windows compatibility makefile, and silently fall back to native modules [einaros]
+* ensure connection status [nicokaiser]
+* websocket client updated to use port 443 by default for wss:// connections [einaros]
+* support unix sockets [kschzt]
+
+v0.4.13 - Apr 12th 2012
+=====================
+
+* circumvent node 0.6+ related memory leak caused by Object.defineProperty [nicokaiser]
+* improved error handling, improving stability in massive load use cases [nicokaiser]
+
+v0.4.12 - Mar 30th 2012
+=====================
+
+* various memory leak / possible memory leak cleanups [einaros]
+* api documentation [nicokaiser]
+* add option to disable client tracking [nicokaiser]
+
+v0.4.11 - Mar 24th 2012
+=====================
+
+* node v0.7 compatibillity release
+* gyp support [TooTallNate]
+* commander dependency update [jwueller]
+* loadbalancer support [nicokaiser]
+
+v0.4.10 - Mar 22th 2012
+=====================
+
+* Final hixie close frame fixes. [nicokaiser]
+
+v0.4.9 - Mar 21st 2012
+=====================
+
+* Various hixie bugfixes (such as proper close frame handling). [einaros]
+
+v0.4.8 - Feb 29th 2012
+=====================
+
+* Allow verifyClient to run asynchronously [karlsequin]
+* Various bugfixes and cleanups. [einaros]
+
+v0.4.7 - Feb 21st 2012
+=====================
+
+* Exposed bytesReceived from websocket client object, which makes it possible to implement bandwidth sampling. [einaros]
+* Updated browser based file upload example to include and output per websocket channel bandwidth sampling. [einaros]
+* Changed build scripts to check which architecture is currently in use. Required after the node.js changes to have prebuilt packages target ia32 by default. [einaros]
+
+v0.4.6 - Feb 9th 2012
+=====================
+
+* Added browser based file upload example. [einaros]
+* Added server-to-browser status push example. [einaros]
+* Exposed pause() and resume() on WebSocket object, to enable client stream shaping. [einaros]
+
+v0.4.5 - Feb 7th 2012
+=====================
+
+* Corrected regression bug in handling of connections with the initial frame delivered across both http upgrade head and a standalone packet. This would lead to a race condition, which in some cases could cause message corruption. [einaros]
+
+v0.4.4 - Feb 6th 2012
+=====================
+
+* Pass original request object to verifyClient, for cookie or authentication verifications. [einaros]
+* Implemented addEventListener and slightly improved the emulation API by adding a MessageEvent with a readonly data attribute. [aslakhellesoy]
+* Rewrite parts of hybi receiver to avoid stack overflows for large amounts of packets bundled in the same buffer / packet. [einaros]
+
+v0.4.3 - Feb 4th 2012
+=====================
+
+* Prioritized update: Corrected issue which would cause sockets to stay open longer than necessary, and resource leakage because of this. [einaros]
+
+v0.4.2 - Feb 4th 2012
+=====================
+
+* Breaking change: WebSocketServer's verifyOrigin option has been renamed to verifyClient. [einaros]
+* verifyClient now receives { origin: 'origin header', secure: true/false }, where 'secure' will be true for ssl connections. [einaros]
+* Split benchmark, in preparation for more thorough case. [einaros]
+* Introduced hixie-76 draft support for server, since Safari (iPhone / iPad / OS X) and Opera still aren't updated to use Hybi. [einaros]
+* Expose 'supports' object from WebSocket, to indicate e.g. the underlying transport's support for binary data. [einaros]
+* Test and code cleanups. [einaros]
+
+v0.4.1 - Jan 25th 2012
+=====================
+
+* Use readline in wscat [tricknotes]
+* Refactor _state away, in favor of the new _readyState [tricknotes]
+* travis-ci integration [einaros]
+* Fixed race condition in testsuite, causing a few tests to fail (without actually indicating errors) on travis [einaros]
+* Expose pong event [paddybyers]
+* Enabled running of WebSocketServer in noServer-mode, meaning that upgrades are passed in manually. [einaros]
+* Reworked connection procedure for WebSocketServer, and cleaned up tests. [einaros]
+
+v0.4.0 - Jan 2nd 2012
+=====================
+
+* Windows compatibility [einaros]
+* Windows compatible test script [einaros]
+
+v0.3.9 - Jan 1st 2012
+======================
+
+* Improved protocol framing performance [einaros]
+* WSS support [kazuyukitanimura]
+* WSS tests [einaros]
+* readyState exposed [justinlatimer, tricknotes]
+* url property exposed [justinlatimer]
+* Removed old 'state' property [einaros]
+* Test cleanups [einaros]
+
+v0.3.8 - Dec 27th 2011
+======================
+
+* Made it possible to listen on specific paths, which is especially good to have for precreated http servers [einaros]
+* Extensive WebSocket / WebSocketServer cleanup, including changing all internal properties to unconfigurable, unenumerable properties [einaros]
+* Receiver modifications to ensure even better performance with fragmented sends [einaros]
+* Fixed issue in sender.js, which would cause SlowBuffer instances (such as returned from the crypto library's randomBytes) to be copied (and thus be dead slow) [einaros]
+* Removed redundant buffer copy in sender.js, which should improve server performance [einaros]
+
+v0.3.7 - Dec 25nd 2011
+======================
+
+* Added a browser based API which uses EventEmitters internally [3rd-Eden]
+* Expose request information from upgrade event for websocket server clients [mmalecki]
+
+v0.3.6 - Dec 19th 2011
+======================
+
+* Added option to let WebSocket.Server use an already existing http server [mmalecki]
+* Migrating various option structures to use options.js module [einaros]
+* Added a few more tests, options and handshake verifications to ensure that faulty connections are dealt with [einaros]
+* Code cleanups in Sender and Receiver, to ensure even faster parsing [einaros]
+
+v0.3.5 - Dec 13th 2011
+======================
+
+* Optimized Sender.js, Receiver.js and bufferutil.cc:
+ * Apply loop-unrolling-like small block copies rather than use node.js Buffer#copy() (which is slow).
+ * Mask blocks of data using combination of 32bit xor and loop-unrolling, instead of single bytes.
+ * Keep pre-made send buffer for small transfers.
+* Leak fixes and code cleanups.
+
+v0.3.3 - Dec 12th 2011
+======================
+
+* Compile fix for Linux.
+* Rewrote parts of WebSocket.js, to avoid try/catch and thus avoid optimizer bailouts.
+
+v0.3.2 - Dec 11th 2011
+======================
+
+* Further performance updates, including the additions of a native BufferUtil module, which deals with several of the cpu intensive WebSocket operations.
+
+v0.3.1 - Dec 8th 2011
+======================
+
+* Service release, fixing broken tests.
+
+v0.3.0 - Dec 8th 2011
+======================
+
+* Node.js v0.4.x compatibility.
+* Code cleanups and efficiency improvements.
+* WebSocket server added, although this will still mainly be a client library.
+* WebSocket server certified to pass the Autobahn test suite.
+* Protocol improvements and corrections - such as handling (redundant) masks for empty fragments.
+* 'wscat' command line utility added, which can act as either client or server.
+
+v0.2.6 - Dec 3rd 2011
+======================
+
+* Renamed to 'ws'. Big woop, right -- but easy-websocket really just doesn't cut it anymore!
+
+v0.2.5 - Dec 3rd 2011
+======================
+
+ * Rewrote much of the WebSocket parser, to ensure high speed for highly fragmented messages.
+ * Added a BufferPool, as a start to more efficiently deal with allocations for WebSocket connections. More work to come, in that area.
+ * Updated the Autobahn report, at http://einaros.github.com/easy-websocket, with comparisons against WebSocket-Node 1.0.2 and Chrome 16.
+
+v0.2.0 - Nov 25th 2011
+======================
+
+ * Major rework to make sure all the Autobahn test cases pass. Also updated the internal tests to cover more corner cases.
+
+v0.1.2 - Nov 14th 2011
+======================
+
+ * Back and forth, back and forth: now settled on keeping the api (event names, methods) closer to the websocket browser api. This will stick now.
+ * Started keeping this history record. Better late than never, right?
diff --git a/node_modules/ws/Makefile b/node_modules/ws/Makefile
new file mode 100644
index 0000000..a0b82a1
--- /dev/null
+++ b/node_modules/ws/Makefile
@@ -0,0 +1,38 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+ALL_INTEGRATION = $(shell find test/ -name '*.integration.js')
+
+all:
+ node-gyp configure build
+
+clean:
+ node-gyp clean
+
+run-tests:
+ @./node_modules/.bin/mocha \
+ -t 2000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+run-integrationtests:
+ @./node_modules/.bin/mocha \
+ -t 5000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+test:
+ @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+integrationtest:
+ @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests
+
+benchmark:
+ @node bench/sender.benchmark.js
+ @node bench/parser.benchmark.js
+
+autobahn:
+ @NODE_PATH=lib node test/autobahn.js
+
+autobahn-server:
+ @NODE_PATH=lib node test/autobahn-server.js
+
+.PHONY: test
diff --git a/node_modules/ws/README.md b/node_modules/ws/README.md
new file mode 100644
index 0000000..7eb1a47
--- /dev/null
+++ b/node_modules/ws/README.md
@@ -0,0 +1,159 @@
+[![Build Status](https://secure.travis-ci.org/einaros/ws.png)](http://travis-ci.org/einaros/ws)
+
+# ws: a node.js websocket library #
+
+`ws` is a simple to use websocket implementation, up-to-date against RFC-6455, and [probably the fastest WebSocket library for node.js](http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs).
+
+Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws for the full reports.
+
+Comes with a command line utility, `wscat`, which can either act as a server (--listen), or client (--connect); Use it to debug simple websocket services.
+
+## Protocol support ##
+
+* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. Added to ws version 0.4.2, but server only. Can be disabled by setting the `disableHixie` option to true.)
+* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`, or argument `-p 8` for wscat)
+* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`, or argument `-p 13` for wscat)
+
+_See the echo.websocket.org example below for how to use the `protocolVersion` option._
+
+## Usage ##
+
+### Installing ###
+
+`npm install ws`
+
+### Sending and receiving text data ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://www.host.com/path');
+ws.on('open', function() {
+ ws.send('something');
+});
+ws.on('message', function(data, flags) {
+ // flags.binary will be set if a binary data is received
+ // flags.masked will be set if the data was masked
+});
+```
+
+### Sending binary data ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://www.host.com/path');
+ws.on('open', function() {
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.send(array, {binary: true, mask: true});
+});
+```
+
+Setting `mask`, as done for the send options above, will cause the data to be masked according to the websocket protocol. The same option applies for text data.
+
+### Server example ###
+
+```js
+var WebSocketServer = require('ws').Server
+ , wss = new WebSocketServer({port: 8080});
+wss.on('connection', function(ws) {
+ ws.on('message', function(message) {
+ console.log('received: %s', message);
+ });
+ ws.send('something');
+});
+```
+
+### Error handling best practices ###
+
+```js
+// If the WebSocket is closed before the following send is attempted
+ws.send('something');
+
+// Errors (both immediate and async write errors) can be detected in an optional callback.
+// The callback is also the only way of being notified that data has actually been sent.
+ws.send('something', function(error) {
+ // if error is null, the send has been completed,
+ // otherwise the error object will indicate what failed.
+});
+
+// Immediate errors can also be handled with try/catch-blocks, but **note**
+// that since sends are inherently asynchronous, socket write failures will *not*
+// be captured when this technique is used.
+try {
+ ws.send('something');
+}
+catch (e) {
+ // handle error
+}
+```
+
+### echo.websocket.org demo ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 8, origin: 'http://websocket.org'});
+ws.on('open', function() {
+ console.log('connected');
+ ws.send(Date.now().toString(), {mask: true});
+});
+ws.on('close', function() {
+ console.log('disconnected');
+});
+ws.on('message', function(data, flags) {
+ console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);
+ setTimeout(function() {
+ ws.send(Date.now().toString(), {mask: true});
+ }, 500);
+});
+```
+
+### wscat against echo.websocket.org ###
+
+ $ npm install -g ws
+ $ wscat -c ws://echo.websocket.org -p 8
+ connected (press CTRL+C to quit)
+ > hi there
+ < hi there
+ > are you a happy parrot?
+ < are you a happy parrot?
+
+### Other examples ###
+
+For a full example with a browser client communicating with a ws server, see the examples folder.
+
+Note that the usage together with Express 3.0 is quite different from Express 2.x. The difference is expressed in the two different serverstats-examples.
+
+Otherwise, see the test cases.
+
+### Running the tests ###
+
+`make test`
+
+## API Docs ##
+
+See the doc/ directory for Node.js-like docs for the ws classes.
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2011 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ws/bench/parser.benchmark.js b/node_modules/ws/bench/parser.benchmark.js
new file mode 100644
index 0000000..ff5f737
--- /dev/null
+++ b/node_modules/ws/bench/parser.benchmark.js
@@ -0,0 +1,115 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+/**
+ * Benchmark dependencies.
+ */
+
+var benchmark = require('benchmark')
+ , Receiver = require('../').Receiver
+ , suite = new benchmark.Suite('Receiver');
+require('tinycolor');
+require('./util');
+
+/**
+ * Setup receiver.
+ */
+
+suite.on('start', function () {
+ receiver = new Receiver();
+});
+
+suite.on('cycle', function () {
+ receiver = new Receiver();
+});
+
+/**
+ * Benchmarks.
+ */
+
+var pingMessage = 'Hello'
+ , pingPacket1 = getBufferFromHexString('89 ' + (pack(2, 0x80 | pingMessage.length)) +
+ ' 34 83 a8 68 '+ getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68')));
+suite.add('ping message', function () {
+ receiver.add(pingPacket1);
+});
+
+var pingPacket2 = getBufferFromHexString('89 00')
+suite.add('ping with no data', function () {
+ receiver.add(pingPacket2);
+});
+
+var closePacket = getBufferFromHexString('88 00');
+suite.add('close message', function () {
+ receiver.add(closePacket);
+ receiver.endPacket();
+});
+
+var maskedTextPacket = getBufferFromHexString('81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5');
+suite.add('masked text message', function () {
+ receiver.add(maskedTextPacket);
+});
+
+binaryDataPacket = (function() {
+ var length = 125
+ , message = new Buffer(length)
+ for (var i = 0; i < length; ++i) message[i] = i % 10;
+ return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 '
+ + getHexStringFromBuffer(mask(message), '34 83 a8 68'));
+})();
+suite.add('binary data (125 bytes)', function () {
+ try {
+ receiver.add(binaryDataPacket);
+
+ }
+ catch(e) {console.log(e)}
+});
+
+binaryDataPacket2 = (function() {
+ var length = 65535
+ , message = new Buffer(length)
+ for (var i = 0; i < length; ++i) message[i] = i % 10;
+ return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 '
+ + getHexStringFromBuffer(mask(message), '34 83 a8 68'));
+})();
+suite.add('binary data (65535 bytes)', function () {
+ receiver.add(binaryDataPacket2);
+});
+
+binaryDataPacket3 = (function() {
+ var length = 200*1024
+ , message = new Buffer(length)
+ for (var i = 0; i < length; ++i) message[i] = i % 10;
+ return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 '
+ + getHexStringFromBuffer(mask(message), '34 83 a8 68'));
+})();
+suite.add('binary data (200 kB)', function () {
+ receiver.add(binaryDataPacket3);
+});
+
+/**
+ * Output progress.
+ */
+
+suite.on('cycle', function (bench, details) {
+ console.log('\n ' + suite.name.grey, details.name.white.bold);
+ console.log(' ' + [
+ details.hz.toFixed(2).cyan + ' ops/sec'.grey
+ , details.count.toString().white + ' times executed'.grey
+ , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey
+ ,
+ ].join(', '.grey));
+});
+
+/**
+ * Run/export benchmarks.
+ */
+
+if (!module.parent) {
+ suite.run();
+} else {
+ module.exports = suite;
+}
diff --git a/node_modules/ws/bench/sender.benchmark.js b/node_modules/ws/bench/sender.benchmark.js
new file mode 100644
index 0000000..20c171a
--- /dev/null
+++ b/node_modules/ws/bench/sender.benchmark.js
@@ -0,0 +1,66 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+/**
+ * Benchmark dependencies.
+ */
+
+var benchmark = require('benchmark')
+ , Sender = require('../').Sender
+ , suite = new benchmark.Suite('Sender');
+require('tinycolor');
+require('./util');
+
+/**
+ * Setup sender.
+ */
+
+suite.on('start', function () {
+ sender = new Sender();
+ sender._socket = { write: function() {} };
+});
+
+suite.on('cycle', function () {
+ sender = new Sender();
+ sender._socket = { write: function() {} };
+});
+
+/**
+ * Benchmarks
+ */
+
+framePacket = new Buffer(200*1024);
+framePacket.fill(99);
+suite.add('frameAndSend, unmasked (200 kB)', function () {
+ sender.frameAndSend(0x2, framePacket, true, false);
+});
+suite.add('frameAndSend, masked (200 kB)', function () {
+ sender.frameAndSend(0x2, framePacket, true, true);
+});
+
+/**
+ * Output progress.
+ */
+
+suite.on('cycle', function (bench, details) {
+ console.log('\n ' + suite.name.grey, details.name.white.bold);
+ console.log(' ' + [
+ details.hz.toFixed(2).cyan + ' ops/sec'.grey
+ , details.count.toString().white + ' times executed'.grey
+ , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey
+ ,
+ ].join(', '.grey));
+});
+
+/**
+ * Run/export benchmarks.
+ */
+
+if (!module.parent) {
+ suite.run();
+} else {
+ module.exports = suite;
+}
diff --git a/node_modules/ws/bench/speed.js b/node_modules/ws/bench/speed.js
new file mode 100644
index 0000000..3ce6414
--- /dev/null
+++ b/node_modules/ws/bench/speed.js
@@ -0,0 +1,105 @@
+var cluster = require('cluster')
+ , WebSocket = require('../')
+ , WebSocketServer = WebSocket.Server
+ , crypto = require('crypto')
+ , util = require('util')
+ , ansi = require('ansi');
+require('tinycolor');
+
+function roundPrec(num, prec) {
+ var mul = Math.pow(10, prec);
+ return Math.round(num * mul) / mul;
+}
+
+function humanSize(bytes) {
+ if (bytes >= 1048576) return roundPrec(bytes / 1048576, 2) + ' MB';
+ if (bytes >= 1024) return roundPrec(bytes / 1024, 2) + ' kB';
+ return roundPrec(bytes, 2) + ' B';
+}
+
+function generateRandomData(size) {
+ var buffer = new Buffer(size);
+ for (var i = 0; i < size; ++i) {
+ buffer[i] = ~~(Math.random() * 127);
+ }
+ return buffer;
+}
+
+if (cluster.isMaster) {
+ var wss = new WebSocketServer({port: 8181}, function() {
+ cluster.fork();
+ });
+ wss.on('connection', function(ws) {
+ ws.on('message', function(data, flags) {
+ ws.send(data, {binary: flags&&flags.binary});
+ });
+ ws.on('close', function() {});
+ });
+ cluster.on('death', function(worker) {
+ wss.close();
+ });
+}
+else {
+ var cursor = ansi(process.stdout);
+
+ var configs = [
+ [true, 10000, 64],
+ [true, 5000, 16*1024],
+ [true, 1000, 128*1024],
+ [true, 100, 1024*1024],
+ [true, 1, 500*1024*1024],
+ [false, 10000, 64],
+ [false, 5000, 16*1024],
+ [false, 1000, 128*1024],
+ [false, 100, 1024*1024],
+ ];
+
+ var largest = configs[0][1];
+ for (var i = 0, l = configs.length; i < l; ++i) {
+ if (configs[i][2] > largest) largest = configs[i][2];
+ }
+
+ console.log('Generating %s of test data ...', humanSize(largest));
+ var randomBytes = generateRandomData(largest);
+
+ function roundtrip(useBinary, roundtrips, size, cb) {
+ var data = randomBytes.slice(0, size);
+ var prefix = util.format('Running %d roundtrips of %s %s data', roundtrips, humanSize(size), useBinary ? 'binary' : 'text');
+ console.log(prefix);
+ var client = new WebSocket('ws://localhost:' + '8181');
+ var dt;
+ var roundtrip = 0;
+ function send() {
+ client.send(data, {binary: useBinary});
+ }
+ client.on('error', function(e) {
+ console.error(e);
+ process.exit();
+ });
+ client.on('open', function() {
+ dt = Date.now();
+ send();
+ });
+ client.on('message', function(data, flags) {
+ if (++roundtrip == roundtrips) {
+ var elapsed = Date.now() - dt;
+ cursor.up();
+ console.log('%s:\t%ss\t%s'
+ , useBinary ? prefix.green : prefix.cyan
+ , roundPrec(elapsed / 1000, 1).toString().green.bold
+ , (humanSize((size * roundtrips) / elapsed * 1000) + '/s').blue.bold);
+ client.close();
+ cb();
+ return;
+ }
+ process.nextTick(send);
+ });
+ }
+
+ (function run() {
+ if (configs.length == 0) process.exit();
+ var config = configs.shift();
+ config.push(run);
+ roundtrip.apply(null, config);
+ })();
+} \ No newline at end of file
diff --git a/node_modules/ws/bench/util.js b/node_modules/ws/bench/util.js
new file mode 100644
index 0000000..5f01281
--- /dev/null
+++ b/node_modules/ws/bench/util.js
@@ -0,0 +1,105 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+/**
+ * Returns a Buffer from a "ff 00 ff"-type hex string.
+ */
+
+getBufferFromHexString = function(byteStr) {
+ var bytes = byteStr.split(' ');
+ var buf = new Buffer(bytes.length);
+ for (var i = 0; i < bytes.length; ++i) {
+ buf[i] = parseInt(bytes[i], 16);
+ }
+ return buf;
+}
+
+/**
+ * Returns a hex string from a Buffer.
+ */
+
+getHexStringFromBuffer = function(data) {
+ var s = '';
+ for (var i = 0; i < data.length; ++i) {
+ s += padl(data[i].toString(16), 2, '0') + ' ';
+ }
+ return s.trim();
+}
+
+/**
+ * Splits a buffer in two parts.
+ */
+
+splitBuffer = function(buffer) {
+ var b1 = new Buffer(Math.ceil(buffer.length / 2));
+ buffer.copy(b1, 0, 0, b1.length);
+ var b2 = new Buffer(Math.floor(buffer.length / 2));
+ buffer.copy(b2, 0, b1.length, b1.length + b2.length);
+ return [b1, b2];
+}
+
+/**
+ * Performs hybi07+ type masking on a hex string or buffer.
+ */
+
+mask = function(buf, maskString) {
+ if (typeof buf == 'string') buf = new Buffer(buf);
+ var mask = getBufferFromHexString(maskString || '34 83 a8 68');
+ for (var i = 0; i < buf.length; ++i) {
+ buf[i] ^= mask[i % 4];
+ }
+ return buf;
+}
+
+/**
+ * Returns a hex string representing the length of a message
+ */
+
+getHybiLengthAsHexString = function(len, masked) {
+ if (len < 126) {
+ var buf = new Buffer(1);
+ buf[0] = (masked ? 0x80 : 0) | len;
+ }
+ else if (len < 65536) {
+ var buf = new Buffer(3);
+ buf[0] = (masked ? 0x80 : 0) | 126;
+ getBufferFromHexString(pack(4, len)).copy(buf, 1);
+ }
+ else {
+ var buf = new Buffer(9);
+ buf[0] = (masked ? 0x80 : 0) | 127;
+ getBufferFromHexString(pack(16, len)).copy(buf, 1);
+ }
+ return getHexStringFromBuffer(buf);
+}
+
+/**
+ * Unpacks a Buffer into a number.
+ */
+
+unpack = function(buffer) {
+ var n = 0;
+ for (var i = 0; i < buffer.length; ++i) {
+ n = (i == 0) ? buffer[i] : (n * 256) + buffer[i];
+ }
+ return n;
+}
+
+/**
+ * Returns a hex string, representing a specific byte count 'length', from a number.
+ */
+
+pack = function(length, number) {
+ return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim();
+}
+
+/**
+ * Left pads the string 's' to a total length of 'n' with char 'c'.
+ */
+
+padl = function(s, n, c) {
+ return new Array(1 + n - s.length).join(c) + s;
+}
diff --git a/node_modules/ws/bin/wscat b/node_modules/ws/bin/wscat
new file mode 100644
index 0000000..0ec894d
--- /dev/null
+++ b/node_modules/ws/bin/wscat
@@ -0,0 +1,190 @@
+#!/usr/bin/env node
+
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var WebSocket = require('../')
+ , fs = require('fs')
+ , program = require('commander')
+ , util = require('util')
+ , events = require('events')
+ , readline = require('readline');
+
+/**
+ * InputReader - processes console input
+ */
+
+function Console() {
+ this.stdin = process.stdin;
+ this.stdout = process.stdout;
+
+ this.readlineInterface = readline.createInterface(this.stdin, this.stdout);
+
+ var self = this;
+ this.readlineInterface.on('line', function(data) {
+ self.emit('line', data);
+ });
+ this.readlineInterface.on('close', function() {
+ self.emit('close');
+ });
+
+ this._resetInput = function() {
+ self.clear();
+ }
+}
+util.inherits(Console, events.EventEmitter);
+
+Console.Colors = {
+ Red: '\033[31m',
+ Green: '\033[32m',
+ Yellow: '\033[33m',
+ Blue: '\033[34m',
+ Default: '\033[39m'
+};
+
+Console.prototype.prompt = function() {
+ this.readlineInterface.prompt();
+}
+
+Console.prototype.print = function(msg, color) {
+ this.clear();
+ color = color || Console.Colors.Default;
+ this.stdout.write(color + msg + Console.Colors.Default + '\n');
+ this.prompt();
+}
+
+Console.prototype.clear = function() {
+ this.stdout.write('\033[2K\033[E');
+}
+
+Console.prototype.pause = function() {
+ this.stdin.on('keypress', this._resetInput);
+}
+
+Console.prototype.resume = function() {
+ this.stdin.removeListener('keypress', this._resetInput);
+}
+
+/**
+ * The actual application
+ */
+
+var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version;
+program
+ .version(version)
+ .usage('[options] <url>')
+ .option('-l, --listen <port>', 'listen on port')
+ .option('-c, --connect <url>', 'connect to a websocket server')
+ .option('-p, --protocol <version>', 'optional protocol version')
+ .option('-o, --origin <origin>', 'optional origin')
+ .option('--host <host>', 'optional host')
+ .option('-s, --subprotocol <protocol>', 'optional subprotocol')
+ .parse(process.argv);
+
+if (program.listen && program.connect) {
+ console.error('\033[33merror: use either --listen or --connect\033[39m');
+ process.exit(-1);
+}
+else if (program.listen) {
+ var wsConsole = new Console();
+ wsConsole.pause();
+ var options = {};
+ if (program.protocol) options.protocolVersion = program.protocol;
+ if (program.origin) options.origin = program.origin;
+ if (program.subprotocol) options.protocol = program.subprotocol;
+ var ws = null;
+ var wss = new WebSocket.Server({port: program.listen}, function() {
+ wsConsole.print('listening on port ' + program.listen + ' (press CTRL+C to quit)', Console.Colors.Green);
+ wsConsole.clear();
+ });
+ wsConsole.on('close', function() {
+ if (ws) {
+ try {
+ ws.close();
+ }
+ catch (e) {}
+ }
+ process.exit(0);
+ });
+ wsConsole.on('line', function(data) {
+ if (ws) {
+ ws.send(data, {mask: false});
+ wsConsole.prompt();
+ }
+ });
+ wss.on('connection', function(newClient) {
+ if (ws) {
+ // limit to one client
+ newClient.terminate();
+ return;
+ };
+ ws = newClient;
+ wsConsole.resume();
+ wsConsole.prompt();
+ wsConsole.print('client connected', Console.Colors.Green);
+ ws.on('close', function() {
+ wsConsole.print('disconnected', Console.Colors.Green);
+ wsConsole.clear();
+ wsConsole.pause();
+ ws = null;
+ });
+ ws.on('error', function(code, description) {
+ wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow);
+ });
+ ws.on('message', function(data, flags) {
+ wsConsole.print('< ' + data, Console.Colors.Blue);
+ });
+ });
+ wss.on('error', function(error) {
+ wsConsole.print('error: ' + error.toString(), Console.Colors.Yellow);
+ process.exit(-1);
+ });
+}
+else if (program.connect) {
+ var wsConsole = new Console();
+ var options = {};
+ if (program.protocol) options.protocolVersion = program.protocol;
+ if (program.origin) options.origin = program.origin;
+ if (program.subprotocol) options.protocol = program.subprotocol;
+ if (program.host) options.host = program.host;
+ var ws = new WebSocket(program.connect, options);
+ ws.on('open', function() {
+ wsConsole.print('connected (press CTRL+C to quit)', Console.Colors.Green);
+ wsConsole.on('line', function(data) {
+ ws.send(data, {mask: true});
+ wsConsole.prompt();
+ });
+ });
+ ws.on('close', function() {
+ wsConsole.print('disconnected', Console.Colors.Green);
+ wsConsole.clear();
+ process.exit();
+ });
+ ws.on('error', function(code, description) {
+ wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow);
+ process.exit(-1);
+ });
+ ws.on('message', function(data, flags) {
+ wsConsole.print('< ' + data, Console.Colors.Blue);
+ });
+ wsConsole.on('close', function() {
+ if (ws) {
+ try {
+ ws.close();
+ }
+ catch(e) {}
+ process.exit();
+ }
+ });
+}
+else {
+ console.error('\033[33merror: use either --listen or --connect\033[39m');
+ process.exit(-1);
+}
diff --git a/node_modules/ws/binding.gyp b/node_modules/ws/binding.gyp
new file mode 100644
index 0000000..a83d279
--- /dev/null
+++ b/node_modules/ws/binding.gyp
@@ -0,0 +1,14 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'validation',
+ 'cflags': [ '-O3' ],
+ 'sources': [ 'src/validation.cc' ]
+ },
+ {
+ 'target_name': 'bufferutil',
+ 'cflags': [ '-O3' ],
+ 'sources': [ 'src/bufferutil.cc' ]
+ }
+ ]
+}
diff --git a/node_modules/ws/builderror.log b/node_modules/ws/builderror.log
new file mode 100644
index 0000000..a3b0a0c
--- /dev/null
+++ b/node_modules/ws/builderror.log
@@ -0,0 +1,11 @@
+gyp ERR! configure error
+gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
+gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:118:14)
+gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:81:11
+gyp ERR! stack at Object.oncomplete (fs.js:107:15)
+gyp ERR! System Windows_NT 6.1.7600
+gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
+gyp ERR! cwd C:\Users\Administrator\Downloads\webRTCCopy-master\server\node_modules\ws
+gyp ERR! node -v v0.10.15
+gyp ERR! node-gyp -v v0.10.6
+gyp ERR! not ok
diff --git a/node_modules/ws/doc/ws.md b/node_modules/ws/doc/ws.md
new file mode 100644
index 0000000..c7c6fcb
--- /dev/null
+++ b/node_modules/ws/doc/ws.md
@@ -0,0 +1,179 @@
+# ws
+
+## Class: ws.Server
+
+This class is a WebSocket server. It is an `EventEmitter`.
+
+### new ws.Server([options], [callback])
+
+* `options` Object
+ * `host` String
+ * `port` Number
+ * `server` http.Server
+ * `verifyClient` Function
+ * `path` String
+ * `noServer` Boolean
+ * `disableHixie` Boolean
+ * `clientTracking` Boolean
+* `callback` Function
+
+Construct a new server object.
+
+Either `port` or `server` must be provided, otherwise you might enable
+`noServer` if you want to pass the requests directly. Please note that the
+`callback` is only used when you supply the a `port` number in the options.
+
+### server.close([code], [data])
+
+Close the server and terminate all clients
+
+### server.handleUpgrade(request, socket, upgradeHead, callback)
+
+Handles a HTTP Upgrade request. `request` is an instance of `http.ServerRequest`, `socket` is an instance of `net.Socket`.
+
+When the Upgrade was successfully, the `callback` will be called with a `ws.WebSocket` object as parameter.
+
+### Event: 'error'
+
+`function (error) { }`
+
+If the underlying server emits an error, it will be forwarded here.
+
+### Event: 'headers'
+
+`function (headers) { }`
+
+Emitted with the object of HTTP headers that are going to be written to the `Stream` as part of the handshake.
+
+### Event: 'connection'
+
+`function (socket) { }`
+
+When a new WebSocket connection is established. `socket` is an object of type `ws.WebSocket`.
+
+
+## Class: ws.WebSocket
+
+This class represents a WebSocket connection. It is an `EventEmitter`.
+
+### new ws.WebSocket(address, [options])
+
+* `address` String|Array
+* `options` Object
+ * `protocol` String
+ * `protocolVersion` Number|String
+ -- the following only apply if `address` is a String
+ * `host` String
+ * `origin` String
+ * `pfx` String|Buffer
+ * `key` String|Buffer
+ * `passphrase` String
+ * `cert` String|Buffer
+ * `ca` Array
+ * `ciphers` String
+ * `rejectUnauthorized` Boolean
+
+Instantiating with an `address` creates a new WebSocket client object. If `address` is an Array (request, socket, rest), it is instantiated as a Server client (e.g. called from the `ws.Server`).
+
+### websocket.bytesReceived
+
+Received bytes count.
+
+### websocket.readyState
+
+Possible states are `WebSocket.CONNECTING`, `WebSocket.OPEN`, `WebSocket.CLOSING`, `WebSocket.CLOSED`.
+
+### websocket.protocolVersion
+
+The WebSocket protocol version used for this connection, `8`, `13` or `hixie-76` (the latter only for server clients).
+
+### websocket.url
+
+The URL of the WebSocket server (only for clients)
+
+### websocket.supports
+
+Describes the feature of the used protocol version. E.g. `supports.binary` is a boolean that describes if the connection supports binary messages.
+
+### websocket.close([code], [data])
+
+Gracefully closes the connection, after sending a description message
+
+### websocket.pause()
+
+Pause the client stream
+
+### websocket.ping([data], [options], [dontFailWhenClosed])
+
+Sends a ping. `data` is sent, `options` is an object with members `mask` and `binary`. `dontFailWhenClosed` indicates whether or not to throw if the connection isnt open.
+
+### websocket.pong([data], [options], [dontFailWhenClosed])
+
+Sends a pong. `data` is sent, `options` is an object with members `mask` and `binary`. `dontFailWhenClosed` indicates whether or not to throw if the connection isnt open.
+
+
+### websocket.resume()
+
+Resume the client stream
+
+### websocket.send(data, [options], [callback])
+
+Sends `data` through the connection. `options` can be an object with members `mask` and `binary`. The optional `callback` is executed after the send completes.
+
+### websocket.stream([options], callback)
+
+Streams data through calls to a user supplied function. `options` can be an object with members `mask` and `binary`. `callback` is executed on successive ticks of which send is `function (data, final)`.
+
+### websocket.terminate()
+
+Immediately shuts down the connection
+
+### websocket.onopen
+### websocket.onerror
+### websocket.onclose
+### websocket.onmessage
+
+Emulates the W3C Browser based WebSocket interface using function members.
+
+### websocket.addEventListener(method, listener)
+
+Emulates the W3C Browser based WebSocket interface using addEventListener.
+
+### Event: 'error'
+
+`function (error) { }`
+
+If the client emits an error, this event is emitted (errors from the underlying `net.Socket` are forwarded here).
+
+### Event: 'close'
+
+`function (code, message) { }`
+
+Is emitted when the connection is closed. `code` is defined in the WebSocket specification.
+
+The `close` event is also emitted when then underlying `net.Socket` closes the connection (`end` or `close`).
+
+### Event: 'message'
+
+`function (data, flags) { }`
+
+Is emitted when data is received. `flags` is an object with member `binary`.
+
+### Event: 'ping'
+
+`function (data, flags) { }`
+
+Is emitted when a ping is received. `flags` is an object with member `binary`.
+
+### Event: 'pong'
+
+`function (data, flags) { }`
+
+Is emitted when a pong is received. `flags` is an object with member `binary`.
+
+### Event: 'open'
+
+`function () { }`
+
+Emitted when the connection is established.
+
diff --git a/node_modules/ws/examples/fileapi/.npmignore b/node_modules/ws/examples/fileapi/.npmignore
new file mode 100644
index 0000000..dcd5756
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/.npmignore
@@ -0,0 +1 @@
+uploaded
diff --git a/node_modules/ws/examples/fileapi/package.json b/node_modules/ws/examples/fileapi/package.json
new file mode 100644
index 0000000..7816f27
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/package.json
@@ -0,0 +1,18 @@
+{
+ "author": "",
+ "name": "fileapi",
+ "version": "0.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/ws.git"
+ },
+ "engines": {
+ "node": "~0.6.8"
+ },
+ "dependencies": {
+ "express": "latest",
+ "ansi": "https://github.com/einaros/ansi.js/tarball/master"
+ },
+ "devDependencies": {},
+ "optionalDependencies": {}
+}
diff --git a/node_modules/ws/examples/fileapi/public/app.js b/node_modules/ws/examples/fileapi/public/app.js
new file mode 100644
index 0000000..e812cc3
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/public/app.js
@@ -0,0 +1,39 @@
+function onFilesSelected(e) {
+ var button = e.srcElement;
+ button.disabled = true;
+ var progress = document.querySelector('div#progress');
+ progress.innerHTML = '0%';
+ var files = e.target.files;
+ var totalFiles = files.length;
+ var filesSent = 0;
+ if (totalFiles) {
+ var uploader = new Uploader('ws://localhost:8080', function () {
+ Array.prototype.slice.call(files, 0).forEach(function(file) {
+ if (file.name == '.') {
+ --totalFiles;
+ return;
+ }
+ uploader.sendFile(file, function(error) {
+ if (error) {
+ console.log(error);
+ return;
+ }
+ ++filesSent;
+ progress.innerHTML = ~~(filesSent / totalFiles * 100) + '%';
+ console.log('Sent: ' + file.name);
+ });
+ });
+ });
+ }
+ uploader.ondone = function() {
+ uploader.close();
+ progress.innerHTML = '100% done, ' + totalFiles + ' files sent.';
+ }
+}
+
+window.onload = function() {
+ var importButtons = document.querySelectorAll('[type="file"]');
+ Array.prototype.slice.call(importButtons, 0).forEach(function(importButton) {
+ importButton.addEventListener('change', onFilesSelected, false);
+ });
+}
diff --git a/node_modules/ws/examples/fileapi/public/index.html b/node_modules/ws/examples/fileapi/public/index.html
new file mode 100644
index 0000000..0d463dd
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/public/index.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ body {
+ font-family: Tahoma, Geneva, sans-serif;
+ }
+ div {
+ display: inline;
+ }
+ </style>
+ <script src='uploader.js'></script>
+ <script src='app.js'></script>
+ </head>
+ <body>
+ <p>This example will upload an entire directory tree to the node.js server via a fast and persistent WebSocket connection.</p>
+ <p>Note that the example is Chrome only for now.</p>
+ <input type="file" webkitdirectory /><br/><br/>
+ Upload status:
+ <div id='progress'>Please select a directory to upload.</div>
+ </body>
+</html>
diff --git a/node_modules/ws/examples/fileapi/public/uploader.js b/node_modules/ws/examples/fileapi/public/uploader.js
new file mode 100644
index 0000000..0c34a7f
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/public/uploader.js
@@ -0,0 +1,55 @@
+function Uploader(url, cb) {
+ this.ws = new WebSocket(url);
+ if (cb) this.ws.onopen = cb;
+ this.sendQueue = [];
+ this.sending = null;
+ this.sendCallback = null;
+ this.ondone = null;
+ var self = this;
+ this.ws.onmessage = function(event) {
+ var data = JSON.parse(event.data);
+ if (data.event == 'complete') {
+ if (data.path != self.sending.path) {
+ self.sendQueue = [];
+ self.sending = null;
+ self.sendCallback = null;
+ throw new Error('Got message for wrong file!');
+ }
+ self.sending = null;
+ var callback = self.sendCallback;
+ self.sendCallback = null;
+ if (callback) callback();
+ if (self.sendQueue.length === 0 && self.ondone) self.ondone(null);
+ if (self.sendQueue.length > 0) {
+ var args = self.sendQueue.pop();
+ setTimeout(function() { self.sendFile.apply(self, args); }, 0);
+ }
+ }
+ else if (data.event == 'error') {
+ self.sendQueue = [];
+ self.sending = null;
+ var callback = self.sendCallback;
+ self.sendCallback = null;
+ var error = new Error('Server reported send error for file ' + data.path);
+ if (callback) callback(error);
+ if (self.ondone) self.ondone(error);
+ }
+ }
+}
+
+Uploader.prototype.sendFile = function(file, cb) {
+ if (this.ws.readyState != WebSocket.OPEN) throw new Error('Not connected');
+ if (this.sending) {
+ this.sendQueue.push(arguments);
+ return;
+ }
+ var fileData = { name: file.name, path: file.webkitRelativePath };
+ this.sending = fileData;
+ this.sendCallback = cb;
+ this.ws.send(JSON.stringify(fileData));
+ this.ws.send(file);
+}
+
+Uploader.prototype.close = function() {
+ this.ws.close();
+}
diff --git a/node_modules/ws/examples/fileapi/server.js b/node_modules/ws/examples/fileapi/server.js
new file mode 100644
index 0000000..badfeba
--- /dev/null
+++ b/node_modules/ws/examples/fileapi/server.js
@@ -0,0 +1,103 @@
+var WebSocketServer = require('../../').Server
+ , express = require('express')
+ , fs = require('fs')
+ , http = require('http')
+ , util = require('util')
+ , path = require('path')
+ , app = express.createServer()
+ , events = require('events')
+ , ansi = require('ansi')
+ , cursor = ansi(process.stdout);
+
+function BandwidthSampler(ws, interval) {
+ interval = interval || 2000;
+ var previousByteCount = 0;
+ var self = this;
+ var intervalId = setInterval(function() {
+ var byteCount = ws.bytesReceived;
+ var bytesPerSec = (byteCount - previousByteCount) / (interval / 1000);
+ previousByteCount = byteCount;
+ self.emit('sample', bytesPerSec);
+ }, interval);
+ ws.on('close', function() {
+ clearInterval(intervalId);
+ });
+}
+util.inherits(BandwidthSampler, events.EventEmitter);
+
+function makePathForFile(filePath, prefix, cb) {
+ if (typeof cb !== 'function') throw new Error('callback is required');
+ filePath = path.dirname(path.normalize(filePath)).replace(/^(\/|\\)+/, '');
+ var pieces = filePath.split(/(\\|\/)/);
+ var incrementalPath = prefix;
+ function step(error) {
+ if (error) return cb(error);
+ if (pieces.length == 0) return cb(null, incrementalPath);
+ incrementalPath += '/' + pieces.shift();
+ fs.exists(incrementalPath, function(exists) {
+ if (!exists) fs.mkdir(incrementalPath, step);
+ else process.nextTick(step);
+ });
+ }
+ step();
+}
+
+cursor.eraseData(2).goto(1, 1);
+app.use(express.static(__dirname + '/public'));
+
+var clientId = 0;
+var wss = new WebSocketServer({server: app});
+wss.on('connection', function(ws) {
+ var thisId = ++clientId;
+ cursor.goto(1, 4 + thisId).eraseLine();
+ console.log('Client #%d connected', thisId);
+
+ var sampler = new BandwidthSampler(ws);
+ sampler.on('sample', function(bps) {
+ cursor.goto(1, 4 + thisId).eraseLine();
+ console.log('WebSocket #%d incoming bandwidth: %d MB/s', thisId, Math.round(bps / (1024*1024)));
+ });
+
+ var filesReceived = 0;
+ var currentFile = null;
+ ws.on('message', function(data, flags) {
+ if (!flags.binary) {
+ currentFile = JSON.parse(data);
+ // note: a real-world app would want to sanity check the data
+ }
+ else {
+ if (currentFile == null) return;
+ makePathForFile(currentFile.path, __dirname + '/uploaded', function(error, path) {
+ if (error) {
+ console.log(error);
+ ws.send(JSON.stringify({event: 'error', path: currentFile.path, message: error.message}));
+ return;
+ }
+ fs.writeFile(path + '/' + currentFile.name, data, function(error) {
+ ++filesReceived;
+ // console.log('received %d bytes long file, %s', data.length, currentFile.path);
+ ws.send(JSON.stringify({event: 'complete', path: currentFile.path}));
+ currentFile = null;
+ });
+ });
+ }
+ });
+
+ ws.on('close', function() {
+ cursor.goto(1, 4 + thisId).eraseLine();
+ console.log('Client #%d disconnected. %d files received.', thisId, filesReceived);
+ });
+
+ ws.on('error', function(e) {
+ cursor.goto(1, 4 + thisId).eraseLine();
+ console.log('Client #%d error: %s', thisId, e.message);
+ });
+});
+
+fs.mkdir(__dirname + '/uploaded', function(error) {
+ // ignore errors, most likely means directory exists
+ console.log('Uploaded files will be saved to %s/uploaded.', __dirname);
+ console.log('Remember to wipe this directory if you upload lots and lots.');
+ app.listen(8080);
+ console.log('Listening on http://localhost:8080');
+});
diff --git a/node_modules/ws/examples/serverstats-express_3/package.json b/node_modules/ws/examples/serverstats-express_3/package.json
new file mode 100644
index 0000000..99722c4
--- /dev/null
+++ b/node_modules/ws/examples/serverstats-express_3/package.json
@@ -0,0 +1,17 @@
+{
+ "author": "",
+ "name": "serverstats",
+ "version": "0.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/ws.git"
+ },
+ "engines": {
+ "node": ">0.4.0"
+ },
+ "dependencies": {
+ "express": "~3.0.0"
+ },
+ "devDependencies": {},
+ "optionalDependencies": {}
+}
diff --git a/node_modules/ws/examples/serverstats-express_3/public/index.html b/node_modules/ws/examples/serverstats-express_3/public/index.html
new file mode 100644
index 0000000..24d84e1
--- /dev/null
+++ b/node_modules/ws/examples/serverstats-express_3/public/index.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ body {
+ font-family: Tahoma, Geneva, sans-serif;
+ }
+
+ div {
+ display: inline;
+ }
+ </style>
+ <script>
+ function updateStats(memuse) {
+ document.getElementById('rss').innerHTML = memuse.rss;
+ document.getElementById('heapTotal').innerHTML = memuse.heapTotal;
+ document.getElementById('heapUsed').innerHTML = memuse.heapUsed;
+ }
+
+ var host = window.document.location.host.replace(/:.*/, '');
+ var ws = new WebSocket('ws://' + host + ':8080');
+ ws.onmessage = function (event) {
+ updateStats(JSON.parse(event.data));
+ };
+ </script>
+ </head>
+ <body>
+ <strong>Server Stats</strong><br>
+ RSS: <div id='rss'></div><br>
+ Heap total: <div id='heapTotal'></div><br>
+ Heap used: <div id='heapUsed'></div><br>
+ </body>
+</html>
diff --git a/node_modules/ws/examples/serverstats-express_3/server.js b/node_modules/ws/examples/serverstats-express_3/server.js
new file mode 100644
index 0000000..88bbc9e
--- /dev/null
+++ b/node_modules/ws/examples/serverstats-express_3/server.js
@@ -0,0 +1,21 @@
+var WebSocketServer = require('../../').Server
+ , http = require('http')
+ , express = require('express')
+ , app = express();
+
+app.use(express.static(__dirname + '/public'));
+
+var server = http.createServer(app);
+server.listen(8080);
+
+var wss = new WebSocketServer({server: server});
+wss.on('connection', function(ws) {
+ var id = setInterval(function() {
+ ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ });
+ }, 100);
+ console.log('started client interval');
+ ws.on('close', function() {
+ console.log('stopping client interval');
+ clearInterval(id);
+ });
+});
diff --git a/node_modules/ws/examples/serverstats/package.json b/node_modules/ws/examples/serverstats/package.json
new file mode 100644
index 0000000..65c900a
--- /dev/null
+++ b/node_modules/ws/examples/serverstats/package.json
@@ -0,0 +1,17 @@
+{
+ "author": "",
+ "name": "serverstats",
+ "version": "0.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/ws.git"
+ },
+ "engines": {
+ "node": ">0.4.0"
+ },
+ "dependencies": {
+ "express": "2.x"
+ },
+ "devDependencies": {},
+ "optionalDependencies": {}
+}
diff --git a/node_modules/ws/examples/serverstats/public/index.html b/node_modules/ws/examples/serverstats/public/index.html
new file mode 100644
index 0000000..24d84e1
--- /dev/null
+++ b/node_modules/ws/examples/serverstats/public/index.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ body {
+ font-family: Tahoma, Geneva, sans-serif;
+ }
+
+ div {
+ display: inline;
+ }
+ </style>
+ <script>
+ function updateStats(memuse) {
+ document.getElementById('rss').innerHTML = memuse.rss;
+ document.getElementById('heapTotal').innerHTML = memuse.heapTotal;
+ document.getElementById('heapUsed').innerHTML = memuse.heapUsed;
+ }
+
+ var host = window.document.location.host.replace(/:.*/, '');
+ var ws = new WebSocket('ws://' + host + ':8080');
+ ws.onmessage = function (event) {
+ updateStats(JSON.parse(event.data));
+ };
+ </script>
+ </head>
+ <body>
+ <strong>Server Stats</strong><br>
+ RSS: <div id='rss'></div><br>
+ Heap total: <div id='heapTotal'></div><br>
+ Heap used: <div id='heapUsed'></div><br>
+ </body>
+</html>
diff --git a/node_modules/ws/examples/serverstats/server.js b/node_modules/ws/examples/serverstats/server.js
new file mode 100644
index 0000000..0bbce36
--- /dev/null
+++ b/node_modules/ws/examples/serverstats/server.js
@@ -0,0 +1,19 @@
+var WebSocketServer = require('../../').Server
+ , http = require('http')
+ , express = require('express')
+ , app = express.createServer();
+
+app.use(express.static(__dirname + '/public'));
+app.listen(8080);
+
+var wss = new WebSocketServer({server: app});
+wss.on('connection', function(ws) {
+ var id = setInterval(function() {
+ ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ });
+ }, 100);
+ console.log('started client interval');
+ ws.on('close', function() {
+ console.log('stopping client interval');
+ clearInterval(id);
+ })
+});
diff --git a/node_modules/ws/examples/ssl.js b/node_modules/ws/examples/ssl.js
new file mode 100644
index 0000000..bf1bf53
--- /dev/null
+++ b/node_modules/ws/examples/ssl.js
@@ -0,0 +1,59 @@
+
+(function(){
+
+ "use strict";
+
+ var fs = require('fs');
+
+ // you'll probably load configuration from config
+ var cfg = {
+ ssl: true,
+ port: 8080,
+ ssl_key: '/path/to/you/ssl.key',
+ ssl_cert: '/path/to/you/ssl.crt'
+ };
+
+ var httpServ = ( cfg.ssl ) ? require('https') : require('http');
+
+ var WebSocketServer = require('../').Server;
+
+ var app = null;
+
+ // dummy request processing
+ var processRequest = function( req, res ) {
+
+ res.writeHead(200);
+ res.end("All glory to WebSockets!\n");
+ };
+
+ if ( cfg.ssl ) {
+
+ app = httpServ.createServer({
+
+ // providing server with SSL key/cert
+ key: fs.readFileSync( cfg.ssl_key ),
+ cert: fs.readFileSync( cfg.ssl_cert )
+
+ }, processRequest ).listen( cfg.port );
+
+ } else {
+
+ app = httpServ.createServer( processRequest ).listen( cfg.port );
+ }
+
+ // passing or reference to web server so WS would knew port and SSL capabilities
+ var wss = new WebSocketServer( { server: app } );
+
+
+ wss.on( 'connection', function ( wsConnect ) {
+
+ wsConnect.on( 'message', function ( message ) {
+
+ console.log( message );
+
+ });
+
+ });
+
+
+}()); \ No newline at end of file
diff --git a/node_modules/ws/index.js b/node_modules/ws/index.js
new file mode 100644
index 0000000..3423ff2
--- /dev/null
+++ b/node_modules/ws/index.js
@@ -0,0 +1,26 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = require('./lib/WebSocket');
+module.exports.Server = require('./lib/WebSocketServer');
+module.exports.Sender = require('./lib/Sender');
+module.exports.Receiver = require('./lib/Receiver');
+
+module.exports.createServer = function (options, connectionListener) {
+ var server = new module.exports.Server(options);
+ if (typeof connectionListener === 'function') {
+ server.on('connection', connectionListener);
+ }
+ return server;
+};
+
+module.exports.connect = module.exports.createConnection = function (address, openListener) {
+ var client = new module.exports(address);
+ if (typeof openListener === 'function') {
+ client.on('open', openListener);
+ }
+ return client;
+};
diff --git a/node_modules/ws/lib/BufferPool.js b/node_modules/ws/lib/BufferPool.js
new file mode 100644
index 0000000..faf8637
--- /dev/null
+++ b/node_modules/ws/lib/BufferPool.js
@@ -0,0 +1,59 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+function BufferPool(initialSize, growStrategy, shrinkStrategy) {
+ if (typeof initialSize === 'function') {
+ shrinkStrategy = growStrategy;
+ growStrategy = initialSize;
+ initialSize = 0;
+ }
+ else if (typeof initialSize === 'undefined') {
+ initialSize = 0;
+ }
+ this._growStrategy = (growStrategy || function(db, size) {
+ return db.used + size;
+ }).bind(null, this);
+ this._shrinkStrategy = (shrinkStrategy || function(db) {
+ return initialSize;
+ }).bind(null, this);
+ this._buffer = initialSize ? new Buffer(initialSize) : null;
+ this._offset = 0;
+ this._used = 0;
+ this._changeFactor = 0;
+ this.__defineGetter__('size', function(){
+ return this._buffer == null ? 0 : this._buffer.length;
+ });
+ this.__defineGetter__('used', function(){
+ return this._used;
+ });
+}
+
+BufferPool.prototype.get = function(length) {
+ if (this._buffer == null || this._offset + length > this._buffer.length) {
+ var newBuf = new Buffer(this._growStrategy(length));
+ this._buffer = newBuf;
+ this._offset = 0;
+ }
+ this._used += length;
+ var buf = this._buffer.slice(this._offset, this._offset + length);
+ this._offset += length;
+ return buf;
+}
+
+BufferPool.prototype.reset = function(forceNewBuffer) {
+ var len = this._shrinkStrategy();
+ if (len < this.size) this._changeFactor -= 1;
+ if (forceNewBuffer || this._changeFactor < -2) {
+ this._changeFactor = 0;
+ this._buffer = len ? new Buffer(len) : null;
+ }
+ this._offset = 0;
+ this._used = 0;
+}
+
+module.exports = BufferPool;
diff --git a/node_modules/ws/lib/BufferUtil.fallback.js b/node_modules/ws/lib/BufferUtil.fallback.js
new file mode 100644
index 0000000..508542c
--- /dev/null
+++ b/node_modules/ws/lib/BufferUtil.fallback.js
@@ -0,0 +1,47 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports.BufferUtil = {
+ merge: function(mergedBuffer, buffers) {
+ var offset = 0;
+ for (var i = 0, l = buffers.length; i < l; ++i) {
+ var buf = buffers[i];
+ buf.copy(mergedBuffer, offset);
+ offset += buf.length;
+ }
+ },
+ mask: function(source, mask, output, offset, length) {
+ var maskNum = mask.readUInt32LE(0, true);
+ var i = 0;
+ for (; i < length - 3; i += 4) {
+ var num = maskNum ^ source.readUInt32LE(i, true);
+ if (num < 0) num = 4294967296 + num;
+ output.writeUInt32LE(num, offset + i, true);
+ }
+ switch (length % 4) {
+ case 3: output[offset + i + 2] = source[i + 2] ^ mask[2];
+ case 2: output[offset + i + 1] = source[i + 1] ^ mask[1];
+ case 1: output[offset + i] = source[i] ^ mask[0];
+ case 0:;
+ }
+ },
+ unmask: function(data, mask) {
+ var maskNum = mask.readUInt32LE(0, true);
+ var length = data.length;
+ var i = 0;
+ for (; i < length - 3; i += 4) {
+ var num = maskNum ^ data.readUInt32LE(i, true);
+ if (num < 0) num = 4294967296 + num;
+ data.writeUInt32LE(num, i, true);
+ }
+ switch (length % 4) {
+ case 3: data[i + 2] = data[i + 2] ^ mask[2];
+ case 2: data[i + 1] = data[i + 1] ^ mask[1];
+ case 1: data[i] = data[i] ^ mask[0];
+ case 0:;
+ }
+ }
+}
diff --git a/node_modules/ws/lib/BufferUtil.js b/node_modules/ws/lib/BufferUtil.js
new file mode 100644
index 0000000..15d35b9
--- /dev/null
+++ b/node_modules/ws/lib/BufferUtil.js
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+ module.exports = require('../build/Release/bufferutil');
+} catch (e) { try {
+ module.exports = require('../build/default/bufferutil');
+} catch (e) { try {
+ module.exports = require('./BufferUtil.fallback');
+} catch (e) {
+ console.error('bufferutil.node seems to not have been built. Run npm install.');
+ throw e;
+}}}
diff --git a/node_modules/ws/lib/ErrorCodes.js b/node_modules/ws/lib/ErrorCodes.js
new file mode 100644
index 0000000..55ebd52
--- /dev/null
+++ b/node_modules/ws/lib/ErrorCodes.js
@@ -0,0 +1,24 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = {
+ isValidErrorCode: function(code) {
+ return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) ||
+ (code >= 3000 && code <= 4999);
+ },
+ 1000: 'normal',
+ 1001: 'going away',
+ 1002: 'protocol error',
+ 1003: 'unsupported data',
+ 1004: 'reserved',
+ 1005: 'reserved for extensions',
+ 1006: 'reserved for extensions',
+ 1007: 'inconsistent or invalid data',
+ 1008: 'policy violation',
+ 1009: 'message too big',
+ 1010: 'extension handshake missing',
+ 1011: 'an unexpected condition prevented the request from being fulfilled',
+}; \ No newline at end of file
diff --git a/node_modules/ws/lib/Receiver.hixie.js b/node_modules/ws/lib/Receiver.hixie.js
new file mode 100644
index 0000000..f54ad96
--- /dev/null
+++ b/node_modules/ws/lib/Receiver.hixie.js
@@ -0,0 +1,180 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+/**
+ * State constants
+ */
+
+var EMPTY = 0
+ , BODY = 1;
+var BINARYLENGTH = 2
+ , BINARYBODY = 3;
+
+/**
+ * Hixie Receiver implementation
+ */
+
+function Receiver () {
+ this.state = EMPTY;
+ this.buffers = [];
+ this.messageEnd = -1;
+ this.spanLength = 0;
+ this.dead = false;
+
+ this.onerror = function() {};
+ this.ontext = function() {};
+ this.onbinary = function() {};
+ this.onclose = function() {};
+ this.onping = function() {};
+ this.onpong = function() {};
+}
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+ var self = this;
+ function doAdd() {
+ if (self.state === EMPTY) {
+ if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) {
+ self.reset();
+ self.onclose();
+ return;
+ }
+ if (data[0] === 0x80) {
+ self.messageEnd = 0;
+ self.state = BINARYLENGTH;
+ data = data.slice(1);
+ } else {
+
+ if (data[0] !== 0x00) {
+ self.error('payload must start with 0x00 byte', true);
+ return;
+ }
+ data = data.slice(1);
+ self.state = BODY;
+
+ }
+ }
+ if (self.state === BINARYLENGTH) {
+ var i = 0;
+ while ((i < data.length) && (data[i] & 0x80)) {
+ self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+ ++i;
+ }
+ if (i < data.length) {
+ self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+ self.state = BINARYBODY;
+ ++i;
+ }
+ if (i > 0)
+ data = data.slice(i);
+ }
+ if (self.state === BINARYBODY) {
+ var dataleft = self.messageEnd - self.spanLength;
+ if (data.length >= dataleft) {
+ // consume the whole buffer to finish the frame
+ self.buffers.push(data);
+ self.spanLength += dataleft;
+ self.messageEnd = dataleft;
+ return self.parse();
+ }
+ // frame's not done even if we consume it all
+ self.buffers.push(data);
+ self.spanLength += data.length;
+ return;
+ }
+ self.buffers.push(data);
+ if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) {
+ self.spanLength += self.messageEnd;
+ return self.parse();
+ }
+ else self.spanLength += data.length;
+ }
+ while(data) data = doAdd();
+}
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+ this.dead = true;
+ this.state = EMPTY;
+ this.buffers = [];
+}
+
+/**
+ * Process buffered data.
+ *
+ * @api public
+ */
+
+Receiver.prototype.parse = function() {
+ var output = new Buffer(this.spanLength);
+ var outputIndex = 0;
+ for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) {
+ var buffer = this.buffers[bi];
+ buffer.copy(output, outputIndex);
+ outputIndex += buffer.length;
+ }
+ var lastBuffer = this.buffers[this.buffers.length - 1];
+ if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd);
+ if (this.state !== BODY) --this.messageEnd;
+ var tail = null;
+ if (this.messageEnd < lastBuffer.length - 1) {
+ tail = lastBuffer.slice(this.messageEnd + 1);
+ }
+ this.reset();
+ this.ontext(output.toString('utf8'));
+ return tail;
+}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, terminate) {
+ this.reset();
+ this.onerror(reason, terminate);
+ return this;
+}
+
+/**
+ * Reset parser state
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function (reason) {
+ if (this.dead) return;
+ this.state = EMPTY;
+ this.buffers = [];
+ this.messageEnd = -1;
+ this.spanLength = 0;
+}
+
+/**
+ * Internal api
+ */
+
+function bufferIndex(buffer, byte) {
+ for (var i = 0, l = buffer.length; i < l; ++i) {
+ if (buffer[i] === byte) return i;
+ }
+ return -1;
+}
diff --git a/node_modules/ws/lib/Receiver.js b/node_modules/ws/lib/Receiver.js
new file mode 100644
index 0000000..2752726
--- /dev/null
+++ b/node_modules/ws/lib/Receiver.js
@@ -0,0 +1,591 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , Validation = require('./Validation').Validation
+ , ErrorCodes = require('./ErrorCodes')
+ , BufferPool = require('./BufferPool')
+ , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * Node version 0.4 and 0.6 compatibility
+ */
+
+var isNodeV4 = /^v0\.4/.test(process.version);
+
+/**
+ * HyBi Receiver implementation
+ */
+
+function Receiver () {
+ // memory pool for fragmented messages
+ var fragmentedPoolPrevUsed = -1;
+ this.fragmentedBufferPool = new BufferPool(1024, function(db, length) {
+ return db.used + length;
+ }, function(db) {
+ return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ?
+ (fragmentedPoolPrevUsed + db.used) / 2 :
+ db.used;
+ });
+
+ // memory pool for unfragmented messages
+ var unfragmentedPoolPrevUsed = -1;
+ this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) {
+ return db.used + length;
+ }, function(db) {
+ return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ?
+ (unfragmentedPoolPrevUsed + db.used) / 2 :
+ db.used;
+ });
+
+ this.state = {
+ activeFragmentedOperation: null,
+ lastFragment: false,
+ masked: false,
+ opcode: 0,
+ fragmentedOperation: false
+ };
+ this.overflow = [];
+ this.headerBuffer = new Buffer(10);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.currentMessage = [];
+ this.expectHeader(2, this.processPacket);
+ this.dead = false;
+
+ this.onerror = function() {};
+ this.ontext = function() {};
+ this.onbinary = function() {};
+ this.onclose = function() {};
+ this.onping = function() {};
+ this.onpong = function() {};
+};
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+ var dataLength = data.length;
+ if (dataLength == 0) return;
+ if (this.expectBuffer == null) {
+ this.overflow.push(data);
+ return;
+ }
+ var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset);
+ fastCopy(toRead, data, this.expectBuffer, this.expectOffset);
+ this.expectOffset += toRead;
+ if (toRead < dataLength) {
+ this.overflow.push(data.slice(toRead));
+ }
+ while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) {
+ var bufferForHandler = this.expectBuffer;
+ this.expectBuffer = null;
+ this.expectOffset = 0;
+ this.expectHandler.call(this, bufferForHandler);
+ }
+}
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+ this.dead = true;
+ this.overflow = null;
+ this.headerBuffer = null;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.unfragmentedBufferPool = null;
+ this.fragmentedBufferPool = null;
+ this.state = null;
+ this.currentMessage = null;
+ this.onerror = null;
+ this.ontext = null;
+ this.onbinary = null;
+ this.onclose = null;
+ this.onping = null;
+ this.onpong = null;
+}
+
+/**
+ * Waits for a certain amount of header bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectHeader = function(length, handler) {
+ if (length == 0) {
+ handler(null);
+ return;
+ }
+ this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length);
+ this.expectHandler = handler;
+ var toRead = length;
+ while (toRead > 0 && this.overflow.length > 0) {
+ var fromOverflow = this.overflow.pop();
+ if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+ var read = Math.min(fromOverflow.length, toRead);
+ fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+ this.expectOffset += read;
+ toRead -= read;
+ }
+}
+
+/**
+ * Waits for a certain amount of data bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectData = function(length, handler) {
+ if (length == 0) {
+ handler(null);
+ return;
+ }
+ this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation);
+ this.expectHandler = handler;
+ var toRead = length;
+ while (toRead > 0 && this.overflow.length > 0) {
+ var fromOverflow = this.overflow.pop();
+ if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+ var read = Math.min(fromOverflow.length, toRead);
+ fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+ this.expectOffset += read;
+ toRead -= read;
+ }
+}
+
+/**
+ * Allocates memory from the buffer pool.
+ *
+ * @api private
+ */
+
+Receiver.prototype.allocateFromPool = !isNodeV4
+ ? function(length, isFragmented) { return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); }
+ : function(length) { return new Buffer(length); };
+
+/**
+ * Start processing a new packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.processPacket = function (data) {
+ if ((data[0] & 0x70) != 0) {
+ this.error('reserved fields must be empty', 1002);
+ return;
+ }
+ this.state.lastFragment = (data[0] & 0x80) == 0x80;
+ this.state.masked = (data[1] & 0x80) == 0x80;
+ var opcode = data[0] & 0xf;
+ if (opcode === 0) {
+ // continuation frame
+ this.state.fragmentedOperation = true;
+ this.state.opcode = this.state.activeFragmentedOperation;
+ if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
+ this.error('continuation frame cannot follow current opcode', 1002);
+ return;
+ }
+ }
+ else {
+ if (opcode < 3 && this.state.activeFragmentedOperation != null) {
+ this.error('data frames after the initial data frame must have opcode 0', 1002);
+ return;
+ }
+ this.state.opcode = opcode;
+ if (this.state.lastFragment === false) {
+ this.state.fragmentedOperation = true;
+ this.state.activeFragmentedOperation = opcode;
+ }
+ else this.state.fragmentedOperation = false;
+ }
+ var handler = opcodes[this.state.opcode];
+ if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002);
+ else {
+ handler.start.call(this, data);
+ }
+}
+
+/**
+ * Endprocessing a packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.endPacket = function() {
+ if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true);
+ else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) {
+ // end current fragmented operation
+ this.state.activeFragmentedOperation = null;
+ }
+ this.state.lastFragment = false;
+ this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
+ this.state.masked = false;
+ this.expectHeader(2, this.processPacket);
+}
+
+/**
+ * Reset the parser state.
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function() {
+ if (this.dead) return;
+ this.state = {
+ activeFragmentedOperation: null,
+ lastFragment: false,
+ masked: false,
+ opcode: 0,
+ fragmentedOperation: false
+ };
+ this.fragmentedBufferPool.reset(true);
+ this.unfragmentedBufferPool.reset(true);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.overflow = [];
+ this.currentMessage = [];
+}
+
+/**
+ * Unmask received data.
+ *
+ * @api private
+ */
+
+Receiver.prototype.unmask = function (mask, buf, binary) {
+ if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
+ if (binary) return buf;
+ return buf != null ? buf.toString('utf8') : '';
+}
+
+/**
+ * Concatenates a list of buffers.
+ *
+ * @api private
+ */
+
+Receiver.prototype.concatBuffers = function(buffers) {
+ var length = 0;
+ for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length;
+ var mergedBuffer = new Buffer(length);
+ bufferUtil.merge(mergedBuffer, buffers);
+ return mergedBuffer;
+}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, protocolErrorCode) {
+ this.reset();
+ this.onerror(reason, protocolErrorCode);
+ return this;
+}
+
+/**
+ * Buffer utilities
+ */
+
+function readUInt16BE(start) {
+ return (this[start]<<8) +
+ this[start+1];
+}
+
+function readUInt32BE(start) {
+ return (this[start]<<24) +
+ (this[start+1]<<16) +
+ (this[start+2]<<8) +
+ this[start+3];
+}
+
+function fastCopy(length, srcBuffer, dstBuffer, dstOffset) {
+ switch (length) {
+ default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
+ case 16: dstBuffer[dstOffset+15] = srcBuffer[15];
+ case 15: dstBuffer[dstOffset+14] = srcBuffer[14];
+ case 14: dstBuffer[dstOffset+13] = srcBuffer[13];
+ case 13: dstBuffer[dstOffset+12] = srcBuffer[12];
+ case 12: dstBuffer[dstOffset+11] = srcBuffer[11];
+ case 11: dstBuffer[dstOffset+10] = srcBuffer[10];
+ case 10: dstBuffer[dstOffset+9] = srcBuffer[9];
+ case 9: dstBuffer[dstOffset+8] = srcBuffer[8];
+ case 8: dstBuffer[dstOffset+7] = srcBuffer[7];
+ case 7: dstBuffer[dstOffset+6] = srcBuffer[6];
+ case 6: dstBuffer[dstOffset+5] = srcBuffer[5];
+ case 5: dstBuffer[dstOffset+4] = srcBuffer[4];
+ case 4: dstBuffer[dstOffset+3] = srcBuffer[3];
+ case 3: dstBuffer[dstOffset+2] = srcBuffer[2];
+ case 2: dstBuffer[dstOffset+1] = srcBuffer[1];
+ case 1: dstBuffer[dstOffset] = srcBuffer[0];
+ }
+}
+
+/**
+ * Opcode handlers
+ */
+
+var opcodes = {
+ // text
+ '1': {
+ start: function(data) {
+ var self = this;
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['1'].getData.call(self, firstLength);
+ }
+ else if (firstLength == 126) {
+ self.expectHeader(2, function(data) {
+ opcodes['1'].getData.call(self, readUInt16BE.call(data, 0));
+ });
+ }
+ else if (firstLength == 127) {
+ self.expectHeader(8, function(data) {
+ if (readUInt32BE.call(data, 0) != 0) {
+ self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+ return;
+ }
+ opcodes['1'].getData.call(self, readUInt32BE.call(data, 4));
+ });
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['1'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['1'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var packet = this.unmask(mask, data, true);
+ if (packet != null) this.currentMessage.push(packet);
+ if (this.state.lastFragment) {
+ var messageBuffer = this.concatBuffers(this.currentMessage);
+ if (!Validation.isValidUTF8(messageBuffer)) {
+ this.error('invalid utf8 sequence', 1007);
+ return;
+ }
+ this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer});
+ this.currentMessage = [];
+ }
+ this.endPacket();
+ }
+ },
+ // binary
+ '2': {
+ start: function(data) {
+ var self = this;
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['2'].getData.call(self, firstLength);
+ }
+ else if (firstLength == 126) {
+ self.expectHeader(2, function(data) {
+ opcodes['2'].getData.call(self, readUInt16BE.call(data, 0));
+ });
+ }
+ else if (firstLength == 127) {
+ self.expectHeader(8, function(data) {
+ if (readUInt32BE.call(data, 0) != 0) {
+ self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+ return;
+ }
+ opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true));
+ });
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['2'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['2'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var packet = this.unmask(mask, data, true);
+ if (packet != null) this.currentMessage.push(packet);
+ if (this.state.lastFragment) {
+ var messageBuffer = this.concatBuffers(this.currentMessage);
+ this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer});
+ this.currentMessage = [];
+ }
+ this.endPacket();
+ }
+ },
+ // close
+ '8': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented close is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['8'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['8'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['8'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var self = this;
+ data = self.unmask(mask, data, true);
+ if (data && data.length == 1) {
+ self.error('close packets with data must be at least two bytes long', 1002);
+ return;
+ }
+ var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000;
+ if (!ErrorCodes.isValidErrorCode(code)) {
+ self.error('invalid error code', 1002);
+ return;
+ }
+ var message = '';
+ if (data && data.length > 2) {
+ var messageBuffer = data.slice(2);
+ if (!Validation.isValidUTF8(messageBuffer)) {
+ self.error('invalid utf8 sequence', 1007);
+ return;
+ }
+ message = messageBuffer.toString('utf8');
+ }
+ this.onclose(code, message, {masked: self.state.masked});
+ this.reset();
+ },
+ },
+ // ping
+ '9': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented ping is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['9'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['9'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['9'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+ this.endPacket();
+ }
+ },
+ // pong
+ '10': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented pong is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['10'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (this.state.masked) {
+ this.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['10'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ this.expectData(length, function(data) {
+ opcodes['10'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+ this.endPacket();
+ }
+ }
+}
diff --git a/node_modules/ws/lib/Sender.hixie.js b/node_modules/ws/lib/Sender.hixie.js
new file mode 100644
index 0000000..1754afb
--- /dev/null
+++ b/node_modules/ws/lib/Sender.hixie.js
@@ -0,0 +1,123 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+ , util = require('util')
+ , EventEmitter = events.EventEmitter;
+
+/**
+ * Hixie Sender implementation
+ */
+
+function Sender(socket) {
+ this.socket = socket;
+ this.continuationFrame = false;
+ this.isClosed = false;
+}
+
+module.exports = Sender;
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Frames and writes data.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+ if (this.isClosed) return;
+/*
+ if (options && options.binary) {
+ this.error('hixie websockets do not support binary');
+ return;
+ }
+*/
+ var isString = typeof data == 'string'
+ , length = isString ? Buffer.byteLength(data) : data.length
+ , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes
+ , writeStartMarker = this.continuationFrame == false
+ , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin)
+ , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0))
+ , offset = writeStartMarker ? 1 : 0;
+
+ if (writeStartMarker) {
+ if (options && options.binary) {
+ buffer.write('\x80', 'binary');
+ // assume length less than 2**14 bytes
+ if (lengthbytes > 1)
+ buffer.write(String.fromCharCode(128+length/128), offset++, 'binary');
+ buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary');
+ } else
+ buffer.write('\x00', 'binary');
+ }
+
+ if (isString) buffer.write(data, offset, 'utf8');
+ else data.copy(buffer, offset, 0);
+
+ if (writeEndMarker) {
+ if (options && options.binary) {
+ // sending binary, not writing end marker
+ } else
+ buffer.write('\xff', offset + length, 'binary');
+ this.continuationFrame = false;
+ }
+ else this.continuationFrame = true;
+
+ try {
+ this.socket.write(buffer, 'binary', cb);
+ } catch (e) {
+ this.error(e.toString());
+ }
+}
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask, cb) {
+ if (this.isClosed) return;
+ this.isClosed = true;
+ try {
+ if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary'));
+ this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb);
+ } catch (e) {
+ this.error(e.toString());
+ }
+}
+
+/**
+ * Sends a ping message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {}
+
+/**
+ * Sends a pong message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Sender.prototype.error = function (reason) {
+ this.emit('error', reason);
+ return this;
+}
diff --git a/node_modules/ws/lib/Sender.js b/node_modules/ws/lib/Sender.js
new file mode 100644
index 0000000..db109be
--- /dev/null
+++ b/node_modules/ws/lib/Sender.js
@@ -0,0 +1,226 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+ , util = require('util')
+ , EventEmitter = events.EventEmitter
+ , ErrorCodes = require('./ErrorCodes')
+ , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * HyBi Sender implementation
+ */
+
+function Sender(socket) {
+ this._socket = socket;
+ this.firstFragment = true;
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask) {
+ if (typeof code !== 'undefined') {
+ if (typeof code !== 'number' ||
+ !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number');
+ }
+ code = code || 1000;
+ var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0));
+ writeUInt16BE.call(dataBuffer, code, 0);
+ if (dataBuffer.length > 2) dataBuffer.write(data, 2);
+ this.frameAndSend(0x8, dataBuffer, true, mask);
+}
+
+/**
+ * Sends a ping message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {
+ var mask = options && options.mask;
+ this.frameAndSend(0x9, data || '', true, mask);
+}
+
+/**
+ * Sends a pong message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {
+ var mask = options && options.mask;
+ this.frameAndSend(0xa, data || '', true, mask);
+}
+
+/**
+ * Sends text or binary data to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+ var finalFragment = options && options.fin === false ? false : true;
+ var mask = options && options.mask;
+ var opcode = options && options.binary ? 2 : 1;
+ if (this.firstFragment === false) opcode = 0;
+ else this.firstFragment = false;
+ if (finalFragment) this.firstFragment = true
+ this.frameAndSend(opcode, data, finalFragment, mask, cb);
+}
+
+/**
+ * Frames and sends a piece of data according to the HyBi WebSocket protocol.
+ *
+ * @api private
+ */
+
+Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) {
+ var canModifyData = false;
+
+ if (!data) {
+ try {
+ this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ return;
+ }
+
+ if (!Buffer.isBuffer(data)) {
+ canModifyData = true;
+ if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) {
+ data = getArrayBuffer(data);
+ } else {
+ data = new Buffer(data);
+ }
+ }
+
+ var dataLength = data.length
+ , dataOffset = maskData ? 6 : 2
+ , secondByte = dataLength;
+
+ if (dataLength >= 65536) {
+ dataOffset += 8;
+ secondByte = 127;
+ }
+ else if (dataLength > 125) {
+ dataOffset += 2;
+ secondByte = 126;
+ }
+
+ var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData);
+ var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset;
+ var outputBuffer = new Buffer(totalLength);
+ outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode;
+
+ switch (secondByte) {
+ case 126:
+ writeUInt16BE.call(outputBuffer, dataLength, 2);
+ break;
+ case 127:
+ writeUInt32BE.call(outputBuffer, 0, 2);
+ writeUInt32BE.call(outputBuffer, dataLength, 6);
+ }
+
+ if (maskData) {
+ outputBuffer[1] = secondByte | 0x80;
+ var mask = this._randomMask || (this._randomMask = getRandomMask());
+ outputBuffer[dataOffset - 4] = mask[0];
+ outputBuffer[dataOffset - 3] = mask[1];
+ outputBuffer[dataOffset - 2] = mask[2];
+ outputBuffer[dataOffset - 1] = mask[3];
+ if (mergeBuffers) {
+ bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength);
+ try {
+ this._socket.write(outputBuffer, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ else {
+ bufferUtil.mask(data, mask, data, 0, dataLength);
+ try {
+ this._socket.write(outputBuffer, 'binary');
+ this._socket.write(data, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ }
+ else {
+ outputBuffer[1] = secondByte;
+ if (mergeBuffers) {
+ data.copy(outputBuffer, dataOffset);
+ try {
+ this._socket.write(outputBuffer, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ else {
+ try {
+ this._socket.write(outputBuffer, 'binary');
+ this._socket.write(data, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ }
+}
+
+module.exports = Sender;
+
+function writeUInt16BE(value, offset) {
+ this[offset] = (value & 0xff00)>>8;
+ this[offset+1] = value & 0xff;
+}
+
+function writeUInt32BE(value, offset) {
+ this[offset] = (value & 0xff000000)>>24;
+ this[offset+1] = (value & 0xff0000)>>16;
+ this[offset+2] = (value & 0xff00)>>8;
+ this[offset+3] = value & 0xff;
+}
+
+function getArrayBuffer(data) {
+ // data is either an ArrayBuffer or ArrayBufferView.
+ var array = data.buffer || data
+ , l = data.byteLength || data.length
+ , buffer = new Buffer(l);
+ for (var i = 0; i < l; ++i) {
+ buffer[i] = array[i];
+ }
+ return buffer;
+}
+
+function getRandomMask() {
+ return new Buffer([
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255)
+ ]);
+}
diff --git a/node_modules/ws/lib/Validation.fallback.js b/node_modules/ws/lib/Validation.fallback.js
new file mode 100644
index 0000000..2c7c4fd
--- /dev/null
+++ b/node_modules/ws/lib/Validation.fallback.js
@@ -0,0 +1,12 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports.Validation = {
+ isValidUTF8: function(buffer) {
+ return true;
+ }
+};
+
diff --git a/node_modules/ws/lib/Validation.js b/node_modules/ws/lib/Validation.js
new file mode 100644
index 0000000..0f3109a
--- /dev/null
+++ b/node_modules/ws/lib/Validation.js
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+ module.exports = require('../build/Release/validation');
+} catch (e) { try {
+ module.exports = require('../build/default/validation');
+} catch (e) { try {
+ module.exports = require('./Validation.fallback');
+} catch (e) {
+ console.error('validation.node seems to not have been built. Run npm install.');
+ throw e;
+}}}
diff --git a/node_modules/ws/lib/WebSocket.js b/node_modules/ws/lib/WebSocket.js
new file mode 100644
index 0000000..5f40658
--- /dev/null
+++ b/node_modules/ws/lib/WebSocket.js
@@ -0,0 +1,766 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , events = require('events')
+ , http = require('http')
+ , https = require('https')
+ , crypto = require('crypto')
+ , url = require('url')
+ , fs = require('fs')
+ , Options = require('options')
+ , Sender = require('./Sender')
+ , Receiver = require('./Receiver')
+ , SenderHixie = require('./Sender.hixie')
+ , ReceiverHixie = require('./Receiver.hixie');
+
+/**
+ * Constants
+ */
+
+// Default protocol version
+
+var protocolVersion = 13;
+
+// Close timeout
+
+var closeTimeout = 30000; // Allow 5 seconds to terminate the connection cleanly
+
+/**
+ * Node version 0.4 and 0.6 compatibility
+ */
+
+var isNodeV4 = /^v0\.4/.test(process.version);
+
+/**
+ * WebSocket implementation
+ */
+
+function WebSocket(address, options) {
+ var self = this;
+
+ this._socket = null;
+ this.bytesReceived = 0;
+ this.readyState = null;
+ this.supports = {};
+
+ if (Object.prototype.toString.call(address) == '[object Array]') {
+ initAsServerClient.apply(this, address.concat(options));
+ }
+ else initAsClient.apply(this, arguments);
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocket, events.EventEmitter);
+
+/**
+ * Ready States
+ */
+
+["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function (state, index) {
+ WebSocket.prototype[state] = WebSocket[state] = index;
+});
+
+/**
+ * Gracefully closes the connection, after sending a description message to the server
+ *
+ * @param {Object} data to be sent to the server
+ * @api public
+ */
+
+WebSocket.prototype.close = function(code, data) {
+ if (this.readyState == WebSocket.CLOSING || this.readyState == WebSocket.CLOSED) return;
+ if (this.readyState == WebSocket.CONNECTING) {
+ this.readyState = WebSocket.CLOSED;
+ return;
+ }
+ try {
+ this.readyState = WebSocket.CLOSING;
+ this._closeCode = code;
+ this._closeMessage = data;
+ var mask = !this._isServer;
+ this._sender.close(code, data, mask);
+ }
+ catch (e) {
+ this.emit('error', e);
+ }
+ finally {
+ this.terminate();
+ }
+}
+
+/**
+ * Pause the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.pause = function() {
+ if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+ return this._socket.pause();
+}
+
+/**
+ * Sends a ping
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) {
+ if (this.readyState != WebSocket.OPEN) {
+ if (dontFailWhenClosed === true) return;
+ throw new Error('not opened');
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ this._sender.ping(data, options);
+}
+
+/**
+ * Sends a pong
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) {
+ if (this.readyState != WebSocket.OPEN) {
+ if (dontFailWhenClosed === true) return;
+ throw new Error('not opened');
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ this._sender.pong(data, options);
+}
+
+/**
+ * Resume the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.resume = function() {
+ if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+ return this._socket.resume();
+}
+
+/**
+ * Sends a piece of data
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} Optional callback which is executed after the send completes
+ * @api public
+ */
+
+WebSocket.prototype.send = function(data, options, cb) {
+ if (typeof options == 'function') {
+ cb = options;
+ options = {};
+ }
+ if (this.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else throw new Error('not opened');
+ return;
+ }
+ if (!data) data = '';
+ if (this._queue) {
+ var self = this;
+ this._queue.push(function() { self.send(data, options, cb); });
+ return;
+ }
+ options = options || {};
+ options.fin = true;
+ if (typeof options.binary == 'undefined') {
+ options.binary = (data instanceof ArrayBuffer || data instanceof Buffer);
+ }
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ if (data instanceof fs.ReadStream) {
+ startQueue(this);
+ var self = this;
+ sendStream(this, data, options, function(error) {
+ process.nextTick(function() { executeQueueSends(self); });
+ if (typeof cb == 'function') cb(error);
+ });
+ }
+ else this._sender.send(data, options, cb);
+}
+
+/**
+ * Streams data through calls to a user supplied function
+ *
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'.
+ * @api public
+ */
+
+WebSocket.prototype.stream = function(options, cb) {
+ if (typeof options == 'function') {
+ cb = options;
+ options = {};
+ }
+ if (typeof cb != 'function') throw new Error('callback must be provided');
+ if (this.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else throw new Error('not opened');
+ return;
+ }
+ if (this._queue) {
+ var self = this;
+ this._queue.push(function() { self.stream(options, cb); });
+ return;
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ startQueue(this);
+ var self = this;
+ var send = function(data, final) {
+ try {
+ if (self.readyState != WebSocket.OPEN) throw new Error('not opened');
+ options.fin = final === true;
+ self._sender.send(data, options);
+ if (!final) process.nextTick(cb.bind(null, null, send));
+ else executeQueueSends(self);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else {
+ delete self._queue;
+ self.emit('error', e);
+ }
+ }
+ }
+ process.nextTick(cb.bind(null, null, send));
+}
+
+/**
+ * Immediately shuts down the connection
+ *
+ * @api public
+ */
+
+WebSocket.prototype.terminate = function() {
+ if (this.readyState == WebSocket.CLOSED) return;
+ if (this._socket) {
+ try {
+ // End the connection
+ this._socket.end();
+ }
+ catch (e) {
+ // Socket error during end() call, so just destroy it right now
+ cleanupWebsocketResources.call(this, true);
+ return;
+ }
+
+ // Add a timeout to ensure that the connection is completely
+ // cleaned up within 30 seconds, even if the clean close procedure
+ // fails for whatever reason
+ this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout);
+ }
+ else if (this.readyState == WebSocket.CONNECTING) {
+ cleanupWebsocketResources.call(this, true);
+ }
+};
+
+/**
+ * Expose bufferedAmount
+ *
+ * @api public
+ */
+
+Object.defineProperty(WebSocket.prototype, 'bufferedAmount', {
+ get: function get() {
+ return this._socket ? this._socket.bufferSize : 0;
+ }
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using function members.
+ *
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+
+['open', 'error', 'close', 'message'].forEach(function(method) {
+ Object.defineProperty(WebSocket.prototype, 'on' + method, {
+ /**
+ * Returns the current listener
+ *
+ * @returns {Mixed} the set function or undefined
+ * @api public
+ */
+
+ get: function get() {
+ var listener = this.listeners(method)[0];
+ return listener ? (listener._listener ? listener._listener : listener) : undefined;
+ },
+
+ /**
+ * Start listening for events
+ *
+ * @param {Function} listener the listener
+ * @returns {Mixed} the set function or undefined
+ * @api public
+ */
+
+ set: function set(listener) {
+ this.removeAllListeners(method);
+ this.addEventListener(method, listener);
+ }
+ });
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using addEventListener.
+ *
+ * @see https://developer.mozilla.org/en/DOM/element.addEventListener
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+WebSocket.prototype.addEventListener = function(method, listener) {
+ var target = this;
+ if (typeof listener === 'function') {
+ if (method === 'message') {
+ function onMessage (data, flags) {
+ listener.call(this, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onMessage._listener = listener;
+ this.on(method, onMessage);
+ } else if (method === 'close') {
+ function onClose (code, message) {
+ listener.call(this, new CloseEvent(code, message, target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onClose._listener = listener;
+ this.on(method, onClose);
+ } else if (method === 'error') {
+ function onError (event) {
+ event.target = target;
+ listener.call(this, event);
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onError._listener = listener;
+ this.on(method, onError);
+ } else if (method === 'open') {
+ function onOpen () {
+ listener.call(this, new OpenEvent(target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onOpen._listener = listener;
+ this.on(method, onOpen);
+ } else {
+ this.on(method, listener);
+ }
+ }
+}
+
+module.exports = WebSocket;
+
+/**
+ * W3C MessageEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function MessageEvent(dataArg, typeArg, target) {
+ this.data = dataArg;
+ this.type = typeArg;
+ this.target = target;
+}
+
+/**
+ * W3C CloseEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function CloseEvent(code, reason, target) {
+ this.wasClean = (typeof code == 'undefined' || code == 1000);
+ this.code = code;
+ this.reason = reason;
+ this.target = target;
+}
+
+/**
+ * W3C OpenEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function OpenEvent(target) {
+ this.target = target;
+}
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function initAsServerClient(req, socket, upgradeHead, options) {
+ options = new Options({
+ protocolVersion: protocolVersion,
+ protocol: null
+ }).merge(options);
+
+ // expose state properties
+ this.protocol = options.value.protocol;
+ this.protocolVersion = options.value.protocolVersion;
+ this.supports.binary = (this.protocolVersion != 'hixie-76');
+ this.upgradeReq = req;
+ this.readyState = WebSocket.CONNECTING;
+ this._isServer = true;
+
+ // establish connection
+ if (options.value.protocolVersion == 'hixie-76') establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead);
+ else establishConnection.call(this, Receiver, Sender, socket, upgradeHead);
+}
+
+function initAsClient(address, options) {
+ options = new Options({
+ origin: null,
+ protocolVersion: protocolVersion,
+ host: null,
+ protocol: null,
+
+ // ssl-related options
+ pfx: null,
+ key: null,
+ passphrase: null,
+ cert: null,
+ ca: null,
+ ciphers: null,
+ rejectUnauthorized: null
+ }).merge(options);
+ if (options.value.protocolVersion != 8 && options.value.protocolVersion != 13) {
+ throw new Error('unsupported protocol version');
+ }
+
+ // verify url and establish http class
+ var serverUrl = url.parse(address);
+ var isUnixSocket = serverUrl.protocol === 'ws+unix:';
+ if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url');
+ var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:';
+ var httpObj = isSecure ? https : http;
+ var port = serverUrl.port || (isSecure ? 443 : 80);
+
+ // expose state properties
+ this._isServer = false;
+ this.url = address;
+ this.protocolVersion = options.value.protocolVersion;
+ this.supports.binary = (this.protocolVersion != 'hixie-76');
+
+ // begin handshake
+ var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64');
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11');
+ var expectedServerKey = shasum.digest('base64');
+
+ // node<=v0.4.x compatibility
+ var agent;
+ if (isNodeV4) {
+ isNodeV4 = true;
+ agent = new httpObj.Agent({
+ host: serverUrl.hostname,
+ port: port
+ });
+ }
+
+ var headerHost = serverUrl.hostname + ':' + port;
+ var requestOptions = {
+ port: port,
+ host: serverUrl.hostname,
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Host': headerHost,
+ 'Origin': headerHost,
+ 'Sec-WebSocket-Version': options.value.protocolVersion,
+ 'Sec-WebSocket-Key': key
+ }
+ };
+ if (options.value.protocol) {
+ requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol;
+ }
+ if (options.value.host) {
+ requestOptions.headers['Host'] = options.value.host;
+ }
+
+ if (options.isDefinedAndNonNull('pfx')
+ || options.isDefinedAndNonNull('key')
+ || options.isDefinedAndNonNull('passphrase')
+ || options.isDefinedAndNonNull('cert')
+ || options.isDefinedAndNonNull('ca')
+ || options.isDefinedAndNonNull('ciphers')
+ || options.isDefinedAndNonNull('rejectUnauthorized')) {
+
+ if (isNodeV4) {
+ throw new Error('Client side certificates are not supported on Node 0.4.x');
+ }
+
+ if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx;
+ if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key;
+ if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase;
+ if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert;
+ if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca;
+ if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers;
+ if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized;
+
+ // global agent ignores client side certificates
+ agent = new httpObj.Agent(requestOptions);
+ }
+
+ if (isNodeV4) {
+ requestOptions.path = (serverUrl.pathname || '/') + (serverUrl.search || '');
+ }
+ else requestOptions.path = serverUrl.path || '/';
+
+ if (agent) {
+ requestOptions.agent = agent;
+ }
+
+ if (isUnixSocket) {
+ requestOptions.socketPath = serverUrl.pathname;
+ }
+ if (options.value.origin) {
+ if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin;
+ else requestOptions.headers['Origin'] = options.value.origin;
+ }
+
+ var self = this;
+ var req = httpObj.request(requestOptions);
+
+ (isNodeV4 ? agent : req).on('error', function(error) {
+ self.emit('error', error);
+ cleanupWebsocketResources.call(this, error);
+ });
+ (isNodeV4 ? agent : req).once('response', function(res) {
+ var error = new Error('unexpected server response (' + res.statusCode + ')');
+ self.emit('error', error);
+ cleanupWebsocketResources.call(this, error);
+ });
+ (isNodeV4 ? agent : req).once('upgrade', function(res, socket, upgradeHead) {
+ if (self.readyState == WebSocket.CLOSED) {
+ // client closed before server accepted connection
+ self.emit('close');
+ removeAllListeners(self);
+ socket.end();
+ return;
+ }
+ var serverKey = res.headers['sec-websocket-accept'];
+ if (typeof serverKey == 'undefined' || serverKey !== expectedServerKey) {
+ self.emit('error', 'invalid server key');
+ removeAllListeners(self);
+ socket.end();
+ return;
+ }
+
+ var serverProt = res.headers['sec-websocket-protocol'];
+ var protList = (options.value.protocol || "").split(/, */);
+ var protError = null;
+ if (!options.value.protocol && serverProt) {
+ protError = 'server sent a subprotocol even though none requested';
+ } else if (options.value.protocol && !serverProt) {
+ protError = 'server sent no subprotocol even though requested';
+ } else if (serverProt && protList.indexOf(serverProt) === -1) {
+ protError = 'server responded with an invalid protocol';
+ }
+ if (protError) {
+ self.emit('error', protError);
+ removeAllListeners(self);
+ socket.end();
+ return;
+ } else if (serverProt) {
+ self.protocol = serverProt;
+ }
+
+ establishConnection.call(self, Receiver, Sender, socket, upgradeHead);
+
+ // perform cleanup on http resources
+ removeAllListeners(isNodeV4 ? agent : req);
+ req = null;
+ agent = null;
+ });
+
+ req.end();
+ this.readyState = WebSocket.CONNECTING;
+}
+
+function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) {
+ this._socket = socket;
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ var self = this;
+ this._receiver = new ReceiverClass();
+
+ // socket cleanup handlers
+ socket.on('end', cleanupWebsocketResources.bind(this));
+ socket.on('close', cleanupWebsocketResources.bind(this));
+ socket.on('error', cleanupWebsocketResources.bind(this));
+
+ // ensure that the upgradeHead is added to the receiver
+ function firstHandler(data) {
+ if (self.readyState != WebSocket.OPEN) return;
+ if (upgradeHead && upgradeHead.length > 0) {
+ self.bytesReceived += upgradeHead.length;
+ var head = upgradeHead;
+ upgradeHead = null;
+ self._receiver.add(head);
+ }
+ dataHandler = realHandler;
+ if (data) {
+ self.bytesReceived += data.length;
+ self._receiver.add(data);
+ }
+ }
+ // subsequent packets are pushed straight to the receiver
+ function realHandler(data) {
+ if (data) self.bytesReceived += data.length;
+ self._receiver.add(data);
+ }
+ var dataHandler = firstHandler;
+ socket.on('data', dataHandler);
+ // if data was passed along with the http upgrade,
+ // this will schedule a push of that on to the receiver.
+ // this has to be done on next tick, since the caller
+ // hasn't had a chance to set event handlers on this client
+ // object yet.
+ process.nextTick(firstHandler);
+
+ // receiver event handlers
+ self._receiver.ontext = function (data, flags) {
+ flags = flags || {};
+ self.emit('message', data, flags);
+ };
+ self._receiver.onbinary = function (data, flags) {
+ flags = flags || {};
+ flags.binary = true;
+ self.emit('message', data, flags);
+ };
+ self._receiver.onping = function(data, flags) {
+ flags = flags || {};
+ self.pong(data, {mask: !self._isServer, binary: flags.binary === true}, true);
+ self.emit('ping', data, flags);
+ };
+ self._receiver.onpong = function(data, flags) {
+ self.emit('pong', data, flags);
+ };
+ self._receiver.onclose = function(code, data, flags) {
+ flags = flags || {};
+ self.close(code, data);
+ };
+ self._receiver.onerror = function(reason, errorCode) {
+ // close the connection when the receiver reports a HyBi error code
+ self.close(typeof errorCode != 'undefined' ? errorCode : 1002, '');
+ self.emit('error', reason, errorCode);
+ };
+
+ // finalize the client
+ this._sender = new SenderClass(socket);
+ this._sender.on('error', function(error) {
+ self.close(1002, '');
+ self.emit('error', error);
+ });
+ this.readyState = WebSocket.OPEN;
+ this.emit('open');
+}
+
+function startQueue(instance) {
+ instance._queue = instance._queue || [];
+}
+
+function executeQueueSends(instance) {
+ var queue = instance._queue;
+ if (typeof queue == 'undefined') return;
+ delete instance._queue;
+ for (var i = 0, l = queue.length; i < l; ++i) {
+ queue[i]();
+ }
+}
+
+function sendStream(instance, stream, options, cb) {
+ stream.on('data', function(data) {
+ if (instance.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else {
+ delete instance._queue;
+ instance.emit('error', new Error('not opened'));
+ }
+ return;
+ }
+ options.fin = false;
+ instance._sender.send(data, options);
+ });
+ stream.on('end', function() {
+ if (instance.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else {
+ delete instance._queue;
+ instance.emit('error', new Error('not opened'));
+ }
+ return;
+ }
+ options.fin = true;
+ instance._sender.send(null, options);
+ if (typeof cb == 'function') cb(null);
+ });
+}
+
+function cleanupWebsocketResources(error) {
+ if (this.readyState == WebSocket.CLOSED) return;
+ var emitClose = this.readyState != WebSocket.CONNECTING;
+ this.readyState = WebSocket.CLOSED;
+
+ clearTimeout(this._closeTimer);
+ this._closeTimer = null;
+ if (emitClose) this.emit('close', this._closeCode || 1000, this._closeMessage || '');
+
+ if (this._socket) {
+ removeAllListeners(this._socket);
+ // catch all socket error after removing all standard handlers
+ var socket = this._socket;
+ this._socket.on('error', function() {
+ try { socket.destroy(); } catch (e) {}
+ });
+ try {
+ if (!error) this._socket.end();
+ else this._socket.destroy();
+ }
+ catch (e) { /* Ignore termination errors */ }
+ this._socket = null;
+ }
+ if (this._sender) {
+ removeAllListeners(this._sender);
+ this._sender = null;
+ }
+ if (this._receiver) {
+ this._receiver.cleanup();
+ this._receiver = null;
+ }
+ removeAllListeners(this);
+ this.on('error', function() {}); // catch all errors after this
+ delete this._queue;
+}
+
+function removeAllListeners(instance) {
+ if (isNodeV4) {
+ // node v4 doesn't *actually* remove all listeners globally,
+ // so we do that instead
+ instance._events = {};
+ }
+ else instance.removeAllListeners();
+}
diff --git a/node_modules/ws/lib/WebSocketServer.js b/node_modules/ws/lib/WebSocketServer.js
new file mode 100644
index 0000000..ee47f10
--- /dev/null
+++ b/node_modules/ws/lib/WebSocketServer.js
@@ -0,0 +1,460 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , events = require('events')
+ , http = require('http')
+ , crypto = require('crypto')
+ , url = require('url')
+ , Options = require('options')
+ , WebSocket = require('./WebSocket')
+ , tls = require('tls')
+ , url = require('url');
+
+/**
+ * WebSocket Server implementation
+ */
+
+function WebSocketServer(options, callback) {
+ options = new Options({
+ host: '0.0.0.0',
+ port: null,
+ server: null,
+ verifyClient: null,
+ handleProtocols: null,
+ path: null,
+ noServer: false,
+ disableHixie: false,
+ clientTracking: true
+ }).merge(options);
+
+ if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) {
+ throw new TypeError('`port` or a `server` must be provided');
+ }
+
+ var self = this;
+
+ if (options.isDefinedAndNonNull('port')) {
+ this._server = http.createServer(function (req, res) {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.end('Not implemented');
+ });
+ this._server.listen(options.value.port, options.value.host, callback);
+ this._closeServer = function() { self._server.close(); };
+ }
+ else if (options.value.server) {
+ this._server = options.value.server;
+ if (options.value.path) {
+ // take note of the path, to avoid collisions when multiple websocket servers are
+ // listening on the same http server
+ if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) {
+ throw new Error('two instances of WebSocketServer cannot listen on the same http server path');
+ }
+ if (typeof this._server._webSocketPaths !== 'object') {
+ this._server._webSocketPaths = {};
+ }
+ this._server._webSocketPaths[options.value.path] = 1;
+ }
+ }
+ if (this._server) this._server.once('listening', function() { self.emit('listening'); });
+
+ if (typeof this._server != 'undefined') {
+ this._server.on('error', function(error) {
+ self.emit('error', error)
+ });
+ this._server.on('upgrade', function(req, socket, upgradeHead) {
+ //copy upgradeHead to avoid retention of large slab buffers used in node core
+ var head = new Buffer(upgradeHead.length);
+ upgradeHead.copy(head);
+
+ self.handleUpgrade(req, socket, head, function(client) {
+ self.emit('connection'+req.url, client);
+ self.emit('connection', client);
+ });
+ });
+ }
+
+ this.options = options.value;
+ this.path = options.value.path;
+ this.clients = [];
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocketServer, events.EventEmitter);
+
+/**
+ * Immediately shuts down the connection.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.close = function() {
+ // terminate all associated clients
+ var error = null;
+ try {
+ for (var i = 0, l = this.clients.length; i < l; ++i) {
+ this.clients[i].terminate();
+ }
+ }
+ catch (e) {
+ error = e;
+ }
+
+ // remove path descriptor, if any
+ if (this.path && this._server._webSocketPaths) {
+ delete this._server._webSocketPaths[this.path];
+ if (Object.keys(this._server._webSocketPaths).length == 0) {
+ delete this._server._webSocketPaths;
+ }
+ }
+
+ // close the http server if it was internally created
+ try {
+ if (typeof this._closeServer !== 'undefined') {
+ this._closeServer();
+ }
+ }
+ finally {
+ delete this._server;
+ }
+ if (error) throw error;
+}
+
+/**
+ * Handle a HTTP Upgrade request.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) {
+ // check for wrong path
+ if (this.options.path) {
+ var u = url.parse(req.url);
+ if (u && u.pathname !== this.options.path) return;
+ }
+
+ if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments);
+ else handleHybiUpgrade.apply(this, arguments);
+}
+
+module.exports = WebSocketServer;
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function handleHybiUpgrade(req, socket, upgradeHead, cb) {
+ // handle premature socket errors
+ var errorHandler = function() {
+ try { socket.destroy(); } catch (e) {}
+ }
+ socket.on('error', errorHandler);
+
+ // verify key presence
+ if (!req.headers['sec-websocket-key']) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ // verify version
+ var version = parseInt(req.headers['sec-websocket-version']);
+ if ([8, 13].indexOf(version) === -1) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ // verify protocol
+ var protocols = req.headers['sec-websocket-protocol'];
+
+ // verify client
+ var origin = version < 13 ?
+ req.headers['sec-websocket-origin'] :
+ req.headers['origin'];
+
+ // handler to call when the connection sequence completes
+ var self = this;
+ var completeHybiUpgrade2 = function(protocol) {
+
+ // calc key
+ var key = req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ key = shasum.digest('base64');
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: websocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Accept: ' + key
+ ];
+
+ if (typeof protocol != 'undefined') {
+ headers.push('Sec-WebSocket-Protocol: ' + protocol);
+ }
+
+ // allows external modification/inspection of handshake headers
+ self.emit('headers', headers);
+
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ try {
+ socket.write(headers.concat('', '').join('\r\n'));
+ }
+ catch (e) {
+ // if the upgrade write fails, shut the connection down hard
+ try { socket.destroy(); } catch (e) {}
+ return;
+ }
+
+ var client = new WebSocket([req, socket, upgradeHead], {
+ protocolVersion: version,
+ protocol: protocol
+ });
+
+ if (self.options.clientTracking) {
+ self.clients.push(client);
+ client.on('close', function() {
+ var index = self.clients.indexOf(client);
+ if (index != -1) {
+ self.clients.splice(index, 1);
+ }
+ });
+ }
+
+ // signal upgrade complete
+ socket.removeListener('error', errorHandler);
+ cb(client);
+ }
+
+ // optionally call external protocol selection handler before
+ // calling completeHybiUpgrade2
+ var completeHybiUpgrade1 = function() {
+ // choose from the sub-protocols
+ if (typeof self.options.handleProtocols == 'function') {
+ var protList = (protocols || "").split(/, */);
+ var callbackCalled = false;
+ var res = self.options.handleProtocols(protList, function(result, protocol) {
+ callbackCalled = true;
+ if (!result) abortConnection(socket, 404, 'Unauthorized')
+ else completeHybiUpgrade2(protocol);
+ });
+ if (!callbackCalled) {
+ // the handleProtocols handler never called our callback
+ abortConnection(socket, 501, 'Could not process protocols');
+ }
+ return;
+ } else {
+ if (typeof protocols !== 'undefined') {
+ completeHybiUpgrade2(protocols.split(/, */)[0]);
+ }
+ else {
+ completeHybiUpgrade2();
+ }
+ }
+ }
+
+ // optionally call external client verification handler
+ if (typeof this.options.verifyClient == 'function') {
+ var info = {
+ origin: origin,
+ secure: typeof req.connection.encrypted !== 'undefined',
+ req: req
+ };
+ if (this.options.verifyClient.length == 2) {
+ this.options.verifyClient(info, function(result) {
+ if (!result) abortConnection(socket, 401, 'Unauthorized')
+ else completeHybiUpgrade1();
+ });
+ return;
+ }
+ else if (!this.options.verifyClient(info)) {
+ abortConnection(socket, 401, 'Unauthorized');
+ return;
+ }
+ }
+
+ completeHybiUpgrade1();
+}
+
+function handleHixieUpgrade(req, socket, upgradeHead, cb) {
+ // handle premature socket errors
+ var errorHandler = function() {
+ try { socket.destroy(); } catch (e) {}
+ }
+ socket.on('error', errorHandler);
+
+ // bail if options prevent hixie
+ if (this.options.disableHixie) {
+ abortConnection(socket, 401, 'Hixie support disabled');
+ return;
+ }
+
+ // verify key presence
+ if (!req.headers['sec-websocket-key2']) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ var origin = req.headers['origin']
+ , self = this;
+
+ // setup handshake completion to run after client has been verified
+ var onClientVerified = function() {
+ var wshost;
+ if (!req.headers['x-forwarded-host'])
+ wshost = req.headers.host;
+ else
+ wshost = req.headers['x-forwarded-host'];
+ var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url
+ , protocol = req.headers['sec-websocket-protocol'];
+
+ // handshake completion code to run once nonce has been successfully retrieved
+ var completeHandshake = function(nonce, rest) {
+ // calculate key
+ var k1 = req.headers['sec-websocket-key1']
+ , k2 = req.headers['sec-websocket-key2']
+ , md5 = crypto.createHash('md5');
+
+ [k1, k2].forEach(function (k) {
+ var n = parseInt(k.replace(/[^\d]/g, ''))
+ , spaces = k.replace(/[^ ]/g, '').length;
+ if (spaces === 0 || n % spaces !== 0){
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+ n /= spaces;
+ md5.update(String.fromCharCode(
+ n >> 24 & 0xFF,
+ n >> 16 & 0xFF,
+ n >> 8 & 0xFF,
+ n & 0xFF));
+ });
+ md5.update(nonce.toString('binary'));
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: WebSocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Location: ' + location
+ ];
+ if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol);
+ if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin);
+
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ try {
+ // merge header and hash buffer
+ var headerBuffer = new Buffer(headers.concat('', '').join('\r\n'));
+ var hashBuffer = new Buffer(md5.digest('binary'), 'binary');
+ var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length);
+ headerBuffer.copy(handshakeBuffer, 0);
+ hashBuffer.copy(handshakeBuffer, headerBuffer.length);
+
+ // do a single write, which - upon success - causes a new client websocket to be setup
+ socket.write(handshakeBuffer, 'binary', function(err) {
+ if (err) return; // do not create client if an error happens
+ var client = new WebSocket([req, socket, rest], {
+ protocolVersion: 'hixie-76',
+ protocol: protocol
+ });
+ if (self.options.clientTracking) {
+ self.clients.push(client);
+ client.on('close', function() {
+ var index = self.clients.indexOf(client);
+ if (index != -1) {
+ self.clients.splice(index, 1);
+ }
+ });
+ }
+
+ // signal upgrade complete
+ socket.removeListener('error', errorHandler);
+ cb(client);
+ });
+ }
+ catch (e) {
+ try { socket.destroy(); } catch (e) {}
+ return;
+ }
+ }
+
+ // retrieve nonce
+ var nonceLength = 8;
+ if (upgradeHead && upgradeHead.length >= nonceLength) {
+ var nonce = upgradeHead.slice(0, nonceLength);
+ var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null;
+ completeHandshake.call(self, nonce, rest);
+ }
+ else {
+ // nonce not present in upgradeHead, so we must wait for enough data
+ // data to arrive before continuing
+ var nonce = new Buffer(nonceLength);
+ upgradeHead.copy(nonce, 0);
+ var received = upgradeHead.length;
+ var rest = null;
+ var handler = function (data) {
+ var toRead = Math.min(data.length, nonceLength - received);
+ if (toRead === 0) return;
+ data.copy(nonce, received, 0, toRead);
+ received += toRead;
+ if (received == nonceLength) {
+ socket.removeListener('data', handler);
+ if (toRead < data.length) rest = data.slice(toRead);
+ completeHandshake.call(self, nonce, rest);
+ }
+ }
+ socket.on('data', handler);
+ }
+ }
+
+ // verify client
+ if (typeof this.options.verifyClient == 'function') {
+ var info = {
+ origin: origin,
+ secure: typeof req.connection.encrypted !== 'undefined',
+ req: req
+ };
+ if (this.options.verifyClient.length == 2) {
+ var self = this;
+ this.options.verifyClient(info, function(result) {
+ if (!result) abortConnection(socket, 401, 'Unauthorized')
+ else onClientVerified.apply(self);
+ });
+ return;
+ }
+ else if (!this.options.verifyClient(info)) {
+ abortConnection(socket, 401, 'Unauthorized');
+ return;
+ }
+ }
+
+ // no client verification required
+ onClientVerified();
+}
+
+function abortConnection(socket, code, name) {
+ try {
+ var response = [
+ 'HTTP/1.1 ' + code + ' ' + name,
+ 'Content-type: text/html'
+ ];
+ socket.write(response.concat('', '').join('\r\n'));
+ }
+ catch (e) { /* ignore errors - we've aborted this connection */ }
+ finally {
+ // ensure that an early aborted connection is shut down completely
+ try { socket.destroy(); } catch (e) {}
+ }
+}
diff --git a/node_modules/ws/lib/browser.js b/node_modules/ws/lib/browser.js
new file mode 100644
index 0000000..37cafe1
--- /dev/null
+++ b/node_modules/ws/lib/browser.js
@@ -0,0 +1,5 @@
+/// shim for browser packaging
+
+module.exports = function() {
+ return global.WebSocket || global.MozWebSocket;
+}
diff --git a/node_modules/ws/node_modules/commander/.npmignore b/node_modules/ws/node_modules/commander/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/ws/node_modules/commander/.travis.yml b/node_modules/ws/node_modules/commander/.travis.yml
new file mode 100644
index 0000000..f1d0f13
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
diff --git a/node_modules/ws/node_modules/commander/History.md b/node_modules/ws/node_modules/commander/History.md
new file mode 100644
index 0000000..4961d2e
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/History.md
@@ -0,0 +1,107 @@
+
+0.6.1 / 2012-06-01
+==================
+
+ * Added: append (yes or no) on confirmation
+ * Added: allow node.js v0.7.x
+
+0.6.0 / 2012-04-10
+==================
+
+ * Added `.prompt(obj, callback)` support. Closes #49
+ * Added default support to .choose(). Closes #41
+ * Fixed the choice example
+
+0.5.1 / 2011-12-20
+==================
+
+ * Fixed `password()` for recent nodes. Closes #36
+
+0.5.0 / 2011-12-04
+==================
+
+ * Added sub-command option support [itay]
+
+0.4.3 / 2011-12-04
+==================
+
+ * Fixed custom help ordering. Closes #32
+
+0.4.2 / 2011-11-24
+==================
+
+ * Added travis support
+ * Fixed: line-buffered input automatically trimmed. Closes #31
+
+0.4.1 / 2011-11-18
+==================
+
+ * Removed listening for "close" on --help
+
+0.4.0 / 2011-11-15
+==================
+
+ * Added support for `--`. Closes #24
+
+0.3.3 / 2011-11-14
+==================
+
+ * Fixed: wait for close event when writing help info [Jerry Hamlet]
+
+0.3.2 / 2011-11-01
+==================
+
+ * Fixed long flag definitions with values [felixge]
+
+0.3.1 / 2011-10-31
+==================
+
+ * Changed `--version` short flag to `-V` from `-v`
+ * Changed `.version()` so it's configurable [felixge]
+
+0.3.0 / 2011-10-31
+==================
+
+ * Added support for long flags only. Closes #18
+
+0.2.1 / 2011-10-24
+==================
+
+ * "node": ">= 0.4.x < 0.7.0". Closes #20
+
+0.2.0 / 2011-09-26
+==================
+
+ * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
+
+0.1.0 / 2011-08-24
+==================
+
+ * Added support for custom `--help` output
+
+0.0.5 / 2011-08-18
+==================
+
+ * Changed: when the user enters nothing prompt for password again
+ * Fixed issue with passwords beginning with numbers [NuckChorris]
+
+0.0.4 / 2011-08-15
+==================
+
+ * Fixed `Commander#args`
+
+0.0.3 / 2011-08-15
+==================
+
+ * Added default option value support
+
+0.0.2 / 2011-08-15
+==================
+
+ * Added mask support to `Command#password(str[, mask], fn)`
+ * Added `Command#password(str, fn)`
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/ws/node_modules/commander/Makefile b/node_modules/ws/node_modules/commander/Makefile
new file mode 100644
index 0000000..0074625
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/Makefile
@@ -0,0 +1,7 @@
+
+TESTS = $(shell find test/test.*.js)
+
+test:
+ @./test/run $(TESTS)
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/ws/node_modules/commander/Readme.md b/node_modules/ws/node_modules/commander/Readme.md
new file mode 100644
index 0000000..b8328c3
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/Readme.md
@@ -0,0 +1,262 @@
+# Commander.js
+
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+ $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+ .version('0.0.1')
+ .option('-p, --peppers', 'Add peppers')
+ .option('-P, --pineapple', 'Add pineapple')
+ .option('-b, --bbq', 'Add bbq sauce')
+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log(' - peppers');
+if (program.pineapple) console.log(' - pineappe');
+if (program.bbq) console.log(' - bbq');
+console.log(' - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```
+ $ ./examples/pizza --help
+
+ Usage: pizza [options]
+
+ Options:
+
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineappe
+ -b, --bbq Add bbq sauce
+ -c, --cheese <type> Add the specified type of cheese [marble]
+ -h, --help output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+ return val.split('..').map(Number);
+}
+
+function list(val) {
+ return val.split(',');
+}
+
+program
+ .version('0.0.1')
+ .usage('[options] <file ...>')
+ .option('-i, --integer <n>', 'An integer argument', parseInt)
+ .option('-f, --float <n>', 'A float argument', parseFloat)
+ .option('-r, --range <a>..<b>', 'A range', range)
+ .option('-l, --list <items>', 'A list', list)
+ .option('-o, --optional [value]', 'An optional value')
+ .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+ return val.split(',').map(Number);
+}
+
+program
+ .version('0.0.1')
+ .option('-f, --foo', 'enable some foo')
+ .option('-b, --bar', 'enable some bar')
+ .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+ console.log(' Examples:');
+ console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
+ console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+ -h, --help output usage information
+ -V, --version output the version number
+ -f, --foo enable some foo
+ -b, --bar enable some bar
+ -B, --baz enable some baz
+
+Examples:
+
+ $ custom-help --help
+ $ custom-help -h
+
+```
+
+## .prompt(msg, fn)
+
+ Single-line prompt:
+
+```js
+program.prompt('name: ', function(name){
+ console.log('hi %s', name);
+});
+```
+
+ Multi-line prompt:
+
+```js
+program.prompt('description:', function(name){
+ console.log('hi %s', name);
+});
+```
+
+ Coercion:
+
+```js
+program.prompt('Age: ', Number, function(age){
+ console.log('age: %j', age);
+});
+```
+
+```js
+program.prompt('Birthdate: ', Date, function(date){
+ console.log('date: %s', date);
+});
+```
+
+## .password(msg[, mask], fn)
+
+Prompt for password without echoing:
+
+```js
+program.password('Password: ', function(pass){
+ console.log('got "%s"', pass);
+ process.stdin.destroy();
+});
+```
+
+Prompt for password with mask char "*":
+
+```js
+program.password('Password: ', '*', function(pass){
+ console.log('got "%s"', pass);
+ process.stdin.destroy();
+});
+```
+
+## .confirm(msg, fn)
+
+ Confirm with the given `msg`:
+
+```js
+program.confirm('continue? ', function(ok){
+ console.log(' got %j', ok);
+});
+```
+
+## .choose(list, fn)
+
+ Let the user choose from a `list`:
+
+```js
+var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+
+console.log('Choose the coolest pet:');
+program.choose(list, function(i){
+ console.log('you chose %d "%s"', i, list[i]);
+});
+```
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/ws/node_modules/commander/index.js b/node_modules/ws/node_modules/commander/index.js
new file mode 100644
index 0000000..06ec1e4
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/commander'); \ No newline at end of file
diff --git a/node_modules/ws/node_modules/commander/lib/commander.js b/node_modules/ws/node_modules/commander/lib/commander.js
new file mode 100644
index 0000000..5ba87eb
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/lib/commander.js
@@ -0,0 +1,1026 @@
+
+/*!
+ * commander
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , path = require('path')
+ , tty = require('tty')
+ , basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+ this.flags = flags;
+ this.required = ~flags.indexOf('<');
+ this.optional = ~flags.indexOf('[');
+ this.bool = !~flags.indexOf('-no-');
+ flags = flags.split(/[ ,|]+/);
+ if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+ this.long = flags.shift();
+ this.description = description;
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+ return this.long
+ .replace('--', '')
+ .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+ return arg == this.short
+ || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+ this.commands = [];
+ this.options = [];
+ this.args = [];
+ this.name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ * program
+ * .version('0.0.1')
+ * .option('-C, --chdir <path>', 'change the working directory')
+ * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ * .option('-T, --no-tests', 'ignore test hook')
+ *
+ * program
+ * .command('setup')
+ * .description('run remote setup commands')
+ * .action(function(){
+ * console.log('setup');
+ * });
+ *
+ * program
+ * .command('exec <cmd>')
+ * .description('run the given remote command')
+ * .action(function(cmd){
+ * console.log('exec "%s"', cmd);
+ * });
+ *
+ * program
+ * .command('*')
+ * .description('deploy the given env')
+ * .action(function(env){
+ * console.log('deploying "%s"', env);
+ * });
+ *
+ * program.parse(process.argv);
+ *
+ * @param {String} name
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name){
+ var args = name.split(/ +/);
+ var cmd = new Command(args.shift());
+ this.commands.push(cmd);
+ cmd.parseExpectedArgs(args);
+ cmd.parent = this;
+ return cmd;
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+ if (!args.length) return;
+ var self = this;
+ args.forEach(function(arg){
+ switch (arg[0]) {
+ case '<':
+ self.args.push({ required: true, name: arg.slice(1, -1) });
+ break;
+ case '[':
+ self.args.push({ required: false, name: arg.slice(1, -1) });
+ break;
+ }
+ });
+ return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ * program
+ * .command('help')
+ * .description('display verbose help')
+ * .action(function(){
+ * // output help here
+ * });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+ var self = this;
+ this.parent.on(this.name, function(args, unknown){
+ // Parse any so-far unknown options
+ unknown = unknown || [];
+ var parsed = self.parseOptions(unknown);
+
+ // Output help if necessary
+ outputHelpIfNecessary(self, parsed.unknown);
+
+ // If there are still any unknown options, then we simply
+ // die, unless someone asked for help, in which case we give it
+ // to them, and then we die.
+ if (parsed.unknown.length > 0) {
+ self.unknownOption(parsed.unknown[0]);
+ }
+
+ self.args.forEach(function(arg, i){
+ if (arg.required && null == args[i]) {
+ self.missingArgument(arg.name);
+ }
+ });
+
+ // Always append ourselves to the end of the arguments,
+ // to make sure we match the number of arguments the user
+ // expects
+ if (self.args.length) {
+ args[self.args.length] = self;
+ } else {
+ args.push(self);
+ }
+
+ fn.apply(this, args);
+ });
+ return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`.
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ * "-p, --pepper"
+ * "-p|--pepper"
+ * "-p --pepper"
+ *
+ * Examples:
+ *
+ * // simple boolean defaulting to false
+ * program.option('-p, --pepper', 'add pepper');
+ *
+ * --pepper
+ * program.pepper
+ * // => Boolean
+ *
+ * // simple boolean defaulting to false
+ * program.option('-C, --no-cheese', 'remove cheese');
+ *
+ * program.cheese
+ * // => true
+ *
+ * --no-cheese
+ * program.cheese
+ * // => true
+ *
+ * // required argument
+ * program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ * --chdir /tmp
+ * program.chdir
+ * // => "/tmp"
+ *
+ * // optional argument
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+ var self = this
+ , option = new Option(flags, description)
+ , oname = option.name()
+ , name = camelcase(oname);
+
+ // default as 3rd arg
+ if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+ // preassign default value only for --no-*, [optional], or <required>
+ if (false == option.bool || option.optional || option.required) {
+ // when --no-* we make sure default is true
+ if (false == option.bool) defaultValue = true;
+ // preassign only if we have a default
+ if (undefined !== defaultValue) self[name] = defaultValue;
+ }
+
+ // register the option
+ this.options.push(option);
+
+ // when it's passed assign the value
+ // and conditionally invoke the callback
+ this.on(oname, function(val){
+ // coercion
+ if (null != val && fn) val = fn(val);
+
+ // unassigned or bool
+ if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ // if no value, bool true, and we have a default, then use it!
+ if (null == val) {
+ self[name] = option.bool
+ ? defaultValue || true
+ : false;
+ } else {
+ self[name] = val;
+ }
+ } else if (null !== val) {
+ // reassign
+ self[name] = val;
+ }
+ });
+
+ return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+ // store raw args
+ this.rawArgs = argv;
+
+ // guess name
+ if (!this.name) this.name = basename(argv[1]);
+
+ // process argv
+ var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+ this.args = parsed.args;
+ return this.parseArgs(this.args, parsed.unknown);
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+ var ret = []
+ , arg;
+
+ for (var i = 0, len = args.length; i < len; ++i) {
+ arg = args[i];
+ if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ arg.slice(1).split('').forEach(function(c){
+ ret.push('-' + c);
+ });
+ } else {
+ ret.push(arg);
+ }
+ }
+
+ return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+ var cmds = this.commands
+ , len = cmds.length
+ , name;
+
+ if (args.length) {
+ name = args[0];
+ if (this.listeners(name).length) {
+ this.emit(args.shift(), args, unknown);
+ } else {
+ this.emit('*', args);
+ }
+ } else {
+ outputHelpIfNecessary(this, unknown);
+
+ // If there were no args and we have unknown options,
+ // then they are extraneous and we need to error.
+ if (unknown.length > 0) {
+ this.unknownOption(unknown[0]);
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+ for (var i = 0, len = this.options.length; i < len; ++i) {
+ if (this.options[i].is(arg)) {
+ return this.options[i];
+ }
+ }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+ var args = []
+ , len = argv.length
+ , literal
+ , option
+ , arg;
+
+ var unknownOptions = [];
+
+ // parse options
+ for (var i = 0; i < len; ++i) {
+ arg = argv[i];
+
+ // literal args after --
+ if ('--' == arg) {
+ literal = true;
+ continue;
+ }
+
+ if (literal) {
+ args.push(arg);
+ continue;
+ }
+
+ // find matching Option
+ option = this.optionFor(arg);
+
+ // option is defined
+ if (option) {
+ // requires arg
+ if (option.required) {
+ arg = argv[++i];
+ if (null == arg) return this.optionMissingArgument(option);
+ if ('-' == arg[0]) return this.optionMissingArgument(option, arg);
+ this.emit(option.name(), arg);
+ // optional arg
+ } else if (option.optional) {
+ arg = argv[i+1];
+ if (null == arg || '-' == arg[0]) {
+ arg = null;
+ } else {
+ ++i;
+ }
+ this.emit(option.name(), arg);
+ // bool
+ } else {
+ this.emit(option.name());
+ }
+ continue;
+ }
+
+ // looks like an option
+ if (arg.length > 1 && '-' == arg[0]) {
+ unknownOptions.push(arg);
+
+ // If the next argument looks like it might be
+ // an argument for this option, we pass it on.
+ // If it isn't, then it'll simply be ignored
+ if (argv[i+1] && '-' != argv[i+1][0]) {
+ unknownOptions.push(argv[++i]);
+ }
+ continue;
+ }
+
+ // arg
+ args.push(arg);
+ }
+
+ return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+ console.error();
+ console.error(" error: missing required argument `%s'", name);
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+ console.error();
+ if (flag) {
+ console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
+ } else {
+ console.error(" error: option `%s' argument missing", option.flags);
+ }
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+ console.error();
+ console.error(" error: unknown option `%s'", flag);
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+ if (0 == arguments.length) return this._version;
+ this._version = str;
+ flags = flags || '-V, --version';
+ this.option(flags, 'output the version number');
+ this.on('version', function(){
+ console.log(str);
+ process.exit(0);
+ });
+ return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+ if (0 == arguments.length) return this._description;
+ this._description = str;
+ return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+ var args = this.args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ });
+
+ var usage = '[options'
+ + (this.commands.length ? '] [command' : '')
+ + ']'
+ + (this.args.length ? ' ' + args : '');
+ if (0 == arguments.length) return this._usage || usage;
+ this._usage = str;
+
+ return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+ return this.options.reduce(function(max, option){
+ return Math.max(max, option.flags.length);
+ }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+ var width = this.largestOptionLength();
+
+ // Prepend the help information
+ return [pad('-h, --help', width) + ' ' + 'output usage information']
+ .concat(this.options.map(function(option){
+ return pad(option.flags, width)
+ + ' ' + option.description;
+ }))
+ .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+ if (!this.commands.length) return '';
+ return [
+ ''
+ , ' Commands:'
+ , ''
+ , this.commands.map(function(cmd){
+ var args = cmd.args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ }).join(' ');
+
+ return cmd.name
+ + (cmd.options.length
+ ? ' [options]'
+ : '') + ' ' + args
+ + (cmd.description()
+ ? '\n' + cmd.description()
+ : '');
+ }).join('\n\n').replace(/^/gm, ' ')
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+ return [
+ ''
+ , ' Usage: ' + this.name + ' ' + this.usage()
+ , '' + this.commandHelp()
+ , ' Options:'
+ , ''
+ , '' + this.optionHelp().replace(/^/gm, ' ')
+ , ''
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Prompt for a `Number`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForNumber = function(str, fn){
+ var self = this;
+ this.promptSingleLine(str, function parseNumber(val){
+ val = Number(val);
+ if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
+ fn(val);
+ });
+};
+
+/**
+ * Prompt for a `Date`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForDate = function(str, fn){
+ var self = this;
+ this.promptSingleLine(str, function parseDate(val){
+ val = new Date(val);
+ if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
+ fn(val);
+ });
+};
+
+/**
+ * Single-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptSingleLine = function(str, fn){
+ if ('function' == typeof arguments[2]) {
+ return this['promptFor' + (fn.name || fn)](str, arguments[2]);
+ }
+
+ process.stdout.write(str);
+ process.stdin.setEncoding('utf8');
+ process.stdin.once('data', function(val){
+ fn(val.trim());
+ }).resume();
+};
+
+/**
+ * Multi-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptMultiLine = function(str, fn){
+ var buf = [];
+ console.log(str);
+ process.stdin.setEncoding('utf8');
+ process.stdin.on('data', function(val){
+ if ('\n' == val || '\r\n' == val) {
+ process.stdin.removeAllListeners('data');
+ fn(buf.join('\n'));
+ } else {
+ buf.push(val.trimRight());
+ }
+ }).resume();
+};
+
+/**
+ * Prompt `str` and callback `fn(val)`
+ *
+ * Commander supports single-line and multi-line prompts.
+ * To issue a single-line prompt simply add white-space
+ * to the end of `str`, something like "name: ", whereas
+ * for a multi-line prompt omit this "description:".
+ *
+ *
+ * Examples:
+ *
+ * program.prompt('Username: ', function(name){
+ * console.log('hi %s', name);
+ * });
+ *
+ * program.prompt('Description:', function(desc){
+ * console.log('description was "%s"', desc.trim());
+ * });
+ *
+ * @param {String|Object} str
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.prompt = function(str, fn){
+ var self = this;
+
+ if ('string' == typeof str) {
+ if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
+ this.promptMultiLine(str, fn);
+ } else {
+ var keys = Object.keys(str)
+ , obj = {};
+
+ function next() {
+ var key = keys.shift()
+ , label = str[key];
+
+ if (!key) return fn(obj);
+ self.prompt(label, function(val){
+ obj[key] = val;
+ next();
+ });
+ }
+
+ next();
+ }
+};
+
+/**
+ * Prompt for password with `str`, `mask` char and callback `fn(val)`.
+ *
+ * The mask string defaults to '', aka no output is
+ * written while typing, you may want to use "*" etc.
+ *
+ * Examples:
+ *
+ * program.password('Password: ', function(pass){
+ * console.log('got "%s"', pass);
+ * process.stdin.destroy();
+ * });
+ *
+ * program.password('Password: ', '*', function(pass){
+ * console.log('got "%s"', pass);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {String} str
+ * @param {String} mask
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.password = function(str, mask, fn){
+ var self = this
+ , buf = '';
+
+ // default mask
+ if ('function' == typeof mask) {
+ fn = mask;
+ mask = '';
+ }
+
+ process.stdin.resume();
+ tty.setRawMode(true);
+ process.stdout.write(str);
+
+ // keypress
+ process.stdin.on('keypress', function(c, key){
+ if (key && 'enter' == key.name) {
+ console.log();
+ process.stdin.removeAllListeners('keypress');
+ tty.setRawMode(false);
+ if (!buf.trim().length) return self.password(str, mask, fn);
+ fn(buf);
+ return;
+ }
+
+ if (key && key.ctrl && 'c' == key.name) {
+ console.log('%s', buf);
+ process.exit();
+ }
+
+ process.stdout.write(mask);
+ buf += c;
+ }).resume();
+};
+
+/**
+ * Confirmation prompt with `str` and callback `fn(bool)`
+ *
+ * Examples:
+ *
+ * program.confirm('continue? ', function(ok){
+ * console.log(' got %j', ok);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api public
+ */
+
+
+Command.prototype.confirm = function(str, fn, verbose){
+ var self = this;
+ this.prompt(str, function(ok){
+ if (!ok.trim()) {
+ if (!verbose) str += '(yes or no) ';
+ return self.confirm(str, fn, true);
+ }
+ fn(parseBool(ok));
+ });
+};
+
+/**
+ * Choice prompt with `list` of items and callback `fn(index, item)`
+ *
+ * Examples:
+ *
+ * var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+ *
+ * console.log('Choose the coolest pet:');
+ * program.choose(list, function(i){
+ * console.log('you chose %d "%s"', i, list[i]);
+ * process.stdin.destroy();
+ * });
+ *
+ * @param {Array} list
+ * @param {Number|Function} index or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.choose = function(list, index, fn){
+ var self = this
+ , hasDefault = 'number' == typeof index;
+
+ if (!hasDefault) {
+ fn = index;
+ index = null;
+ }
+
+ list.forEach(function(item, i){
+ if (hasDefault && i == index) {
+ console.log('* %d) %s', i + 1, item);
+ } else {
+ console.log(' %d) %s', i + 1, item);
+ }
+ });
+
+ function again() {
+ self.prompt(' : ', function(val){
+ val = parseInt(val, 10) - 1;
+ if (hasDefault && isNaN(val)) val = index;
+
+ if (null == list[val]) {
+ again();
+ } else {
+ fn(val, list[val]);
+ }
+ });
+ }
+
+ again();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+ return flag.split('-').reduce(function(str, word){
+ return str + word[0].toUpperCase() + word.slice(1);
+ });
+}
+
+/**
+ * Parse a boolean `str`.
+ *
+ * @param {String} str
+ * @return {Boolean}
+ * @api private
+ */
+
+function parseBool(str) {
+ return /^y|yes|ok|true$/i.test(str);
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+ var len = Math.max(0, width - str.length);
+ return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+ options = options || [];
+ for (var i = 0; i < options.length; i++) {
+ if (options[i] == '--help' || options[i] == '-h') {
+ process.stdout.write(cmd.helpInformation());
+ cmd.emit('--help');
+ process.exit(0);
+ }
+ }
+}
diff --git a/node_modules/ws/node_modules/commander/package.json b/node_modules/ws/node_modules/commander/package.json
new file mode 100644
index 0000000..b82c5b1
--- /dev/null
+++ b/node_modules/ws/node_modules/commander/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "commander",
+ "version": "0.6.1",
+ "description": "the complete solution for node.js command-line programs",
+ "keywords": [
+ "command",
+ "option",
+ "parser",
+ "prompt",
+ "stdin"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/visionmedia/commander.js.git"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "should": ">= 0.0.1"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.4.x"
+ },
+ "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese <type> Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] <file ...>')\n .option('-i, --integer <n>', 'An integer argument', parseInt)\n .option('-f, --float <n>', 'A float argument', parseFloat)\n .option('-r, --range <a>..<b>', 'A range', range)\n .option('-l, --list <items>', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "readmeFilename": "Readme.md",
+ "bugs": {
+ "url": "https://github.com/visionmedia/commander.js/issues"
+ },
+ "_id": "commander@0.6.1",
+ "dist": {
+ "shasum": "41be1203fe9f03dfa7933bc2e023817bf091e9e3"
+ },
+ "_from": "commander@~0.6.1",
+ "_resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz"
+}
diff --git a/node_modules/ws/node_modules/options/.npmignore b/node_modules/ws/node_modules/options/.npmignore
new file mode 100644
index 0000000..6bfffbb
--- /dev/null
+++ b/node_modules/ws/node_modules/options/.npmignore
@@ -0,0 +1,5 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
diff --git a/node_modules/ws/node_modules/options/Makefile b/node_modules/ws/node_modules/options/Makefile
new file mode 100644
index 0000000..7496b6f
--- /dev/null
+++ b/node_modules/ws/node_modules/options/Makefile
@@ -0,0 +1,12 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+
+run-tests:
+ @./node_modules/.bin/mocha \
+ -t 2000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+test:
+ @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+.PHONY: test
diff --git a/node_modules/ws/node_modules/options/README.md b/node_modules/ws/node_modules/options/README.md
new file mode 100644
index 0000000..4b39a2a
--- /dev/null
+++ b/node_modules/ws/node_modules/options/README.md
@@ -0,0 +1,28 @@
+# options.js #
+
+A very light-weight in-code option parsers for node.js.
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ws/node_modules/options/lib/options.js b/node_modules/ws/node_modules/options/lib/options.js
new file mode 100644
index 0000000..4fc45e9
--- /dev/null
+++ b/node_modules/ws/node_modules/options/lib/options.js
@@ -0,0 +1,86 @@
+/*!
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var fs = require('fs');
+
+function Options(defaults) {
+ var internalValues = {};
+ var values = this.value = {};
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ Object.defineProperty(values, key, {
+ get: function() { return internalValues[key]; },
+ configurable: false,
+ enumerable: true
+ });
+ });
+ this.reset = function() {
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ });
+ return this;
+ };
+ this.merge = function(options, required) {
+ options = options || {};
+ if (Object.prototype.toString.call(required) === '[object Array]') {
+ var missing = [];
+ for (var i = 0, l = required.length; i < l; ++i) {
+ var key = required[i];
+ if (!(key in options)) {
+ missing.push(key);
+ }
+ }
+ if (missing.length > 0) {
+ if (missing.length > 1) {
+ throw new Error('options ' +
+ missing.slice(0, missing.length - 1).join(', ') + ' and ' +
+ missing[missing.length - 1] + ' must be defined');
+ }
+ else throw new Error('option ' + missing[0] + ' must be defined');
+ }
+ }
+ Object.keys(options).forEach(function(key) {
+ if (key in internalValues) {
+ internalValues[key] = options[key];
+ }
+ });
+ return this;
+ };
+ this.copy = function(keys) {
+ var obj = {};
+ Object.keys(defaults).forEach(function(key) {
+ if (keys.indexOf(key) !== -1) {
+ obj[key] = values[key];
+ }
+ });
+ return obj;
+ };
+ this.read = function(filename, cb) {
+ if (typeof cb == 'function') {
+ var self = this;
+ fs.readFile(filename, function(error, data) {
+ if (error) return cb(error);
+ var conf = JSON.parse(data);
+ self.merge(conf);
+ cb();
+ });
+ }
+ else {
+ var conf = JSON.parse(fs.readFileSync(filename));
+ this.merge(conf);
+ }
+ return this;
+ };
+ this.isDefined = function(key) {
+ return typeof values[key] != 'undefined';
+ };
+ this.isDefinedAndNonNull = function(key) {
+ return typeof values[key] != 'undefined' && values[key] !== null;
+ };
+ Object.freeze(values);
+ Object.freeze(this);
+}
+
+module.exports = Options;
diff --git a/node_modules/ws/node_modules/options/package.json b/node_modules/ws/node_modules/options/package.json
new file mode 100644
index 0000000..6e5bdf8
--- /dev/null
+++ b/node_modules/ws/node_modules/options/package.json
@@ -0,0 +1,36 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "options",
+ "description": "A very light-weight in-code option parsers for node.js.",
+ "version": "0.0.5",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/options.js.git"
+ },
+ "main": "lib/options",
+ "scripts": {
+ "test": "make test"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "latest"
+ },
+ "readme": "# options.js #\n\nA very light-weight in-code option parsers for node.js.\n\n## License ##\n\n(The MIT License)\n\nCopyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/einaros/options.js/issues"
+ },
+ "_id": "options@0.0.5",
+ "dist": {
+ "shasum": "4f79a4434f2d0703250db48ef2fa5f5050f08f15"
+ },
+ "_from": "options@>=0.0.5",
+ "_resolved": "https://registry.npmjs.org/options/-/options-0.0.5.tgz"
+}
diff --git a/node_modules/ws/node_modules/options/test/fixtures/test.conf b/node_modules/ws/node_modules/options/test/fixtures/test.conf
new file mode 100644
index 0000000..6e62444
--- /dev/null
+++ b/node_modules/ws/node_modules/options/test/fixtures/test.conf
@@ -0,0 +1,4 @@
+{
+ "a": "foobar",
+ "b": false
+} \ No newline at end of file
diff --git a/node_modules/ws/node_modules/options/test/options.test.js b/node_modules/ws/node_modules/options/test/options.test.js
new file mode 100644
index 0000000..6a1d9f5
--- /dev/null
+++ b/node_modules/ws/node_modules/options/test/options.test.js
@@ -0,0 +1,140 @@
+var Options = require('options')
+ , assert = require('assert');
+
+describe('Options', function() {
+ describe('#ctor', function() {
+ it('initializes options', function() {
+ var option = new Options({a: true, b: false});
+ assert.strictEqual(true, option.value.a);
+ assert.strictEqual(false, option.value.b);
+ });
+ });
+
+ describe('#merge', function() {
+ it('merges options from another object', function() {
+ var option = new Options({a: true, b: false});
+ option.merge({b: true});
+ assert.strictEqual(true, option.value.a);
+ assert.strictEqual(true, option.value.b);
+ });
+ it('does nothing when arguments are undefined', function() {
+ var option = new Options({a: true, b: false});
+ option.merge(undefined);
+ assert.strictEqual(true, option.value.a);
+ assert.strictEqual(false, option.value.b);
+ });
+ it('cannot set values that werent already there', function() {
+ var option = new Options({a: true, b: false});
+ option.merge({c: true});
+ assert.strictEqual('undefined', typeof option.value.c);
+ });
+ it('can require certain options to be defined', function() {
+ var option = new Options({a: true, b: false, c: 3});
+ var caughtException = false;
+ try {
+ option.merge({}, ['a', 'b', 'c']);
+ }
+ catch (e) {
+ caughtException = e.toString() == 'Error: options a, b and c must be defined';
+ }
+ assert.strictEqual(true, caughtException);
+ });
+ it('can require certain options to be defined, when options are undefined', function() {
+ var option = new Options({a: true, b: false, c: 3});
+ var caughtException = false;
+ try {
+ option.merge(undefined, ['a', 'b', 'c']);
+ }
+ catch (e) {
+ caughtException = e.toString() == 'Error: options a, b and c must be defined';
+ }
+ assert.strictEqual(true, caughtException);
+ });
+ it('returns "this"', function() {
+ var option = new Options({a: true, b: false, c: 3});
+ assert.strictEqual(option, option.merge());
+ });
+ });
+
+ describe('#copy', function() {
+ it('returns a new object with the indicated options', function() {
+ var option = new Options({a: true, b: false, c: 3});
+ option.merge({c: 4});
+ var obj = option.copy(['a', 'c']);
+ assert.strictEqual(true, obj.a);
+ assert.strictEqual(4, obj.c);
+ assert.strictEqual('undefined', typeof obj.b);
+ });
+ });
+
+ describe('#value', function() {
+ it('can be enumerated', function() {
+ var option = new Options({a: true, b: false});
+ assert.strictEqual(2, Object.keys(option.value).length);
+ });
+ it('can not be used to set values', function() {
+ var option = new Options({a: true, b: false});
+ option.value.b = true;
+ assert.strictEqual(false, option.value.b);
+ });
+ it('can not be used to add values', function() {
+ var option = new Options({a: true, b: false});
+ option.value.c = 3;
+ assert.strictEqual('undefined', typeof option.value.c);
+ });
+ });
+
+ describe('#isDefined', function() {
+ it('returns true if the named value is defined', function() {
+ var option = new Options({a: undefined});
+ assert.strictEqual(false, option.isDefined('a'));
+ option.merge({a: false});
+ assert.strictEqual(true, option.isDefined('a'));
+ });
+ });
+
+ describe('#isDefinedAndNonNull', function() {
+ it('returns true if the named value is defined and non-null', function() {
+ var option = new Options({a: undefined});
+ assert.strictEqual(false, option.isDefinedAndNonNull('a'));
+ option.merge({a: null});
+ assert.strictEqual(false, option.isDefinedAndNonNull('a'));
+ option.merge({a: 2});
+ assert.strictEqual(true, option.isDefinedAndNonNull('a'));
+ });
+ });
+
+ describe('#read', function() {
+ it('reads and merges config from a file', function() {
+ var option = new Options({a: true, b: true});
+ option.read(__dirname + '/fixtures/test.conf');
+ assert.strictEqual('foobar', option.value.a);
+ assert.strictEqual(false, option.value.b);
+ });
+
+ it('asynchronously reads and merges config from a file when a callback is passed', function(done) {
+ var option = new Options({a: true, b: true});
+ option.read(__dirname + '/fixtures/test.conf', function(error) {
+ assert.strictEqual('foobar', option.value.a);
+ assert.strictEqual(false, option.value.b);
+ done();
+ });
+ });
+ });
+
+ describe('#reset', function() {
+ it('resets options to defaults', function() {
+ var option = new Options({a: true, b: false});
+ option.merge({b: true});
+ assert.strictEqual(true, option.value.b);
+ option.reset();
+ assert.strictEqual(false, option.value.b);
+ });
+ });
+
+ it('is immutable', function() {
+ var option = new Options({a: true, b: false});
+ option.foo = 2;
+ assert.strictEqual('undefined', typeof option.foo);
+ });
+});
diff --git a/node_modules/ws/node_modules/tinycolor/.npmignore b/node_modules/ws/node_modules/tinycolor/.npmignore
new file mode 100644
index 0000000..6bfffbb
--- /dev/null
+++ b/node_modules/ws/node_modules/tinycolor/.npmignore
@@ -0,0 +1,5 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
diff --git a/node_modules/ws/node_modules/tinycolor/README.md b/node_modules/ws/node_modules/tinycolor/README.md
new file mode 100644
index 0000000..55eb3c1
--- /dev/null
+++ b/node_modules/ws/node_modules/tinycolor/README.md
@@ -0,0 +1,3 @@
+# tinycolor #
+
+This is a no-fuzz, barebone, zero muppetry color module for node.js. \ No newline at end of file
diff --git a/node_modules/ws/node_modules/tinycolor/example.js b/node_modules/ws/node_modules/tinycolor/example.js
new file mode 100644
index 0000000..f754046
--- /dev/null
+++ b/node_modules/ws/node_modules/tinycolor/example.js
@@ -0,0 +1,3 @@
+require('./tinycolor');
+console.log('this should be red and have an underline!'.grey.underline);
+console.log('this should have a blue background!'.bgBlue); \ No newline at end of file
diff --git a/node_modules/ws/node_modules/tinycolor/package.json b/node_modules/ws/node_modules/tinycolor/package.json
new file mode 100644
index 0000000..890d233
--- /dev/null
+++ b/node_modules/ws/node_modules/tinycolor/package.json
@@ -0,0 +1,31 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "tinycolor",
+ "description": "a to-the-point color module for node",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/tinycolor.git"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "main": "tinycolor",
+ "readme": "# tinycolor #\n\nThis is a no-fuzz, barebone, zero muppetry color module for node.js.",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/einaros/tinycolor/issues"
+ },
+ "_id": "tinycolor@0.0.1",
+ "dist": {
+ "shasum": "dc96ac2859b0dcf0a1cb0aec6aaf31d3883c0ecb"
+ },
+ "_from": "tinycolor@0.x",
+ "_resolved": "https://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
+}
diff --git a/node_modules/ws/node_modules/tinycolor/tinycolor.js b/node_modules/ws/node_modules/tinycolor/tinycolor.js
new file mode 100644
index 0000000..36e552c
--- /dev/null
+++ b/node_modules/ws/node_modules/tinycolor/tinycolor.js
@@ -0,0 +1,31 @@
+var styles = {
+ 'bold': ['\033[1m', '\033[22m'],
+ 'italic': ['\033[3m', '\033[23m'],
+ 'underline': ['\033[4m', '\033[24m'],
+ 'inverse': ['\033[7m', '\033[27m'],
+ 'black': ['\033[30m', '\033[39m'],
+ 'red': ['\033[31m', '\033[39m'],
+ 'green': ['\033[32m', '\033[39m'],
+ 'yellow': ['\033[33m', '\033[39m'],
+ 'blue': ['\033[34m', '\033[39m'],
+ 'magenta': ['\033[35m', '\033[39m'],
+ 'cyan': ['\033[36m', '\033[39m'],
+ 'white': ['\033[37m', '\033[39m'],
+ 'default': ['\033[39m', '\033[39m'],
+ 'grey': ['\033[90m', '\033[39m'],
+ 'bgBlack': ['\033[40m', '\033[49m'],
+ 'bgRed': ['\033[41m', '\033[49m'],
+ 'bgGreen': ['\033[42m', '\033[49m'],
+ 'bgYellow': ['\033[43m', '\033[49m'],
+ 'bgBlue': ['\033[44m', '\033[49m'],
+ 'bgMagenta': ['\033[45m', '\033[49m'],
+ 'bgCyan': ['\033[46m', '\033[49m'],
+ 'bgWhite': ['\033[47m', '\033[49m'],
+ 'bgDefault': ['\033[49m', '\033[49m']
+}
+Object.keys(styles).forEach(function(style) {
+ Object.defineProperty(String.prototype, style, {
+ get: function() { return styles[style][0] + this + styles[style][1]; },
+ enumerable: false
+ });
+});
diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json
new file mode 100644
index 0000000..5a1859c
--- /dev/null
+++ b/node_modules/ws/package.json
@@ -0,0 +1,48 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "ws",
+ "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455",
+ "version": "0.4.27",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/ws.git"
+ },
+ "bin": {
+ "wscat": "./bin/wscat"
+ },
+ "scripts": {
+ "test": "make test",
+ "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {
+ "commander": "~0.6.1",
+ "tinycolor": "0.x",
+ "options": ">=0.0.5"
+ },
+ "devDependencies": {
+ "mocha": "~1.2.1",
+ "should": "0.6.x",
+ "expect.js": "0.1.x",
+ "benchmark": "0.3.x",
+ "ansi": "latest"
+ },
+ "browser": "./lib/browser.js",
+ "readme": "[![Build Status](https://secure.travis-ci.org/einaros/ws.png)](http://travis-ci.org/einaros/ws)\n\n# ws: a node.js websocket library #\n\n`ws` is a simple to use websocket implementation, up-to-date against RFC-6455, and [probably the fastest WebSocket library for node.js](http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs).\n\nPasses the quite extensive Autobahn test suite. See http://einaros.github.com/ws for the full reports.\n\nComes with a command line utility, `wscat`, which can either act as a server (--listen), or client (--connect); Use it to debug simple websocket services.\n\n## Protocol support ##\n\n* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. Added to ws version 0.4.2, but server only. Can be disabled by setting the `disableHixie` option to true.)\n* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`, or argument `-p 8` for wscat)\n* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`, or argument `-p 13` for wscat)\n\n_See the echo.websocket.org example below for how to use the `protocolVersion` option._\n\n## Usage ##\n\n### Installing ###\n\n`npm install ws`\n\n### Sending and receiving text data ###\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://www.host.com/path');\nws.on('open', function() {\n ws.send('something');\n});\nws.on('message', function(data, flags) {\n // flags.binary will be set if a binary data is received\n // flags.masked will be set if the data was masked\n});\n```\n\n### Sending binary data ###\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://www.host.com/path');\nws.on('open', function() {\n var array = new Float32Array(5);\n for (var i = 0; i < array.length; ++i) array[i] = i / 2;\n ws.send(array, {binary: true, mask: true});\n});\n```\n\nSetting `mask`, as done for the send options above, will cause the data to be masked according to the websocket protocol. The same option applies for text data.\n\n### Server example ###\n\n```js\nvar WebSocketServer = require('ws').Server\n , wss = new WebSocketServer({port: 8080});\nwss.on('connection', function(ws) {\n ws.on('message', function(message) {\n console.log('received: %s', message);\n });\n ws.send('something');\n});\n```\n\n### Error handling best practices ###\n\n```js\n// If the WebSocket is closed before the following send is attempted\nws.send('something');\n\n// Errors (both immediate and async write errors) can be detected in an optional callback.\n// The callback is also the only way of being notified that data has actually been sent.\nws.send('something', function(error) {\n // if error is null, the send has been completed,\n // otherwise the error object will indicate what failed.\n});\n\n// Immediate errors can also be handled with try/catch-blocks, but **note**\n// that since sends are inherently asynchronous, socket write failures will *not*\n// be captured when this technique is used.\ntry {\n ws.send('something');\n}\ncatch (e) {\n // handle error\n}\n```\n\n### echo.websocket.org demo ###\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 8, origin: 'http://websocket.org'});\nws.on('open', function() {\n console.log('connected');\n ws.send(Date.now().toString(), {mask: true});\n});\nws.on('close', function() {\n console.log('disconnected');\n});\nws.on('message', function(data, flags) {\n console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);\n setTimeout(function() {\n ws.send(Date.now().toString(), {mask: true});\n }, 500);\n});\n```\n\n### wscat against echo.websocket.org ###\n\n $ npm install -g ws\n $ wscat -c ws://echo.websocket.org -p 8\n connected (press CTRL+C to quit)\n > hi there\n < hi there\n > are you a happy parrot?\n < are you a happy parrot?\n\n### Other examples ###\n\nFor a full example with a browser client communicating with a ws server, see the examples folder.\n\nNote that the usage together with Express 3.0 is quite different from Express 2.x. The difference is expressed in the two different serverstats-examples.\n\nOtherwise, see the test cases.\n\n### Running the tests ###\n\n`make test`\n\n## API Docs ##\n\nSee the doc/ directory for Node.js-like docs for the ws classes.\n\n## License ##\n\n(The MIT License)\n\nCopyright (c) 2011 Einar Otto Stangvik &lt;einaros@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/einaros/ws/issues"
+ },
+ "_id": "ws@0.4.27",
+ "dist": {
+ "shasum": "be50a5b1f71c0f2aa3e8ff49f4cf0a45f2d59811"
+ },
+ "_from": "ws@",
+ "_resolved": "https://registry.npmjs.org/ws/-/ws-0.4.27.tgz"
+}
diff --git a/node_modules/ws/src/bufferutil.cc b/node_modules/ws/src/bufferutil.cc
new file mode 100644
index 0000000..866c28b
--- /dev/null
+++ b/node_modules/ws/src/bufferutil.cc
@@ -0,0 +1,115 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+#include <v8.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_object_wrap.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <stdio.h>
+
+using namespace v8;
+using namespace node;
+
+class BufferUtil : public ObjectWrap
+{
+public:
+
+ static void Initialize(v8::Handle<v8::Object> target)
+ {
+ HandleScope scope;
+ Local<FunctionTemplate> t = FunctionTemplate::New(New);
+ t->InstanceTemplate()->SetInternalFieldCount(1);
+ NODE_SET_METHOD(t->GetFunction(), "unmask", BufferUtil::Unmask);
+ NODE_SET_METHOD(t->GetFunction(), "mask", BufferUtil::Mask);
+ NODE_SET_METHOD(t->GetFunction(), "merge", BufferUtil::Merge);
+ target->Set(String::NewSymbol("BufferUtil"), t->GetFunction());
+ }
+
+protected:
+
+ static Handle<Value> New(const Arguments& args)
+ {
+ HandleScope scope;
+ BufferUtil* bufferUtil = new BufferUtil();
+ bufferUtil->Wrap(args.This());
+ return args.This();
+ }
+
+ static Handle<Value> Merge(const Arguments& args)
+ {
+ HandleScope scope;
+ Local<Object> bufferObj = args[0]->ToObject();
+ char* buffer = Buffer::Data(bufferObj);
+ Local<Array> array = Local<Array>::Cast(args[1]);
+ unsigned int arrayLength = array->Length();
+ unsigned int offset = 0;
+ unsigned int i;
+ for (i = 0; i < arrayLength; ++i) {
+ Local<Object> src = array->Get(i)->ToObject();
+ unsigned int length = Buffer::Length(src);
+ memcpy(buffer + offset, Buffer::Data(src), length);
+ offset += length;
+ }
+ return scope.Close(True());
+ }
+
+ static Handle<Value> Unmask(const Arguments& args)
+ {
+ HandleScope scope;
+ Local<Object> buffer_obj = args[0]->ToObject();
+ unsigned int length = Buffer::Length(buffer_obj);
+ Local<Object> mask_obj = args[1]->ToObject();
+ unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj);
+ unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj);
+ unsigned int len32 = length / 4;
+ unsigned int i;
+ for (i = 0; i < len32; ++i) *(from + i) ^= *mask;
+ from += i;
+ switch (length % 4) {
+ case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2];
+ case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1];
+ case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0];
+ case 0:;
+ }
+ return True();
+ }
+
+ static Handle<Value> Mask(const Arguments& args)
+ {
+ HandleScope scope;
+ Local<Object> buffer_obj = args[0]->ToObject();
+ Local<Object> mask_obj = args[1]->ToObject();
+ unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj);
+ Local<Object> output_obj = args[2]->ToObject();
+ unsigned int dataOffset = args[3]->Int32Value();
+ unsigned int length = args[4]->Int32Value();
+ unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset);
+ unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj);
+ unsigned int len32 = length / 4;
+ unsigned int i;
+ for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask;
+ to += i;
+ from += i;
+ switch (length % 4) {
+ case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2);
+ case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1);
+ case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask);
+ case 0:;
+ }
+ return True();
+ }
+};
+
+extern "C" void init (Handle<Object> target)
+{
+ HandleScope scope;
+ BufferUtil::Initialize(target);
+}
+
+NODE_MODULE(bufferutil, init)
diff --git a/node_modules/ws/src/validation.cc b/node_modules/ws/src/validation.cc
new file mode 100644
index 0000000..b900164
--- /dev/null
+++ b/node_modules/ws/src/validation.cc
@@ -0,0 +1,143 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+#include <v8.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_object_wrap.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+using namespace v8;
+using namespace node;
+
+#define UNI_SUR_HIGH_START (uint32_t) 0xD800
+#define UNI_SUR_LOW_END (uint32_t) 0xDFFF
+#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD
+#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF
+
+static const uint8_t trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+static const uint32_t offsetsFromUTF8[6] = {
+ 0x00000000, 0x00003080, 0x000E2080,
+ 0x03C82080, 0xFA082080, 0x82082080
+};
+
+static int isLegalUTF8(const uint8_t *source, const int length)
+{
+ uint8_t a;
+ const uint8_t *srcptr = source+length;
+ switch (length) {
+ default: return 0;
+ /* Everything else falls through when "true"... */
+ /* RFC3629 makes 5 & 6 bytes UTF-8 illegal
+ case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */
+ case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 2: if ((a = (*--srcptr)) > 0xBF) return 0;
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return 0; break;
+ case 0xED: if (a > 0x9F) return 0; break;
+ case 0xF0: if (a < 0x90) return 0; break;
+ case 0xF4: if (a > 0x8F) return 0; break;
+ default: if (a < 0x80) return 0;
+ }
+
+ case 1: if (*source >= 0x80 && *source < 0xC2) return 0;
+ }
+ if (*source > 0xF4) return 0;
+ return 1;
+}
+
+int is_valid_utf8 (size_t len, char *value)
+{
+ /* is the string valid UTF-8? */
+ for (unsigned int i = 0; i < len; i++) {
+ uint32_t ch = 0;
+ uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]];
+
+ if (extrabytes + i >= len)
+ return 0;
+
+ if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0;
+
+ switch (extrabytes) {
+ case 5 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 4 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 3 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 2 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 1 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 0 : ch += (uint8_t) value[i];
+ }
+
+ ch -= offsetsFromUTF8[extrabytes];
+
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END)
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+class Validation : public ObjectWrap
+{
+public:
+
+ static void Initialize(v8::Handle<v8::Object> target)
+ {
+ HandleScope scope;
+ Local<FunctionTemplate> t = FunctionTemplate::New(New);
+ t->InstanceTemplate()->SetInternalFieldCount(1);
+ NODE_SET_METHOD(t->GetFunction(), "isValidUTF8", Validation::IsValidUTF8);
+ target->Set(String::NewSymbol("Validation"), t->GetFunction());
+ }
+
+protected:
+
+ static Handle<Value> New(const Arguments& args)
+ {
+ HandleScope scope;
+ Validation* validation = new Validation();
+ validation->Wrap(args.This());
+ return args.This();
+ }
+
+ static Handle<Value> IsValidUTF8(const Arguments& args)
+ {
+ HandleScope scope;
+ if (!Buffer::HasInstance(args[0])) {
+ return ThrowException(Exception::Error(String::New("First argument needs to be a buffer")));
+ }
+ Local<Object> buffer_obj = args[0]->ToObject();
+ char *buffer_data = Buffer::Data(buffer_obj);
+ size_t buffer_length = Buffer::Length(buffer_obj);
+ return is_valid_utf8(buffer_length, buffer_data) == 1 ? scope.Close(True()) : scope.Close(False());
+ }
+};
+
+extern "C" void init (Handle<Object> target)
+{
+ HandleScope scope;
+ Validation::Initialize(target);
+}
+
+NODE_MODULE(validation, init)
diff --git a/node_modules/ws/test/BufferPool.test.js b/node_modules/ws/test/BufferPool.test.js
new file mode 100644
index 0000000..1ee7ff0
--- /dev/null
+++ b/node_modules/ws/test/BufferPool.test.js
@@ -0,0 +1,63 @@
+var BufferPool = require('../lib/BufferPool');
+require('should');
+
+describe('BufferPool', function() {
+ describe('#ctor', function() {
+ it('allocates pool', function() {
+ var db = new BufferPool(1000);
+ db.size.should.eql(1000);
+ });
+ });
+ describe('#get', function() {
+ it('grows the pool if necessary', function() {
+ var db = new BufferPool(1000);
+ var buf = db.get(2000);
+ db.size.should.be.above(1000);
+ db.used.should.eql(2000);
+ buf.length.should.eql(2000);
+ });
+ it('grows the pool after the first call, if necessary', function() {
+ var db = new BufferPool(1000);
+ var buf = db.get(1000);
+ db.used.should.eql(1000);
+ db.size.should.eql(1000);
+ buf.length.should.eql(1000);
+ var buf2 = db.get(1000);
+ db.used.should.eql(2000);
+ db.size.should.be.above(1000);
+ buf2.length.should.eql(1000);
+ });
+ it('grows the pool according to the growStrategy if necessary', function() {
+ var db = new BufferPool(1000, function(db, length) {
+ return db.size + 2345;
+ });
+ var buf = db.get(2000);
+ db.size.should.eql(3345);
+ buf.length.should.eql(2000);
+ });
+ it('doesnt grow the pool if theres enough room available', function() {
+ var db = new BufferPool(1000);
+ var buf = db.get(1000);
+ db.size.should.eql(1000);
+ buf.length.should.eql(1000);
+ });
+ });
+ describe('#reset', function() {
+ it('shinks the pool', function() {
+ var db = new BufferPool(1000);
+ var buf = db.get(2000);
+ db.reset(true);
+ db.size.should.eql(1000);
+ });
+ it('shrinks the pool according to the shrinkStrategy', function() {
+ var db = new BufferPool(1000, function(db, length) {
+ return db.used + length;
+ }, function(db) {
+ return 0;
+ });
+ var buf = db.get(2000);
+ db.reset(true);
+ db.size.should.eql(0);
+ });
+ });
+});
diff --git a/node_modules/ws/test/Receiver.hixie.test.js b/node_modules/ws/test/Receiver.hixie.test.js
new file mode 100644
index 0000000..043d3bc
--- /dev/null
+++ b/node_modules/ws/test/Receiver.hixie.test.js
@@ -0,0 +1,158 @@
+var assert = require('assert')
+ , expect = require('expect.js')
+ , Receiver = require('../lib/Receiver.hixie');
+require('./hybi-common');
+
+describe('Receiver', function() {
+ it('can parse text message', function() {
+ var p = new Receiver();
+ var packet = '00 48 65 6c 6c 6f ff';
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal('Hello', data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ expect(gotData).to.equal(true);
+ });
+
+ it('can parse multiple text messages', function() {
+ var p = new Receiver();
+ var packet = '00 48 65 6c 6c 6f ff 00 48 65 6c 6c 6f ff';
+
+ var gotData = false;
+ var messages = [];
+ p.ontext = function(data) {
+ gotData = true;
+ messages.push(data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ expect(gotData).to.equal(true);
+ for (var i = 0; i < 2; ++i) {
+ expect(messages[i]).to.equal('Hello');
+ }
+ });
+
+ it('can parse empty message', function() {
+ var p = new Receiver();
+ var packet = '00 ff';
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal('', data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ expect(gotData).to.equal(true);
+ });
+
+ it('can parse text messages delivered over multiple frames', function() {
+ var p = new Receiver();
+ var packets = [
+ '00 48',
+ '65 6c 6c',
+ '6f ff 00 48',
+ '65',
+ '6c 6c 6f',
+ 'ff'
+ ];
+
+ var gotData = false;
+ var messages = [];
+ p.ontext = function(data) {
+ gotData = true;
+ messages.push(data);
+ };
+
+ for (var i = 0; i < packets.length; ++i) {
+ p.add(getBufferFromHexString(packets[i]));
+ }
+ expect(gotData).to.equal(true);
+ for (var i = 0; i < 2; ++i) {
+ expect(messages[i]).to.equal('Hello');
+ }
+ });
+
+ it('emits an error if a payload doesnt start with 0x00', function() {
+ var p = new Receiver();
+ var packets = [
+ '00 6c ff',
+ '00 6c ff ff',
+ 'ff 00 6c ff 00 6c ff',
+ '00',
+ '6c 6c 6f',
+ 'ff'
+ ];
+
+ var gotData = false;
+ var gotError = false;
+ var messages = [];
+ p.ontext = function(data) {
+ gotData = true;
+ messages.push(data);
+ };
+ p.onerror = function(reason, code) {
+ gotError = code == true;
+ };
+
+ for (var i = 0; i < packets.length && !gotError; ++i) {
+ p.add(getBufferFromHexString(packets[i]));
+ }
+ expect(gotError).to.equal(true);
+ expect(messages[0]).to.equal('l');
+ expect(messages[1]).to.equal('l');
+ expect(messages.length).to.equal(2);
+ });
+
+ it('can parse close messages', function() {
+ var p = new Receiver();
+ var packets = [
+ 'ff 00'
+ ];
+
+ var gotClose = false;
+ var gotError = false;
+ p.onclose = function() {
+ gotClose = true;
+ };
+ p.onerror = function(reason, code) {
+ gotError = code == true;
+ };
+
+ for (var i = 0; i < packets.length && !gotError; ++i) {
+ p.add(getBufferFromHexString(packets[i]));
+ }
+ expect(gotClose).to.equal(true);
+ expect(gotError).to.equal(false);
+ });
+
+ it('can parse binary messages delivered over multiple frames', function() {
+ var p = new Receiver();
+ var packets = [
+ '80 05 48',
+ '65 6c 6c',
+ '6f 80 80 05 48',
+ '65',
+ '6c 6c 6f'
+ ];
+
+ var gotData = false;
+ var messages = [];
+ p.ontext = function(data) {
+ gotData = true;
+ messages.push(data);
+ };
+
+ for (var i = 0; i < packets.length; ++i) {
+ p.add(getBufferFromHexString(packets[i]));
+ }
+ expect(gotData).to.equal(true);
+ for (var i = 0; i < 2; ++i) {
+ expect(messages[i]).to.equal('Hello');
+ }
+ });
+});
diff --git a/node_modules/ws/test/Receiver.test.js b/node_modules/ws/test/Receiver.test.js
new file mode 100644
index 0000000..b0b5c0a
--- /dev/null
+++ b/node_modules/ws/test/Receiver.test.js
@@ -0,0 +1,255 @@
+var assert = require('assert')
+ , Receiver = require('../lib/Receiver');
+require('should');
+require('./hybi-common');
+
+describe('Receiver', function() {
+ it('can parse unmasked text message', function() {
+ var p = new Receiver();
+ var packet = '81 05 48 65 6c 6c 6f';
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal('Hello', data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse close message', function() {
+ var p = new Receiver();
+ var packet = '88 00';
+
+ var gotClose = false;
+ p.onclose = function(data) {
+ gotClose = true;
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotClose.should.be.ok;
+ });
+ it('can parse masked text message', function() {
+ var p = new Receiver();
+ var packet = '81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5';
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal('5:::{"name":"echo"}', data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a masked text message longer than 125 bytes', function() {
+ var p = new Receiver();
+ var message = 'A';
+ for (var i = 0; i < 300; ++i) message += (i % 5).toString();
+ var packet = '81 FE ' + pack(4, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal(message, data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a really long masked text message', function() {
+ var p = new Receiver();
+ var message = 'A';
+ for (var i = 0; i < 64*1024; ++i) message += (i % 5).toString();
+ var packet = '81 FF ' + pack(16, message.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal(message, data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a fragmented masked text message of 300 bytes', function() {
+ var p = new Receiver();
+ var message = 'A';
+ for (var i = 0; i < 300; ++i) message += (i % 5).toString();
+ var msgpiece1 = message.substr(0, 150);
+ var msgpiece2 = message.substr(150);
+ var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68'));
+ var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68'));
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal(message, data);
+ };
+
+ p.add(getBufferFromHexString(packet1));
+ p.add(getBufferFromHexString(packet2));
+ gotData.should.be.ok;
+ });
+ it('can parse a ping message', function() {
+ var p = new Receiver();
+ var message = 'Hello';
+ var packet = '89 ' + getHybiLengthAsHexString(message.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotPing = false;
+ p.onping = function(data) {
+ gotPing = true;
+ assert.equal(message, data);
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotPing.should.be.ok;
+ });
+ it('can parse a ping with no data', function() {
+ var p = new Receiver();
+ var packet = '89 00';
+
+ var gotPing = false;
+ p.onping = function(data) {
+ gotPing = true;
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotPing.should.be.ok;
+ });
+ it('can parse a fragmented masked text message of 300 bytes with a ping in the middle', function() {
+ var p = new Receiver();
+ var message = 'A';
+ for (var i = 0; i < 300; ++i) message += (i % 5).toString();
+
+ var msgpiece1 = message.substr(0, 150);
+ var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68'));
+
+ var pingMessage = 'Hello';
+ var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68'));
+
+ var msgpiece2 = message.substr(150);
+ var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68'));
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal(message, data);
+ };
+ var gotPing = false;
+ p.onping = function(data) {
+ gotPing = true;
+ assert.equal(pingMessage, data);
+ };
+
+ p.add(getBufferFromHexString(packet1));
+ p.add(getBufferFromHexString(pingPacket));
+ p.add(getBufferFromHexString(packet2));
+ gotData.should.be.ok;
+ gotPing.should.be.ok;
+ });
+ it('can parse a fragmented masked text message of 300 bytes with a ping in the middle, which is delievered over sevaral tcp packets', function() {
+ var p = new Receiver();
+ var message = 'A';
+ for (var i = 0; i < 300; ++i) message += (i % 5).toString();
+
+ var msgpiece1 = message.substr(0, 150);
+ var packet1 = '01 FE ' + pack(4, msgpiece1.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece1, '34 83 a8 68'));
+
+ var pingMessage = 'Hello';
+ var pingPacket = '89 ' + getHybiLengthAsHexString(pingMessage.length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68'));
+
+ var msgpiece2 = message.substr(150);
+ var packet2 = '80 FE ' + pack(4, msgpiece2.length) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(msgpiece2, '34 83 a8 68'));
+
+ var gotData = false;
+ p.ontext = function(data) {
+ gotData = true;
+ assert.equal(message, data);
+ };
+ var gotPing = false;
+ p.onping = function(data) {
+ gotPing = true;
+ assert.equal(pingMessage, data);
+ };
+
+ var buffers = [];
+ buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet1)));
+ buffers = buffers.concat(splitBuffer(getBufferFromHexString(pingPacket)));
+ buffers = buffers.concat(splitBuffer(getBufferFromHexString(packet2)));
+ for (var i = 0; i < buffers.length; ++i) {
+ p.add(buffers[i]);
+ }
+ gotData.should.be.ok;
+ gotPing.should.be.ok;
+ });
+ it('can parse a 100 byte long masked binary message', function() {
+ var p = new Receiver();
+ var length = 100;
+ var message = new Buffer(length);
+ for (var i = 0; i < length; ++i) message[i] = i % 256;
+ var originalMessage = getHexStringFromBuffer(message);
+ var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotData = false;
+ p.onbinary = function(data) {
+ gotData = true;
+ assert.equal(originalMessage, getHexStringFromBuffer(data));
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a 256 byte long masked binary message', function() {
+ var p = new Receiver();
+ var length = 256;
+ var message = new Buffer(length);
+ for (var i = 0; i < length; ++i) message[i] = i % 256;
+ var originalMessage = getHexStringFromBuffer(message);
+ var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotData = false;
+ p.onbinary = function(data) {
+ gotData = true;
+ assert.equal(originalMessage, getHexStringFromBuffer(data));
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a 200kb long masked binary message', function() {
+ var p = new Receiver();
+ var length = 200 * 1024;
+ var message = new Buffer(length);
+ for (var i = 0; i < length; ++i) message[i] = i % 256;
+ var originalMessage = getHexStringFromBuffer(message);
+ var packet = '82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' + getHexStringFromBuffer(mask(message, '34 83 a8 68'));
+
+ var gotData = false;
+ p.onbinary = function(data) {
+ gotData = true;
+ assert.equal(originalMessage, getHexStringFromBuffer(data));
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+ it('can parse a 200kb long unmasked binary message', function() {
+ var p = new Receiver();
+ var length = 200 * 1024;
+ var message = new Buffer(length);
+ for (var i = 0; i < length; ++i) message[i] = i % 256;
+ var originalMessage = getHexStringFromBuffer(message);
+ var packet = '82 ' + getHybiLengthAsHexString(length, false) + ' ' + getHexStringFromBuffer(message);
+
+ var gotData = false;
+ p.onbinary = function(data) {
+ gotData = true;
+ assert.equal(originalMessage, getHexStringFromBuffer(data));
+ };
+
+ p.add(getBufferFromHexString(packet));
+ gotData.should.be.ok;
+ });
+});
+
diff --git a/node_modules/ws/test/Sender.hixie.test.js b/node_modules/ws/test/Sender.hixie.test.js
new file mode 100644
index 0000000..783f892
--- /dev/null
+++ b/node_modules/ws/test/Sender.hixie.test.js
@@ -0,0 +1,134 @@
+var assert = require('assert')
+ , Sender = require('../lib/Sender.hixie');
+require('should');
+require('./hybi-common');
+
+describe('Sender', function() {
+ describe('#send', function() {
+ it('frames and sends a text message', function(done) {
+ var message = 'Hello world';
+ var received;
+ var socket = {
+ write: function(data, encoding, cb) {
+ received = data;
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send(message, {}, function() {
+ received.toString('utf8').should.eql('\u0000' + message + '\ufffd');
+ done();
+ });
+ });
+
+ it('frames and sends an empty message', function(done) {
+ var socket = {
+ write: function(data, encoding, cb) {
+ done();
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send('', {}, function() {});
+ });
+
+ it('frames and sends a buffer', function(done) {
+ var received;
+ var socket = {
+ write: function(data, encoding, cb) {
+ received = data;
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send(new Buffer('foobar'), {}, function() {
+ received.toString('utf8').should.eql('\u0000foobar\ufffd');
+ done();
+ });
+ });
+
+ it('frames and sends a binary message', function(done) {
+ var message = 'Hello world';
+ var received;
+ var socket = {
+ write: function(data, encoding, cb) {
+ received = data;
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send(message, {binary: true}, function() {
+ received.toString('hex').should.eql(
+ // 0x80 0x0b H e l l o <sp> w o r l d
+ '800b48656c6c6f20776f726c64');
+ done();
+ });
+ });
+/*
+ it('throws an exception for binary data', function(done) {
+ var socket = {
+ write: function(data, encoding, cb) {
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.on('error', function() {
+ done();
+ });
+ sender.send(new Buffer(100), {binary: true}, function() {});
+ });
+*/
+ it('can fauxe stream data', function(done) {
+ var received = [];
+ var socket = {
+ write: function(data, encoding, cb) {
+ received.push(data);
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send(new Buffer('foobar'), { fin: false }, function() {});
+ sender.send('bazbar', { fin: false }, function() {});
+ sender.send(new Buffer('end'), { fin: true }, function() {
+ received[0].toString('utf8').should.eql('\u0000foobar');
+ received[1].toString('utf8').should.eql('bazbar');
+ received[2].toString('utf8').should.eql('end\ufffd');
+ done();
+ });
+ });
+ });
+
+ describe('#close', function() {
+ it('sends a hixie close frame', function(done) {
+ var received;
+ var socket = {
+ write: function(data, encoding, cb) {
+ received = data;
+ process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.close(null, null, null, function() {
+ received.toString('utf8').should.eql('\ufffd\u0000');
+ done();
+ });
+ });
+
+ it('sends a message end marker if fauxe streaming has started, before hixie close frame', function(done) {
+ var received = [];
+ var socket = {
+ write: function(data, encoding, cb) {
+ received.push(data);
+ if (cb) process.nextTick(cb);
+ }
+ };
+ var sender = new Sender(socket, {});
+ sender.send(new Buffer('foobar'), { fin: false }, function() {});
+ sender.close(null, null, null, function() {
+ received[0].toString('utf8').should.eql('\u0000foobar');
+ received[1].toString('utf8').should.eql('\ufffd');
+ received[2].toString('utf8').should.eql('\ufffd\u0000');
+ done();
+ });
+ });
+ });
+});
diff --git a/node_modules/ws/test/Sender.test.js b/node_modules/ws/test/Sender.test.js
new file mode 100644
index 0000000..43b4864
--- /dev/null
+++ b/node_modules/ws/test/Sender.test.js
@@ -0,0 +1,24 @@
+var Sender = require('../lib/Sender');
+require('should');
+
+describe('Sender', function() {
+ describe('#frameAndSend', function() {
+ it('does not modify a masked binary buffer', function() {
+ var sender = new Sender({ write: function() {} });
+ var buf = new Buffer([1, 2, 3, 4, 5]);
+ sender.frameAndSend(2, buf, true, true);
+ buf[0].should.eql(1);
+ buf[1].should.eql(2);
+ buf[2].should.eql(3);
+ buf[3].should.eql(4);
+ buf[4].should.eql(5);
+ });
+
+ it('does not modify a masked text buffer', function() {
+ var sender = new Sender({ write: function() {} });
+ var text = 'hi there';
+ sender.frameAndSend(1, text, true, true);
+ text.should.eql('hi there');
+ });
+ });
+});
diff --git a/node_modules/ws/test/Validation.test.js b/node_modules/ws/test/Validation.test.js
new file mode 100644
index 0000000..37c3399
--- /dev/null
+++ b/node_modules/ws/test/Validation.test.js
@@ -0,0 +1,23 @@
+var Validation = require('../lib/Validation').Validation;
+require('should');
+
+describe('Validation', function() {
+ describe('isValidUTF8', function() {
+ it('should return true for a valid utf8 string', function() {
+ var validBuffer = new Buffer('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque gravida mattis rhoncus. Donec iaculis, metus quis varius accumsan, erat mauris condimentum diam, et egestas erat enim ut ligula. Praesent sollicitudin tellus eget dolor euismod euismod. Nullam ac augue nec neque varius luctus. Curabitur elit mi, consequat ultricies adipiscing mollis, scelerisque in erat. Phasellus facilisis fermentum ullamcorper. Nulla et sem eu arcu pharetra pellentesque. Praesent consectetur tempor justo, vel iaculis dui ullamcorper sit amet. Integer tristique viverra ullamcorper. Vivamus laoreet, nulla eget suscipit eleifend, lacus lectus feugiat libero, non fermentum erat nisi at risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pulvinar dignissim tellus, eu dignissim lorem vulputate quis. Morbi ut pulvinar augue.');
+ Validation.isValidUTF8(validBuffer).should.be.ok;
+ });
+ it('should return false for an erroneous string', function() {
+ var invalidBuffer = new Buffer([0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0xed, 0xa0, 0x80, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64]);
+ Validation.isValidUTF8(invalidBuffer).should.not.be.ok;
+ });
+ it('should return true for valid cases from the autobahn test suite', function() {
+ Validation.isValidUTF8(new Buffer('\xf0\x90\x80\x80')).should.be.ok;
+ Validation.isValidUTF8(new Buffer([0xf0, 0x90, 0x80, 0x80])).should.be.ok;
+ });
+ it('should return false for erroneous autobahn strings', function() {
+ Validation.isValidUTF8(new Buffer([0xce, 0xba, 0xe1, 0xbd])).should.not.be.ok;
+ });
+ });
+});
+
diff --git a/node_modules/ws/test/WebSocket.integration.js b/node_modules/ws/test/WebSocket.integration.js
new file mode 100644
index 0000000..51a7e3a
--- /dev/null
+++ b/node_modules/ws/test/WebSocket.integration.js
@@ -0,0 +1,42 @@
+var assert = require('assert')
+ , WebSocket = require('../')
+ , server = require('./testserver');
+
+var port = 20000;
+
+function getArrayBuffer(buf) {
+ var l = buf.length;
+ var arrayBuf = new ArrayBuffer(l);
+ for (var i = 0; i < l; ++i) {
+ arrayBuf[i] = buf[i];
+ }
+ return arrayBuf;
+}
+
+function areArraysEqual(x, y) {
+ if (x.length != y.length) return false;
+ for (var i = 0, l = x.length; i < l; ++i) {
+ if (x[i] !== y[i]) return false;
+ }
+ return true;
+}
+
+describe('WebSocket', function() {
+ it('communicates successfully with echo service', function(done) {
+ var ws = new WebSocket('ws://echo.websocket.org', {protocolVersion: 8, origin: 'http://websocket.org'});
+ var str = Date.now().toString();
+ var dataReceived = false;
+ ws.on('open', function() {
+ ws.send(str, {mask: true});
+ });
+ ws.on('close', function() {
+ assert.equal(true, dataReceived);
+ done();
+ });
+ ws.on('message', function(data, flags) {
+ assert.equal(str, data);
+ ws.terminate();
+ dataReceived = true;
+ });
+ });
+}); \ No newline at end of file
diff --git a/node_modules/ws/test/WebSocket.test.js b/node_modules/ws/test/WebSocket.test.js
new file mode 100644
index 0000000..93e95da
--- /dev/null
+++ b/node_modules/ws/test/WebSocket.test.js
@@ -0,0 +1,1609 @@
+var assert = require('assert')
+ , https = require('https')
+ , http = require('http')
+ , should = require('should')
+ , WebSocket = require('../')
+ , WebSocketServer = require('../').Server
+ , fs = require('fs')
+ , server = require('./testserver')
+ , crypto = require('crypto');
+
+var port = 20000;
+
+function getArrayBuffer(buf) {
+ var l = buf.length;
+ var arrayBuf = new ArrayBuffer(l);
+ for (var i = 0; i < l; ++i) {
+ arrayBuf[i] = buf[i];
+ }
+ return arrayBuf;
+}
+
+function areArraysEqual(x, y) {
+ if (x.length != y.length) return false;
+ for (var i = 0, l = x.length; i < l; ++i) {
+ if (x[i] !== y[i]) return false;
+ }
+ return true;
+}
+
+describe('WebSocket', function() {
+ describe('#ctor', function() {
+ it('throws exception for invalid url', function(done) {
+ try {
+ var ws = new WebSocket('echo.websocket.org');
+ }
+ catch (e) {
+ done();
+ }
+ });
+ });
+
+ describe('properties', function() {
+ it('#bytesReceived exposes number of bytes received', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('message', function() {
+ ws.bytesReceived.should.eql(8);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ ws.send('foobar');
+ });
+ });
+
+ it('#url exposes the server url', function(done) {
+ server.createServer(++port, function(srv) {
+ var url = 'ws://localhost:' + port;
+ var ws = new WebSocket(url);
+ assert.equal(url, ws.url);
+ ws.terminate();
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('#protocolVersion exposes the protocol version', function(done) {
+ server.createServer(++port, function(srv) {
+ var url = 'ws://localhost:' + port;
+ var ws = new WebSocket(url);
+ assert.equal(13, ws.protocolVersion);
+ ws.terminate();
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ describe('#bufferedAmount', function() {
+ it('defaults to zero', function(done) {
+ server.createServer(++port, function(srv) {
+ var url = 'ws://localhost:' + port;
+ var ws = new WebSocket(url);
+ assert.equal(0, ws.bufferedAmount);
+ ws.terminate();
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('stress kernel write buffer', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(ws) {
+ while (true) {
+ if (ws.bufferedAmount > 0) break;
+ ws.send((new Array(10000)).join('hello'));
+ }
+ ws.terminate();
+ ws.on('close', function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#readyState', function() {
+ it('defaults to connecting', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ assert.equal(WebSocket.CONNECTING, ws.readyState);
+ ws.terminate();
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('set to open once connection is established', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ assert.equal(WebSocket.OPEN, ws.readyState);
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('set to closed once connection is closed', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.close(1001);
+ ws.on('close', function() {
+ assert.equal(WebSocket.CLOSED, ws.readyState);
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('set to closed once connection is terminated', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.terminate();
+ ws.on('close', function() {
+ assert.equal(WebSocket.CLOSED, ws.readyState);
+ srv.close();
+ done();
+ });
+ });
+ });
+ });
+
+ /*
+ * Ready state constants
+ */
+
+ var readyStates = {
+ CONNECTING: 0,
+ OPEN: 1,
+ CLOSING: 2,
+ CLOSED: 3
+ };
+
+ /*
+ * Ready state constant tests
+ */
+
+ Object.keys(readyStates).forEach(function(state) {
+ describe('.' + state, function() {
+ it('is enumerable property of class', function() {
+ var propertyDescripter = Object.getOwnPropertyDescriptor(WebSocket, state)
+ assert.equal(readyStates[state], propertyDescripter.value);
+ assert.equal(true, propertyDescripter.enumerable);
+ });
+ });
+ });
+
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ Object.keys(readyStates).forEach(function(state) {
+ describe('.' + state, function() {
+ it('is property of instance', function() {
+ assert.equal(readyStates[state], ws[state]);
+ });
+ });
+ });
+ });
+ });
+
+ describe('events', function() {
+ it('emits a ping event', function(done) {
+ var wss = new WebSocketServer({port: ++port});
+ wss.on('connection', function(client) {
+ client.ping();
+ });
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('ping', function() {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+
+ it('emits a pong event', function(done) {
+ var wss = new WebSocketServer({port: ++port});
+ wss.on('connection', function(client) {
+ client.pong();
+ });
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('pong', function() {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ describe('connection establishing', function() {
+ it('can disconnect before connection is established', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.terminate();
+ ws.on('open', function() {
+ assert.fail('connect shouldnt be raised here');
+ });
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('can close before connection is established', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.close(1001);
+ ws.on('open', function() {
+ assert.fail('connect shouldnt be raised here');
+ });
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('invalid server key is denied', function(done) {
+ server.createServer(++port, server.handlers.invalidKey, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('close event is raised when server closes connection', function(done) {
+ server.createServer(++port, server.handlers.closeAfterConnect, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('close', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('error is emitted if server aborts connection', function(done) {
+ server.createServer(++port, server.handlers.return401, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ assert.fail('connect shouldnt be raised here');
+ });
+ ws.on('error', function() {
+ srv.close();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#pause and #resume', function() {
+ it('pauses the underlying stream', function(done) {
+ // this test is sort-of racecondition'y, since an unlikely slow connection
+ // to localhost can cause the test to succeed even when the stream pausing
+ // isn't working as intended. that is an extremely unlikely scenario, though
+ // and an acceptable risk for the test.
+ var client;
+ var serverClient;
+ var openCount = 0;
+ function onOpen() {
+ if (++openCount == 2) {
+ var paused = true;
+ serverClient.on('message', function() {
+ paused.should.not.be.ok;
+ wss.close();
+ done();
+ });
+ serverClient.pause();
+ setTimeout(function() {
+ paused = false;
+ serverClient.resume();
+ }, 200);
+ client.send('foo');
+ }
+ }
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ serverClient = ws;
+ serverClient.on('open', onOpen);
+ });
+ wss.on('connection', function(ws) {
+ client = ws;
+ onOpen();
+ });
+ });
+ });
+
+ describe('#ping', function() {
+ it('before connect should fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ try {
+ ws.ping();
+ }
+ catch (e) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+
+ it('before connect can silently fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ ws.ping('', {}, true);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+
+ it('without message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.ping();
+ });
+ srv.on('ping', function(message) {
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.ping('hi');
+ });
+ srv.on('ping', function(message) {
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with encoded message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.ping('hi', {mask: true});
+ });
+ srv.on('ping', function(message, flags) {
+ assert.ok(flags.masked);
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#pong', function() {
+ it('before connect should fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ try {
+ ws.pong();
+ }
+ catch (e) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+
+ it('before connect can silently fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ ws.pong('', {}, true);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+
+ it('without message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.pong();
+ });
+ srv.on('pong', function(message) {
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.pong('hi');
+ });
+ srv.on('pong', function(message) {
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with encoded message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.pong('hi', {mask: true});
+ });
+ srv.on('pong', function(message, flags) {
+ assert.ok(flags.masked);
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('#send', function() {
+ it('very long binary data can be sent and received (with echoing server)', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var array = new Float32Array(5 * 1024 * 1024);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 5;
+ ws.on('open', function() {
+ ws.send(array, {binary: true});
+ });
+ ws.on('message', function(message, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message))));
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('can send and receive text data', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.send('hi');
+ });
+ ws.on('message', function(message, flags) {
+ assert.equal('hi', message);
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('send and receive binary data as an array', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.on('open', function() {
+ ws.send(array, {binary: true});
+ });
+ ws.on('message', function(message, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message))));
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('binary data can be sent and received as buffer', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var buf = new Buffer('foobar');
+ ws.on('open', function() {
+ ws.send(buf, {binary: true});
+ });
+ ws.on('message', function(message, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(buf, message));
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('ArrayBuffer is auto-detected without binary flag', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.on('open', function() {
+ ws.send(array.buffer);
+ });
+ ws.onmessage = function (event) {
+ assert.ok(event.type = 'Binary');
+ assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(event.data))));
+ ws.terminate();
+ srv.close();
+ done();
+ };
+ });
+ });
+
+ it('Buffer is auto-detected without binary flag', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var buf = new Buffer('foobar');
+ ws.on('open', function() {
+ ws.send(buf);
+ });
+ ws.onmessage = function (event) {
+ assert.ok(event.type = 'Binary');
+ assert.ok(areArraysEqual(event.data, buf));
+ ws.terminate();
+ srv.close();
+ done();
+ };
+ });
+ });
+
+ it('before connect should fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ try {
+ ws.send('hi');
+ }
+ catch (e) {
+ ws.terminate();
+ srv.close();
+ done();
+ }
+ });
+ });
+
+ it('before connect should pass error through callback, if present', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ ws.send('hi', function(error) {
+ assert.ok(error instanceof Error);
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('without data should be successful', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.send();
+ });
+ srv.on('message', function(message, flags) {
+ assert.equal('', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('calls optional callback when flushed', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.send('hi', function() {
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+ });
+
+ it('with unencoded message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.send('hi');
+ });
+ srv.on('message', function(message, flags) {
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with encoded message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.send('hi', {mask: true});
+ });
+ srv.on('message', function(message, flags) {
+ assert.ok(flags.masked);
+ assert.equal('hi', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with unencoded binary message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.on('open', function() {
+ ws.send(array, {binary: true});
+ });
+ srv.on('message', function(message, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message))));
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with encoded binary message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.on('open', function() {
+ ws.send(array, {mask: true, binary: true});
+ });
+ srv.on('message', function(message, flags) {
+ assert.ok(flags.binary);
+ assert.ok(flags.masked);
+ assert.ok(areArraysEqual(array, new Float32Array(getArrayBuffer(message))));
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with binary stream will send fragmented data', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var callbackFired = false;
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream, {binary: true}, function(error) {
+ assert.equal(null, error);
+ callbackFired = true;
+ });
+ });
+ srv.on('message', function(data, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile'), data));
+ ws.terminate();
+ });
+ ws.on('close', function() {
+ assert.ok(callbackFired);
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('with text stream will send fragmented data', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var callbackFired = false;
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream, {binary: false}, function(error) {
+ assert.equal(null, error);
+ callbackFired = true;
+ });
+ });
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ ws.terminate();
+ });
+ ws.on('close', function() {
+ assert.ok(callbackFired);
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('will cause intermittent send to be delayed in order', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream);
+ ws.send('foobar');
+ ws.send('baz');
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ ++receivedIndex;
+ if (receivedIndex == 1) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ }
+ else if (receivedIndex == 2) {
+ assert.ok(!flags.binary);
+ assert.equal('foobar', data);
+ }
+ else {
+ assert.ok(!flags.binary);
+ assert.equal('baz', data);
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent stream to be delayed in order', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream);
+ var i = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i == 1) send('foo');
+ else send('bar', true);
+ });
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ ++receivedIndex;
+ if (receivedIndex == 1) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ }
+ else if (receivedIndex == 2) {
+ assert.ok(!flags.binary);
+ assert.equal('foobar', data);
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent ping to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream);
+ ws.ping('foobar');
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ srv.on('ping', function(data) {
+ assert.equal('foobar', data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent pong to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream);
+ ws.pong('foobar');
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ srv.on('pong', function(data) {
+ assert.equal('foobar', data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent close to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream);
+ ws.close(1000, 'foobar');
+ });
+ ws.on('close', function() {
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ ws.on('error', function() { /* That's quite alright -- a send was attempted after close */ });
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.ok(areArraysEqual(fs.readFileSync('test/fixtures/textfile', 'utf8'), data));
+ });
+ srv.on('close', function(code, data) {
+ assert.equal(1000, code);
+ assert.equal('foobar', data);
+ });
+ });
+ });
+ });
+
+ describe('#stream', function() {
+ it('very long binary data can be streamed', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var buffer = new Buffer(10 * 1024);
+ for (var i = 0; i < buffer.length; ++i) buffer[i] = i % 0xff;
+ ws.on('open', function() {
+ var i = 0;
+ var blockSize = 800;
+ var bufLen = buffer.length;
+ ws.stream({binary: true}, function(error, send) {
+ assert.ok(!error);
+ var start = i * blockSize;
+ var toSend = Math.min(blockSize, bufLen - (i * blockSize));
+ var end = start + toSend;
+ var isFinal = toSend < blockSize;
+ send(buffer.slice(start, end), isFinal);
+ i += 1;
+ });
+ });
+ srv.on('message', function(data, flags) {
+ assert.ok(flags.binary);
+ assert.ok(areArraysEqual(buffer, data));
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('before connect should pass error through callback', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {});
+ ws.stream(function(error) {
+ assert.ok(error instanceof Error);
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('without callback should fail', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ ws.on('open', function() {
+ try {
+ ws.stream();
+ }
+ catch (e) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent send to be delayed in order', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ ws.on('open', function() {
+ var i = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i == 1) {
+ send(payload.substr(0, 5));
+ ws.send('foobar');
+ ws.send('baz');
+ }
+ else {
+ send(payload.substr(5, 5), true);
+ }
+ });
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ ++receivedIndex;
+ if (receivedIndex == 1) {
+ assert.ok(!flags.binary);
+ assert.equal(payload, data);
+ }
+ else if (receivedIndex == 2) {
+ assert.ok(!flags.binary);
+ assert.equal('foobar', data);
+ }
+ else {
+ assert.ok(!flags.binary);
+ assert.equal('baz', data);
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent stream to be delayed in order', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ ws.on('open', function() {
+ var i = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i == 1) {
+ send(payload.substr(0, 5));
+ var i2 = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i2 == 1) send('foo');
+ else send('bar', true);
+ });
+ ws.send('baz');
+ }
+ else send(payload.substr(5, 5), true);
+ });
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ ++receivedIndex;
+ if (receivedIndex == 1) {
+ assert.ok(!flags.binary);
+ assert.equal(payload, data);
+ }
+ else if (receivedIndex == 2) {
+ assert.ok(!flags.binary);
+ assert.equal('foobar', data);
+ }
+ else if (receivedIndex == 3){
+ assert.ok(!flags.binary);
+ assert.equal('baz', data);
+ setTimeout(function() {
+ srv.close();
+ ws.terminate();
+ done();
+ }, 1000);
+ }
+ else throw new Error('more messages than we actually sent just arrived');
+ });
+ });
+ });
+
+ it('will cause intermittent ping to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ ws.on('open', function() {
+ var i = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i == 1) {
+ send(payload.substr(0, 5));
+ ws.ping('foobar');
+ }
+ else {
+ send(payload.substr(5, 5), true);
+ }
+ });
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.equal(payload, data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ srv.on('ping', function(data) {
+ assert.equal('foobar', data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent pong to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ ws.on('open', function() {
+ var i = 0;
+ ws.stream(function(error, send) {
+ assert.ok(!error);
+ if (++i == 1) {
+ send(payload.substr(0, 5));
+ ws.pong('foobar');
+ }
+ else {
+ send(payload.substr(5, 5), true);
+ }
+ });
+ });
+ var receivedIndex = 0;
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.equal(payload, data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ srv.on('pong', function(data) {
+ assert.equal('foobar', data);
+ if (++receivedIndex == 2) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('will cause intermittent close to be delivered', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var payload = 'HelloWorld';
+ var errorGiven = false;
+ ws.on('open', function() {
+ var i = 0;
+ ws.stream(function(error, send) {
+ if (++i == 1) {
+ send(payload.substr(0, 5));
+ ws.close(1000, 'foobar');
+ }
+ else if(i == 2) {
+ send(payload.substr(5, 5), true);
+ }
+ else if (i == 3) {
+ assert.ok(error);
+ errorGiven = true;
+ }
+ });
+ });
+ ws.on('close', function() {
+ assert.ok(errorGiven);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ srv.on('message', function(data, flags) {
+ assert.ok(!flags.binary);
+ assert.equal(payload, data);
+ });
+ srv.on('close', function(code, data) {
+ assert.equal(1000, code);
+ assert.equal('foobar', data);
+ });
+ });
+ });
+ });
+
+ describe('#close', function() {
+ it('will raise error callback, if any, if called during send stream', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var errorGiven = false;
+ ws.on('open', function() {
+ var fileStream = fs.createReadStream('test/fixtures/textfile');
+ fileStream.setEncoding('utf8');
+ fileStream.bufferSize = 100;
+ ws.send(fileStream, function(error) {
+ errorGiven = error != null;
+ });
+ ws.close(1000, 'foobar');
+ });
+ ws.on('close', function() {
+ setTimeout(function() {
+ assert.ok(errorGiven);
+ srv.close();
+ ws.terminate();
+ done();
+ }, 1000);
+ });
+ });
+ });
+
+ it('without invalid first argument throws exception', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ try {
+ ws.close('error');
+ }
+ catch (e) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('without reserved error code 1004 throws exception', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ try {
+ ws.close(1004);
+ }
+ catch (e) {
+ srv.close();
+ ws.terminate();
+ done();
+ }
+ });
+ });
+ });
+
+ it('without message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.close(1000);
+ });
+ srv.on('close', function(code, message, flags) {
+ assert.equal('', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.close(1000, 'some reason');
+ });
+ srv.on('close', function(code, message, flags) {
+ assert.ok(flags.masked);
+ assert.equal('some reason', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('with encoded message is successfully transmitted to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('open', function() {
+ ws.close(1000, 'some reason', {mask: true});
+ });
+ srv.on('close', function(code, message, flags) {
+ assert.ok(flags.masked);
+ assert.equal('some reason', message);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+
+ it('ends connection to the server', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var connectedOnce = false;
+ ws.on('open', function() {
+ connectedOnce = true;
+ ws.close(1000, 'some reason', {mask: true});
+ });
+ ws.on('close', function() {
+ assert.ok(connectedOnce);
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('W3C API emulation', function() {
+ it('should not throw errors when getting and setting', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var listener = function () {};
+
+ ws.onmessage = listener;
+ ws.onerror = listener;
+ ws.onclose = listener;
+ ws.onopen = listener;
+
+ assert.ok(ws.onopen === listener);
+ assert.ok(ws.onmessage === listener);
+ assert.ok(ws.onclose === listener);
+ assert.ok(ws.onerror === listener);
+
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+
+ it('should work the same as the EventEmitter api', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ var listener = function() {};
+ var message = 0;
+ var close = 0;
+ var open = 0;
+
+ ws.onmessage = function(messageEvent) {
+ assert.ok(!!messageEvent.data);
+ ++message;
+ ws.close();
+ };
+
+ ws.onopen = function() {
+ ++open;
+ }
+
+ ws.onclose = function() {
+ ++close;
+ }
+
+ ws.on('open', function() {
+ ws.send('foo');
+ });
+
+ ws.on('close', function() {
+ process.nextTick(function() {
+ assert.ok(message === 1);
+ assert.ok(open === 1);
+ assert.ok(close === 1);
+
+ srv.close();
+ ws.terminate();
+ done();
+ });
+ });
+ });
+ });
+
+ it('should receive text data wrapped in a MessageEvent when using addEventListener', function(done) {
+ server.createServer(++port, function(srv) {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.addEventListener('open', function() {
+ ws.send('hi');
+ });
+ ws.addEventListener('message', function(messageEvent) {
+ assert.equal('hi', messageEvent.data);
+ ws.terminate();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('should receive valid CloseEvent when server closes with code 1000', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.addEventListener('close', function(closeEvent) {
+ assert.equal(true, closeEvent.wasClean);
+ assert.equal(1000, closeEvent.code);
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(client) {
+ client.close(1000);
+ });
+ });
+
+ it('should receive valid CloseEvent when server closes with code 1001', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.addEventListener('close', function(closeEvent) {
+ assert.equal(false, closeEvent.wasClean);
+ assert.equal(1001, closeEvent.code);
+ assert.equal('some daft reason', closeEvent.reason);
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(client) {
+ client.close(1001, 'some daft reason');
+ });
+ });
+
+ it('should have target set on Events', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.addEventListener('open', function(openEvent) {
+ assert.equal(ws, openEvent.target);
+ });
+ ws.addEventListener('message', function(messageEvent) {
+ assert.equal(ws, messageEvent.target);
+ wss.close();
+ });
+ ws.addEventListener('close', function(closeEvent) {
+ assert.equal(ws, closeEvent.target);
+ ws.emit('error', new Error('forced'));
+ });
+ ws.addEventListener('error', function(errorEvent) {
+ assert.equal(errorEvent.message, 'forced');
+ assert.equal(ws, errorEvent.target);
+ ws.terminate();
+ done();
+ });
+ });
+ wss.on('connection', function(client) {
+ client.send('hi')
+ });
+ });
+ });
+
+ describe('ssl', function() {
+ it('can connect to secure websocket server', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem')
+ };
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var wss = new WebSocketServer({server: app});
+ app.listen(++port, function() {
+ var ws = new WebSocket('wss://localhost:' + port);
+ });
+ wss.on('connection', function(ws) {
+ app.close();
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+
+ it('can connect to secure websocket server with client side certificate', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem'),
+ ca: [fs.readFileSync('test/fixtures/ca1-cert.pem')],
+ requestCert: true
+ };
+ var clientOptions = {
+ key: fs.readFileSync('test/fixtures/agent1-key.pem'),
+ cert: fs.readFileSync('test/fixtures/agent1-cert.pem')
+ };
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var success = false;
+ var wss = new WebSocketServer({
+ server: app,
+ verifyClient: function(info) {
+ success = !!info.req.client.authorized;
+ return true;
+ }
+ });
+ app.listen(++port, function() {
+ var ws = new WebSocket('wss://localhost:' + port, clientOptions);
+ });
+ wss.on('connection', function(ws) {
+ app.close();
+ ws.terminate();
+ wss.close();
+ success.should.be.ok;
+ done();
+ });
+ });
+
+ it('cannot connect to secure websocket server via ws://', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem')
+ };
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var wss = new WebSocketServer({server: app});
+ app.listen(++port, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('error', function() {
+ app.close();
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ it('can send and receive text data', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem')
+ };
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var wss = new WebSocketServer({server: app});
+ app.listen(++port, function() {
+ var ws = new WebSocket('wss://localhost:' + port);
+ ws.on('open', function() {
+ ws.send('foobar');
+ });
+ });
+ wss.on('connection', function(ws) {
+ ws.on('message', function(message, flags) {
+ message.should.eql('foobar');
+ app.close();
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ it('can send and receive very long binary data', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem')
+ }
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ crypto.randomBytes(5 * 1024 * 1024, function(ex, buf) {
+ if (ex) throw ex;
+ var wss = new WebSocketServer({server: app});
+ app.listen(++port, function() {
+ var ws = new WebSocket('wss://localhost:' + port);
+ ws.on('open', function() {
+ ws.send(buf, {binary: true});
+ });
+ ws.on('message', function(message, flags) {
+ flags.binary.should.be.ok;
+ areArraysEqual(buf, message).should.be.ok;
+ app.close();
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ ws.on('message', function(message, flags) {
+ ws.send(message, {binary: true});
+ });
+ });
+ });
+ });
+ });
+
+ describe('protocol support discovery', function() {
+ describe('#supports', function() {
+ describe('#binary', function() {
+ it('returns true for hybi transport', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ assert.equal(true, client.supports.binary);
+ wss.close();
+ done();
+ });
+ });
+
+ it('returns false for hixie transport', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ });
+ wss.on('connection', function(client) {
+ assert.equal(false, client.supports.binary);
+ wss.close();
+ done();
+ });
+ });
+ });
+ });
+ });
+});
diff --git a/node_modules/ws/test/WebSocketServer.test.js b/node_modules/ws/test/WebSocketServer.test.js
new file mode 100644
index 0000000..c21fd97
--- /dev/null
+++ b/node_modules/ws/test/WebSocketServer.test.js
@@ -0,0 +1,1103 @@
+var http = require('http')
+ , https = require('https')
+ , WebSocket = require('../')
+ , WebSocketServer = WebSocket.Server
+ , fs = require('fs')
+ , should = require('should');
+
+var port = 8000;
+
+function getArrayBuffer(buf) {
+ var l = buf.length;
+ var arrayBuf = new ArrayBuffer(l);
+ for (var i = 0; i < l; ++i) {
+ arrayBuf[i] = buf[i];
+ }
+ return arrayBuf;
+}
+
+function areArraysEqual(x, y) {
+ if (x.length != y.length) return false;
+ for (var i = 0, l = x.length; i < l; ++i) {
+ if (x[i] !== y[i]) return false;
+ }
+ return true;
+}
+
+describe('WebSocketServer', function() {
+ describe('#ctor', function() {
+ it('throws an error if no option object is passed', function() {
+ var gotException = false;
+ try {
+ var wss = new WebSocketServer();
+ }
+ catch (e) {
+ gotException = true;
+ }
+ gotException.should.be.ok;
+ });
+
+ it('throws an error if no port or server is specified', function() {
+ var gotException = false;
+ try {
+ var wss = new WebSocketServer({});
+ }
+ catch (e) {
+ gotException = true;
+ }
+ gotException.should.be.ok;
+ });
+
+ it('does not throw an error if no port or server is specified, when the noServer option is true', function() {
+ var gotException = false;
+ try {
+ var wss = new WebSocketServer({noServer: true});
+ }
+ catch (e) {
+ gotException = true;
+ }
+ gotException.should.eql(false);
+ });
+
+ it('emits an error if http server bind fails', function(done) {
+ var wss = new WebSocketServer({port: 1});
+ wss.on('error', function() { done(); });
+ });
+
+ it('starts a server on a given port', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ wss.close();
+ done();
+ });
+ });
+
+ it('uses a precreated http server', function (done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss = new WebSocketServer({server: srv});
+ var ws = new WebSocket('ws://localhost:' + port);
+
+ wss.on('connection', function(client) {
+ wss.close();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('uses a precreated http server listening on unix socket', function (done) {
+ var srv = http.createServer();
+ var sockPath = '/tmp/ws_socket_'+new Date().getTime()+'.'+Math.floor(Math.random() * 1000);
+ srv.listen(sockPath, function () {
+ var wss = new WebSocketServer({server: srv});
+ var ws = new WebSocket('ws+unix://'+sockPath);
+
+ wss.on('connection', function(client) {
+ wss.close();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('emits path specific connection event', function (done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss = new WebSocketServer({server: srv});
+ var ws = new WebSocket('ws://localhost:' + port+'/endpointName');
+
+ wss.on('connection/endpointName', function(client) {
+ wss.close();
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('can have two different instances listening on the same http server with two different paths', function(done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss1 = new WebSocketServer({server: srv, path: '/wss1'})
+ , wss2 = new WebSocketServer({server: srv, path: '/wss2'});
+ var doneCount = 0;
+ wss1.on('connection', function(client) {
+ wss1.close();
+ if (++doneCount == 2) {
+ srv.close();
+ done();
+ }
+ });
+ wss2.on('connection', function(client) {
+ wss2.close();
+ if (++doneCount == 2) {
+ srv.close();
+ done();
+ }
+ });
+ var ws1 = new WebSocket('ws://localhost:' + port + '/wss1');
+ var ws2 = new WebSocket('ws://localhost:' + port + '/wss2?foo=1');
+ });
+ });
+
+ it('cannot have two different instances listening on the same http server with the same path', function(done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss1 = new WebSocketServer({server: srv, path: '/wss1'});
+ try {
+ var wss2 = new WebSocketServer({server: srv, path: '/wss1'});
+ }
+ catch (e) {
+ wss1.close();
+ srv.close();
+ done();
+ }
+ });
+ });
+ });
+
+ describe('#close', function() {
+ it('will close all clients', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('close', function() {
+ if (++closes == 2) done();
+ });
+ });
+ var closes = 0;
+ wss.on('connection', function(client) {
+ client.on('close', function() {
+ if (++closes == 2) done();
+ });
+ wss.close();
+ });
+ });
+
+ it('does not close a precreated server', function(done) {
+ var srv = http.createServer();
+ var realClose = srv.close;
+ srv.close = function() {
+ should.fail('must not close pre-created server');
+ }
+ srv.listen(++port, function () {
+ var wss = new WebSocketServer({server: srv});
+ var ws = new WebSocket('ws://localhost:' + port);
+ wss.on('connection', function(client) {
+ wss.close();
+ srv.close = realClose;
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ it('cleans up websocket data on a precreated server', function(done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss1 = new WebSocketServer({server: srv, path: '/wss1'})
+ , wss2 = new WebSocketServer({server: srv, path: '/wss2'});
+ (typeof srv._webSocketPaths).should.eql('object');
+ Object.keys(srv._webSocketPaths).length.should.eql(2);
+ wss1.close();
+ Object.keys(srv._webSocketPaths).length.should.eql(1);
+ wss2.close();
+ (typeof srv._webSocketPaths).should.eql('undefined');
+ srv.close();
+ done();
+ });
+ });
+ });
+
+ describe('#clients', function() {
+ it('returns a list of connected clients', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ wss.clients.length.should.eql(0);
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ wss.clients.length.should.eql(1);
+ wss.close();
+ done();
+ });
+ });
+
+ it('can be disabled', function(done) {
+ var wss = new WebSocketServer({port: ++port, clientTracking: false}, function() {
+ wss.clients.length.should.eql(0);
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ wss.clients.length.should.eql(0);
+ wss.close();
+ done();
+ });
+ });
+
+ it('is updated when client terminates the connection', function(done) {
+ var ws;
+ var wss = new WebSocketServer({port: ++port}, function() {
+ ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ client.on('close', function() {
+ wss.clients.length.should.eql(0);
+ wss.close();
+ done();
+ });
+ ws.terminate();
+ });
+ });
+
+ it('is updated when client closes the connection', function(done) {
+ var ws;
+ var wss = new WebSocketServer({port: ++port}, function() {
+ ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(client) {
+ client.on('close', function() {
+ wss.clients.length.should.eql(0);
+ wss.close();
+ done();
+ });
+ ws.close();
+ });
+ });
+ });
+
+ describe('#options', function() {
+ it('exposes options passed to constructor', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ wss.options.port.should.eql(port);
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ describe('#handleUpgrade', function() {
+ it('can be used for a pre-existing server', function (done) {
+ var srv = http.createServer();
+ srv.listen(++port, function () {
+ var wss = new WebSocketServer({noServer: true});
+ srv.on('upgrade', function(req, socket, upgradeHead) {
+ wss.handleUpgrade(req, socket, upgradeHead, function(client) {
+ client.send('hello');
+ });
+ });
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('message', function(message) {
+ message.should.eql('hello');
+ wss.close();
+ srv.close();
+ done();
+ });
+ });
+ });
+ });
+
+ describe('hybi mode', function() {
+ describe('connection establishing', function() {
+ it('does not accept connections with no sec-websocket-key', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(400);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('does not accept connections with no sec-websocket-version', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ=='
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(400);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('does not accept connections with invalid sec-websocket-version', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 12
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(400);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be denied', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 8,
+ 'Sec-WebSocket-Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(401);
+ process.nextTick(function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be accepted', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return true;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ wss.on('error', function() {});
+ });
+
+ it('verifyClient gets client origin', function(done) {
+ var verifyClientCalled = false;
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(info) {
+ info.origin.should.eql('http://foobarbaz.com');
+ verifyClientCalled = true;
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Origin': 'http://foobarbaz.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ verifyClientCalled.should.be.ok;
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+
+ it('verifyClient gets original request', function(done) {
+ var verifyClientCalled = false;
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(info) {
+ info.req.headers['sec-websocket-key'].should.eql('dGhlIHNhbXBsZSBub25jZQ==');
+ verifyClientCalled = true;
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Origin': 'http://foobarbaz.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ verifyClientCalled.should.be.ok;
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+
+ it('verifyClient has secure:true for ssl connections', function(done) {
+ var options = {
+ key: fs.readFileSync('test/fixtures/key.pem'),
+ cert: fs.readFileSync('test/fixtures/certificate.pem')
+ };
+ var app = https.createServer(options, function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var success = false;
+ var wss = new WebSocketServer({
+ server: app,
+ verifyClient: function(info) {
+ success = info.secure === true;
+ return true;
+ }
+ });
+ app.listen(++port, function() {
+ var ws = new WebSocket('wss://localhost:' + port);
+ });
+ wss.on('connection', function(ws) {
+ app.close();
+ ws.terminate();
+ wss.close();
+ success.should.be.ok;
+ done();
+ });
+ });
+
+ it('verifyClient has secure:false for non-ssl connections', function(done) {
+ var app = http.createServer(function (req, res) {
+ res.writeHead(200);
+ res.end();
+ });
+ var success = false;
+ var wss = new WebSocketServer({
+ server: app,
+ verifyClient: function(info) {
+ success = info.secure === false;
+ return true;
+ }
+ });
+ app.listen(++port, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ });
+ wss.on('connection', function(ws) {
+ app.close();
+ ws.terminate();
+ wss.close();
+ success.should.be.ok;
+ done();
+ });
+ });
+
+ it('client can be denied asynchronously', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) {
+ process.nextTick(function() {
+ cb(false);
+ });
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 8,
+ 'Sec-WebSocket-Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(401);
+ process.nextTick(function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be accepted asynchronously', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) {
+ process.nextTick(function() {
+ cb(true);
+ });
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ wss.on('error', function() {});
+ });
+
+ it('handles messages passed along with the upgrade request (upgrade head)', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return true;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.write(new Buffer([0x81, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f], 'binary'));
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.on('message', function(data) {
+ data.should.eql('Hello');
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+
+ it('selects the first protocol by default', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'});
+ ws.on('open', function(client) {
+ ws.protocol.should.eql('prot1');
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ it('selects the last protocol via protocol handler', function(done) {
+ var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) {
+ cb(true, ps[ps.length-1]); }}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'});
+ ws.on('open', function(client) {
+ ws.protocol.should.eql('prot2');
+ wss.close();
+ done();
+ });
+ });
+ });
+
+ it('client detects invalid server protocol', function(done) {
+ var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) {
+ cb(true, 'prot3'); }}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'});
+ ws.on('open', function(client) {
+ done(new Error('connection must not be established'));
+ });
+ ws.on('error', function() {
+ done();
+ });
+ });
+ });
+
+ it('client detects no server protocol', function(done) {
+ var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) {
+ cb(true); }}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'});
+ ws.on('open', function(client) {
+ done(new Error('connection must not be established'));
+ });
+ ws.on('error', function() {
+ done();
+ });
+ });
+ });
+
+ it('client refuses server protocols', function(done) {
+ var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) {
+ cb(false); }}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'prot1, prot2'});
+ ws.on('open', function(client) {
+ done(new Error('connection must not be established'));
+ });
+ ws.on('error', function() {
+ done();
+ });
+ });
+ });
+
+ it('server detects invalid protocol handler', function(done) {
+ var wss = new WebSocketServer({port: ++port, handleProtocols: function(ps, cb) {
+ // not calling callback is an error and shouldn't timeout
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
+ 'Sec-WebSocket-Version': 13,
+ 'Sec-WebSocket-Origin': 'http://foobar.com'
+ }
+ };
+ options.port = port;
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(501);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+ });
+
+ describe('messaging', function() {
+ it('can send and receive data', function(done) {
+ var data = new Array(65*1024);
+ for (var i = 0; i < data.length; ++i) {
+ data[i] = String.fromCharCode(65 + ~~(25 * Math.random()));
+ }
+ data = data.join('');
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port);
+ ws.on('message', function(message, flags) {
+ ws.send(message);
+ });
+ });
+ wss.on('connection', function(client) {
+ client.on('message', function(message) {
+ message.should.eql(data);
+ wss.close();
+ done();
+ });
+ client.send(data);
+ });
+ });
+ });
+ });
+
+ describe('hixie mode', function() {
+ it('can be disabled', function(done) {
+ var wss = new WebSocketServer({port: ++port, disableHixie: true}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(401);
+ process.nextTick(function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ describe('connection establishing', function() {
+ it('does not accept connections with no sec-websocket-key1', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(400);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('does not accept connections with no sec-websocket-key2', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(400);
+ wss.close();
+ done();
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('accepts connections with valid handshake', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be denied', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(401);
+ process.nextTick(function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be accepted', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return true;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ wss.on('error', function() {});
+ });
+
+ it('verifyClient gets client origin', function(done) {
+ var verifyClientCalled = false;
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(info) {
+ info.origin.should.eql('http://foobarbaz.com');
+ verifyClientCalled = true;
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Origin': 'http://foobarbaz.com',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ req.on('response', function(res) {
+ verifyClientCalled.should.be.ok;
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+
+ it('verifyClient gets original request', function(done) {
+ var verifyClientCalled = false;
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(info) {
+ info.req.headers['sec-websocket-key1'].should.eql('3e6b263 4 17 80');
+ verifyClientCalled = true;
+ return false;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Origin': 'http://foobarbaz.com',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ req.on('response', function(res) {
+ verifyClientCalled.should.be.ok;
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be denied asynchronously', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) {
+ cb(false);
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Origin': 'http://foobarbaz.com',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ req.on('response', function(res) {
+ res.statusCode.should.eql(401);
+ process.nextTick(function() {
+ wss.close();
+ done();
+ });
+ });
+ });
+ wss.on('connection', function(ws) {
+ done(new Error('connection must not be established'));
+ });
+ wss.on('error', function() {});
+ });
+
+ it('client can be accepted asynchronously', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o, cb) {
+ cb(true);
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Origin': 'http://foobarbaz.com',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ wss.close();
+ done();
+ });
+ wss.on('error', function() {});
+ });
+
+ it('handles messages passed along with the upgrade request (upgrade head)', function(done) {
+ var wss = new WebSocketServer({port: ++port, verifyClient: function(o) {
+ return true;
+ }}, function() {
+ var options = {
+ port: port,
+ host: '127.0.0.1',
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'WebSocket',
+ 'Sec-WebSocket-Key1': '3e6b263 4 17 80',
+ 'Sec-WebSocket-Key2': '17 9 G`ZD9 2 2b 7X 3 /r90',
+ 'Origin': 'http://foobar.com'
+ }
+ };
+ var req = http.request(options);
+ req.write('WjN}|M(6');
+ req.write(new Buffer([0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xff], 'binary'));
+ req.end();
+ });
+ wss.on('connection', function(ws) {
+ ws.on('message', function(data) {
+ data.should.eql('Hello');
+ ws.terminate();
+ wss.close();
+ done();
+ });
+ });
+ wss.on('error', function() {});
+ });
+ });
+ });
+
+ describe('client properties', function() {
+ it('protocol is exposed', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocol: 'hi'});
+ });
+ wss.on('connection', function(client) {
+ client.protocol.should.eql('hi');
+ wss.close();
+ done();
+ });
+ });
+
+ it('protocolVersion is exposed', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8});
+ });
+ wss.on('connection', function(client) {
+ client.protocolVersion.should.eql(8);
+ wss.close();
+ done();
+ });
+ });
+
+ it('upgradeReq is the original request object', function(done) {
+ var wss = new WebSocketServer({port: ++port}, function() {
+ var ws = new WebSocket('ws://localhost:' + port, {protocolVersion: 8});
+ });
+ wss.on('connection', function(client) {
+ client.upgradeReq.httpVersion.should.eql('1.1');
+ wss.close();
+ done();
+ });
+ });
+ });
+
+});
diff --git a/node_modules/ws/test/autobahn-server.js b/node_modules/ws/test/autobahn-server.js
new file mode 100644
index 0000000..36fe0c2
--- /dev/null
+++ b/node_modules/ws/test/autobahn-server.js
@@ -0,0 +1,29 @@
+var WebSocketServer = require('../').Server;
+
+process.on('uncaughtException', function(err) {
+ console.log('Caught exception: ', err, err.stack);
+});
+
+process.on('SIGINT', function () {
+ try {
+ console.log('Updating reports and shutting down');
+ var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws');
+ ws.on('close', function() {
+ process.exit();
+ });
+ }
+ catch(e) {
+ process.exit();
+ }
+});
+
+var wss = new WebSocketServer({port: 8181});
+wss.on('connection', function(ws) {
+ console.log('new connection');
+ ws.on('message', function(data, flags) {
+ ws.send(flags.buffer, {binary: flags.binary === true});
+ });
+ ws.on('error', function() {
+ console.log('error', arguments);
+ });
+});
diff --git a/node_modules/ws/test/autobahn.js b/node_modules/ws/test/autobahn.js
new file mode 100644
index 0000000..048cc90
--- /dev/null
+++ b/node_modules/ws/test/autobahn.js
@@ -0,0 +1,52 @@
+var WebSocket = require('../');
+var currentTest = 1;
+var lastTest = -1;
+var testCount = null;
+
+process.on('uncaughtException', function(err) {
+ console.log('Caught exception: ', err, err.stack);
+});
+
+process.on('SIGINT', function () {
+ try {
+ console.log('Updating reports and shutting down');
+ var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws');
+ ws.on('close', function() {
+ process.exit();
+ });
+ }
+ catch(e) {
+ process.exit();
+ }
+});
+
+function nextTest() {
+ if (currentTest > testCount || (lastTest != -1 && currentTest > lastTest)) {
+ console.log('Updating reports and shutting down');
+ var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws');
+ ws.on('close', function() {
+ process.exit();
+ });
+ return;
+ };
+ console.log('Running test case ' + currentTest + '/' + testCount);
+ var ws = new WebSocket('ws://localhost:9001/runCase?case=' + currentTest + '&agent=ws');
+ ws.on('message', function(data, flags) {
+ ws.send(flags.buffer, {binary: flags.binary === true, mask: true});
+ });
+ ws.on('close', function(data) {
+ currentTest += 1;
+ process.nextTick(nextTest);
+ });
+ ws.on('error', function(e) {});
+}
+
+var ws = new WebSocket('ws://localhost:9001/getCaseCount');
+ws.on('message', function(data, flags) {
+ testCount = parseInt(data);
+});
+ws.on('close', function() {
+ if (testCount > 0) {
+ nextTest();
+ }
+}); \ No newline at end of file
diff --git a/node_modules/ws/test/fixtures/agent1-cert.pem b/node_modules/ws/test/fixtures/agent1-cert.pem
new file mode 100644
index 0000000..cccb9fb
--- /dev/null
+++ b/node_modules/ws/test/fixtures/agent1-cert.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICbjCCAdcCCQCVvok5oeLpqzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV
+UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO
+BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA
+dGlueWNsb3Vkcy5vcmcwHhcNMTMwMzA4MDAzMDIyWhcNNDAwNzIzMDAzMDIyWjB9
+MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK
+EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MTEgMB4G
+CSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD
+gY0AMIGJAoGBAL6GwKosYb0Yc3Qo0OtQVlCJ4208Idw11ij+t2W5sfYbCil5tyQo
+jnhGM1CJhEXynQpXXwjKJuIeTQCkeUibTyFKa0bs8+li2FiGoKYbb4G81ovnqkmE
+2iDVb8Gw3rrM4zeZ0ZdFnjMsAZac8h6+C4sB/pS9BiMOo6qTl15RQlcJAgMBAAEw
+DQYJKoZIhvcNAQEFBQADgYEAOtmLo8DwTPnI4wfQbQ3hWlTS/9itww6IsxH2ODt9
+ggB7wi7N3uAdIWRZ54ke0NEAO5CW1xNTwsWcxQbiHrDOqX1vfVCjIenI76jVEEap
+/Ay53ydHNBKdsKkib61Me14Mu0bA3lUul57VXwmH4NUEFB3w973Q60PschUhOEXj
+7DY=
+-----END CERTIFICATE-----
diff --git a/node_modules/ws/test/fixtures/agent1-key.pem b/node_modules/ws/test/fixtures/agent1-key.pem
new file mode 100644
index 0000000..cbd5f0c
--- /dev/null
+++ b/node_modules/ws/test/fixtures/agent1-key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQC+hsCqLGG9GHN0KNDrUFZQieNtPCHcNdYo/rdlubH2Gwopebck
+KI54RjNQiYRF8p0KV18IyibiHk0ApHlIm08hSmtG7PPpYthYhqCmG2+BvNaL56pJ
+hNog1W/BsN66zOM3mdGXRZ4zLAGWnPIevguLAf6UvQYjDqOqk5deUUJXCQIDAQAB
+AoGANu/CBA+SCyVOvRK70u4yRTzNMAUjukxnuSBhH1rg/pajYnwvG6T6F6IeT72n
+P0gKkh3JUE6B0bds+p9yPUZTFUXghxjcF33wlIY44H6gFE4K5WutsFJ9c450wtuu
+8rXZTsIg7lAXWjTFVmdtOEPetcGlO2Hpi1O7ZzkzHgB2w9ECQQDksCCYx78or1zY
+ZSokm8jmpIjG3VLKdvI9HAoJRN40ldnwFoigrFa1AHwsFtWNe8bKyVRPDoLDUjpB
+dkPWgweVAkEA1UfgqguQ2KIkbtp9nDBionu3QaajksrRHwIa8vdfRfLxszfHk2fh
+NGY3dkRZF8HUAbzYLrd9poVhCBAEjWekpQJASOM6AHfpnXYHCZF01SYx6hEW5wsz
+kARJQODm8f1ZNTlttO/5q/xBxn7ZFNRSTD3fJlL05B2j380ddC/Vf1FT4QJAP1BC
+GliqnBSuGhZUWYxni3KMeTm9rzL0F29pjpzutHYlWB2D6ndY/FQnvL0XcZ0Bka58
+womIDGnl3x3aLBwLXQJBAJv6h5CHbXHx7VyDJAcNfppAqZGcEaiVg8yf2F33iWy2
+FLthhJucx7df7SO2aw5h06bRDRAhb9br0R9/3mLr7RE=
+-----END RSA PRIVATE KEY-----
diff --git a/node_modules/ws/test/fixtures/ca1-cert.pem b/node_modules/ws/test/fixtures/ca1-cert.pem
new file mode 100644
index 0000000..1d0c0d6
--- /dev/null
+++ b/node_modules/ws/test/fixtures/ca1-cert.pem
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICazCCAdQCCQC9/g69HtxXRzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV
+UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO
+BgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqGSIb3DQEJARYRcnlA
+dGlueWNsb3Vkcy5vcmcwHhcNMTMwMzA4MDAzMDIyWhcNNDAwNzIzMDAzMDIyWjB6
+MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQK
+EwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDDAKBgNVBAMTA2NhMTEgMB4GCSqG
+SIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A
+MIGJAoGBAKxr1mARUcv7zaqx5y4AxJPK6c1jdbSg7StcL4vg8klaPAlfNO6o+/Cl
+w5CdQD3ukaVUwUOJ4T/+b3Xf7785XcWBC33GdjVQkfbHATJYcka7j7JDw3qev5Jk
+1rAbRw48hF6rYlSGcx1mccAjoLoa3I8jgxCNAYHIjUQXgdmU893rAgMBAAEwDQYJ
+KoZIhvcNAQEFBQADgYEAis05yxjCtJRuv8uX/DK6TX/j9C9Lzp1rKDNFTaTZ0iRw
+KCw1EcNx4OXSj9gNblW4PWxpDvygrt1AmH9h2cb8K859NSHa9JOBFw6MA5C2A4Sj
+NQfNATqUl4T6cdORlcDEZwHtT8b6D4A6Er31G/eJF4Sen0TUFpjdjd+l9RBjHlo=
+-----END CERTIFICATE-----
diff --git a/node_modules/ws/test/fixtures/ca1-key.pem b/node_modules/ws/test/fixtures/ca1-key.pem
new file mode 100644
index 0000000..df14950
--- /dev/null
+++ b/node_modules/ws/test/fixtures/ca1-key.pem
@@ -0,0 +1,17 @@
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIFeWxJE1BrRECAggA
+MBQGCCqGSIb3DQMHBAgu9PlMSQ+BOASCAoDEZN2tX0xWo/N+Jg+PrvCrFDk3P+3x
+5xG/PEDjtMCAWPBEwbnaYHDzYmhNcAmxzGqEHGMDiWYs46LbO560VS3uMvFbEWPo
+KYYVb13vkxl2poXdonCb5cHZA5GUYzTIVVJFptl4LHwBczHoMHtA4FqAhKlYvlWw
+EOrdLB8XcwMmGPFabbbGxno0+EWWM27uNjlogfoxj35mQqSW4rOlhZ460XjOB1Zx
+LjXMuZeONojkGYQRG5EUMchBoctQpCOM6cAi9r1B9BvtFCBpDV1c1zEZBzTEUd8o
+kLn6tjLmY+QpTdylFjEWc7U3ppLY/pkoTBv4r85a2sEMWqkhSJboLaTboWzDJcU3
+Ke61pMpovt/3yCUd3TKgwduVwwQtDVTlBe0p66aN9QVj3CrFy/bKAGO3vxlli24H
+aIjZf+OVoBY21ESlW3jLvNlBf7Ezf///2E7j4SCDLyZSFMTpFoAG/jDRyvi+wTKX
+Kh485Bptnip6DCSuoH4u2SkOqwz3gJS/6s02YKe4m311QT4Pzne5/FwOFaS/HhQg
+Xvyh2/d00OgJ0Y0PYQsHILPRgTUCKUXvj1O58opn3fxSacsPxIXwj6Z4FYAjUTaV
+2B85k1lpant/JJEilDqMjqzx4pHZ/Z3Uto1lSM1JZs9SNL/0UR+6F0TXZTULVU9V
+w8jYzz4sPr7LEyrrTbzmjQgnQFVbhAN/eKgRZK/SpLjxpmBV5MfpbPKsPUZqT4UC
+4nXa8a/NYUQ9e+QKK8enq9E599c2W442W7Z1uFRZTWReMx/lF8wwA6G8zOPG0bdj
+d+T5Gegzd5mvRiXMBklCo8RLxOOvgxun1n3PY4a63aH6mqBhdfhiLp5j
+-----END ENCRYPTED PRIVATE KEY-----
diff --git a/node_modules/ws/test/fixtures/certificate.pem b/node_modules/ws/test/fixtures/certificate.pem
new file mode 100644
index 0000000..0efc2ef
--- /dev/null
+++ b/node_modules/ws/test/fixtures/certificate.pem
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE-----
+MIICATCCAWoCCQDPufXH86n2QzANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJu
+bzETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0
+cyBQdHkgTHRkMB4XDTEyMDEwMTE0NDQwMFoXDTIwMDMxOTE0NDQwMFowRTELMAkG
+A1UEBhMCbm8xEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0
+IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtrQ7
++r//2iV/B6F+4boH0XqFn7alcV9lpjvAmwRXNKnxAoa0f97AjYPGNLKrjpkNXXhB
+JROIdbRbZnCNeC5fzX1a+JCo7KStzBXuGSZr27TtFmcV4H+9gIRIcNHtZmJLnxbJ
+sIhkGR8yVYdmJZe4eT5ldk1zoB1adgPF1hZhCBMCAwEAATANBgkqhkiG9w0BAQUF
+AAOBgQCeWBEHYJ4mCB5McwSSUox0T+/mJ4W48L/ZUE4LtRhHasU9hiW92xZkTa7E
+QLcoJKQiWfiLX2ysAro0NX4+V8iqLziMqvswnPzz5nezaOLE/9U/QvH3l8qqNkXu
+rNbsW1h/IO6FV8avWFYVFoutUwOaZ809k7iMh2F2JMgXQ5EymQ==
+-----END CERTIFICATE-----
diff --git a/node_modules/ws/test/fixtures/key.pem b/node_modules/ws/test/fixtures/key.pem
new file mode 100644
index 0000000..176fe32
--- /dev/null
+++ b/node_modules/ws/test/fixtures/key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEChrR/
+3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0WZxXg
+f72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwIDAQAB
+AoGAAlVY8sHi/aE+9xT77twWX3mGHV0SzdjfDnly40fx6S1Gc7bOtVdd9DC7pk6l
+3ENeJVR02IlgU8iC5lMHq4JEHPE272jtPrLlrpWLTGmHEqoVFv9AITPqUDLhB9Kk
+Hjl7h8NYBKbr2JHKICr3DIPKOT+RnXVb1PD4EORbJ3ooYmkCQQDfknUnVxPgxUGs
+ouABw1WJIOVgcCY/IFt4Ihf6VWTsxBgzTJKxn3HtgvE0oqTH7V480XoH0QxHhjLq
+DrgobWU9AkEA0TRJ8/ouXGnFEPAXjWr9GdPQRZ1Use2MrFjneH2+Sxc0CmYtwwqL
+Kr5kS6mqJrxprJeluSjBd+3/ElxURrEXjwJAUvmlN1OPEhXDmRHd92mKnlkyKEeX
+OkiFCiIFKih1S5Y/sRJTQ0781nyJjtJqO7UyC3pnQu1oFEePL+UEniRztQJAMfav
+AtnpYKDSM+1jcp7uu9BemYGtzKDTTAYfoiNF42EzSJiGrWJDQn4eLgPjY0T0aAf/
+yGz3Z9ErbhMm/Ysl+QJBAL4kBxRT8gM4ByJw4sdOvSeCCANFq8fhbgm8pGWlCPb5
+JGmX3/GHFM8x2tbWMGpyZP1DLtiNEFz7eCGktWK5rqE=
+-----END RSA PRIVATE KEY-----
diff --git a/node_modules/ws/test/fixtures/request.pem b/node_modules/ws/test/fixtures/request.pem
new file mode 100644
index 0000000..51bc7f6
--- /dev/null
+++ b/node_modules/ws/test/fixtures/request.pem
@@ -0,0 +1,11 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIBhDCB7gIBADBFMQswCQYDVQQGEwJubzETMBEGA1UECAwKU29tZS1TdGF0ZTEh
+MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEC
+hrR/3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0W
+ZxXgf72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwID
+AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAjsUXEARgfxZNkMjuUcudgU2w4JXS0gGI
+JQ0U1LmU0vMDSKwqndMlvCbKzEgPbJnGJDI8D4MeINCJHa5Ceyb8c+jaJYUcCabl
+lQW5Psn3+eWp8ncKlIycDRj1Qk615XuXtV0fhkrgQM2ZCm9LaQ1O1Gd/CzLihLjF
+W0MmgMKMMRk=
+-----END CERTIFICATE REQUEST-----
diff --git a/node_modules/ws/test/fixtures/textfile b/node_modules/ws/test/fixtures/textfile
new file mode 100644
index 0000000..a10483b
--- /dev/null
+++ b/node_modules/ws/test/fixtures/textfile
@@ -0,0 +1,9 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas, massa at aliquam luctus, sapien erat viverra elit, nec pulvinar turpis eros sagittis urna. Pellentesque imperdiet tempor varius. Pellentesque blandit, ipsum in imperdiet venenatis, mi elit faucibus odio, id condimentum ante enim sed lectus. Aliquam et odio non odio pellentesque pulvinar. Vestibulum a erat dolor. Integer pretium risus sit amet nisl volutpat nec venenatis magna egestas. Ut bibendum felis eu tellus laoreet eleifend. Nam pulvinar auctor tortor, eu iaculis leo vestibulum quis. In euismod risus ac purus vehicula et fermentum ligula consectetur. Vivamus condimentum tempus lacinia.
+
+Curabitur sodales condimentum urna id dictum. Sed quis justo sit amet quam ultrices tincidunt vel laoreet nulla. Nullam quis ipsum sed nisi mollis bibendum at sit amet nisi. Donec laoreet consequat velit sit amet mollis. Nam sed sapien a massa iaculis dapibus. Sed dui nunc, ultricies et pellentesque ullamcorper, aliquet vitae ligula. Integer eu velit in neque iaculis venenatis. Ut rhoncus cursus est, ac dignissim leo vehicula a. Nulla ullamcorper vulputate mauris id blandit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eleifend, nisi a tempor sollicitudin, odio massa pretium urna, quis congue sapien elit at tortor. Curabitur ipsum orci, vehicula non commodo molestie, laoreet id enim. Pellentesque convallis ultrices congue. Pellentesque nec iaculis lorem. In sagittis pharetra ipsum eget sodales.
+
+Fusce id nulla odio. Nunc nibh justo, placerat vel tincidunt sed, ornare et enim. Nulla vel urna vel ante commodo bibendum in vitae metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis erat nunc, semper eget sagittis sit amet, ullamcorper eget lacus. Donec hendrerit ipsum vitae eros vestibulum eu gravida neque tincidunt. Ut molestie lacinia nulla. Donec mattis odio at magna egestas at pellentesque eros accumsan. Praesent interdum sem sit amet nibh commodo dignissim. Duis laoreet, enim ultricies fringilla suscipit, enim libero cursus nulla, sollicitudin adipiscing erat velit ut dui. Nulla eleifend mauris at velit fringilla a molestie lorem venenatis.
+
+Donec sit amet scelerisque metus. Cras ac felis a nulla venenatis vulputate. Duis porttitor eros ac neque rhoncus eget aliquet neque egestas. Quisque sed nunc est, vitae dapibus quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In vehicula, est vitae posuere ultricies, diam purus pretium sapien, nec rhoncus dolor nisl eget arcu. Aliquam et nisi vitae risus tincidunt auctor. In vehicula, erat a cursus adipiscing, lorem orci congue est, nec ultricies elit dui in nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+Duis congue tempus elit sit amet auctor. Duis dignissim, risus ut sollicitudin ultricies, dolor ligula gravida odio, nec congue orci purus ut ligula. Fusce pretium dictum lectus at volutpat. Sed non auctor mauris. Etiam placerat vestibulum massa id blandit. Quisque consequat lacus ut nulla euismod facilisis. Sed aliquet ipsum nec mi imperdiet viverra. Pellentesque ullamcorper, lectus nec varius gravida, odio justo cursus risus, eu sagittis metus arcu quis felis. Phasellus consectetur vehicula libero, at condimentum orci euismod vel. Nunc purus tortor, suscipit nec fringilla nec, vulputate et nibh. Nam porta vehicula neque. Praesent porttitor, sapien eu auctor euismod, arcu quam elementum urna, sed hendrerit magna augue sed quam. \ No newline at end of file
diff --git a/node_modules/ws/test/hybi-common.js b/node_modules/ws/test/hybi-common.js
new file mode 100644
index 0000000..006f9c6
--- /dev/null
+++ b/node_modules/ws/test/hybi-common.js
@@ -0,0 +1,99 @@
+/**
+ * Returns a Buffer from a "ff 00 ff"-type hex string.
+ */
+
+getBufferFromHexString = function(byteStr) {
+ var bytes = byteStr.split(' ');
+ var buf = new Buffer(bytes.length);
+ for (var i = 0; i < bytes.length; ++i) {
+ buf[i] = parseInt(bytes[i], 16);
+ }
+ return buf;
+}
+
+/**
+ * Returns a hex string from a Buffer.
+ */
+
+getHexStringFromBuffer = function(data) {
+ var s = '';
+ for (var i = 0; i < data.length; ++i) {
+ s += padl(data[i].toString(16), 2, '0') + ' ';
+ }
+ return s.trim();
+}
+
+/**
+ * Splits a buffer in two parts.
+ */
+
+splitBuffer = function(buffer) {
+ var b1 = new Buffer(Math.ceil(buffer.length / 2));
+ buffer.copy(b1, 0, 0, b1.length);
+ var b2 = new Buffer(Math.floor(buffer.length / 2));
+ buffer.copy(b2, 0, b1.length, b1.length + b2.length);
+ return [b1, b2];
+}
+
+/**
+ * Performs hybi07+ type masking on a hex string or buffer.
+ */
+
+mask = function(buf, maskString) {
+ if (typeof buf == 'string') buf = new Buffer(buf);
+ var mask = getBufferFromHexString(maskString || '34 83 a8 68');
+ for (var i = 0; i < buf.length; ++i) {
+ buf[i] ^= mask[i % 4];
+ }
+ return buf;
+}
+
+/**
+ * Returns a hex string representing the length of a message
+ */
+
+getHybiLengthAsHexString = function(len, masked) {
+ if (len < 126) {
+ var buf = new Buffer(1);
+ buf[0] = (masked ? 0x80 : 0) | len;
+ }
+ else if (len < 65536) {
+ var buf = new Buffer(3);
+ buf[0] = (masked ? 0x80 : 0) | 126;
+ getBufferFromHexString(pack(4, len)).copy(buf, 1);
+ }
+ else {
+ var buf = new Buffer(9);
+ buf[0] = (masked ? 0x80 : 0) | 127;
+ getBufferFromHexString(pack(16, len)).copy(buf, 1);
+ }
+ return getHexStringFromBuffer(buf);
+}
+
+/**
+ * Unpacks a Buffer into a number.
+ */
+
+unpack = function(buffer) {
+ var n = 0;
+ for (var i = 0; i < buffer.length; ++i) {
+ n = (i == 0) ? buffer[i] : (n * 256) + buffer[i];
+ }
+ return n;
+}
+
+/**
+ * Returns a hex string, representing a specific byte count 'length', from a number.
+ */
+
+pack = function(length, number) {
+ return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim();
+}
+
+/**
+ * Left pads the string 's' to a total length of 'n' with char 'c'.
+ */
+
+padl = function(s, n, c) {
+ return new Array(1 + n - s.length).join(c) + s;
+}
diff --git a/node_modules/ws/test/testserver.js b/node_modules/ws/test/testserver.js
new file mode 100644
index 0000000..3e7a966
--- /dev/null
+++ b/node_modules/ws/test/testserver.js
@@ -0,0 +1,180 @@
+var http = require('http')
+ , util = require('util')
+ , crypto = require('crypto')
+ , events = require('events')
+ , Sender = require('../lib/Sender')
+ , Receiver = require('../lib/Receiver');
+
+module.exports = {
+ handlers: {
+ valid: validServer,
+ invalidKey: invalidRequestHandler,
+ closeAfterConnect: closeAfterConnectHandler,
+ return401: return401
+ },
+ createServer: function(port, handler, cb) {
+ if (handler && !cb) {
+ cb = handler;
+ handler = null;
+ }
+ var webServer = http.createServer(function (req, res) {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.end('okay');
+ });
+ var srv = new Server(webServer);
+ webServer.on('upgrade', function(req, socket) {
+ webServer._socket = socket;
+ (handler || validServer)(srv, req, socket);
+ });
+ webServer.listen(port, '127.0.0.1', function() { cb(srv); });
+ }
+};
+
+/**
+ * Test strategies
+ */
+
+function validServer(server, req, socket) {
+ if (typeof req.headers.upgrade === 'undefined' ||
+ req.headers.upgrade.toLowerCase() !== 'websocket') {
+ throw new Error('invalid headers');
+ return;
+ }
+
+ if (!req.headers['sec-websocket-key']) {
+ socket.end();
+ throw new Error('websocket key is missing');
+ }
+
+ // calc key
+ var key = req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ key = shasum.digest('base64');
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: websocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Accept: ' + key
+ ];
+
+ socket.write(headers.concat('', '').join('\r\n'));
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+
+ var sender = new Sender(socket);
+ var receiver = new Receiver();
+ receiver.ontext = function (message, flags) {
+ server.emit('message', message, flags);
+ sender.send(message);
+ };
+ receiver.onbinary = function (message, flags) {
+ flags = flags || {};
+ flags.binary = true;
+ server.emit('message', message, flags);
+ sender.send(message, {binary: true});
+ };
+ receiver.onping = function (message, flags) {
+ flags = flags || {};
+ server.emit('ping', message, flags);
+ };
+ receiver.onpong = function (message, flags) {
+ flags = flags || {};
+ server.emit('pong', message, flags);
+ };
+ receiver.onclose = function (code, message, flags) {
+ flags = flags || {};
+ server.emit('close', code, message, flags);
+ };
+ socket.on('data', function (data) {
+ receiver.add(data);
+ });
+ socket.on('end', function() {
+ socket.end();
+ });
+}
+
+function invalidRequestHandler(server, req, socket) {
+ if (typeof req.headers.upgrade === 'undefined' ||
+ req.headers.upgrade.toLowerCase() !== 'websocket') {
+ throw new Error('invalid headers');
+ return;
+ }
+
+ if (!req.headers['sec-websocket-key']) {
+ socket.end();
+ throw new Error('websocket key is missing');
+ }
+
+ // calc key
+ var key = req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "bogus");
+ key = shasum.digest('base64');
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: websocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Accept: ' + key
+ ];
+
+ socket.write(headers.concat('', '').join('\r\n'));
+ socket.end();
+}
+
+function closeAfterConnectHandler(server, req, socket) {
+ if (typeof req.headers.upgrade === 'undefined' ||
+ req.headers.upgrade.toLowerCase() !== 'websocket') {
+ throw new Error('invalid headers');
+ return;
+ }
+
+ if (!req.headers['sec-websocket-key']) {
+ socket.end();
+ throw new Error('websocket key is missing');
+ }
+
+ // calc key
+ var key = req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ key = shasum.digest('base64');
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: websocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Accept: ' + key
+ ];
+
+ socket.write(headers.concat('', '').join('\r\n'));
+ socket.end();
+}
+
+
+function return401(server, req, socket) {
+ var headers = [
+ 'HTTP/1.1 401 Unauthorized'
+ , 'Content-type: text/html'
+ ];
+
+ socket.write(headers.concat('', '').join('\r\n'));
+ socket.end();
+}
+
+/**
+ * Server object, which will do the actual emitting
+ */
+
+function Server(webServer) {
+ this.webServer = webServer;
+}
+
+util.inherits(Server, events.EventEmitter);
+
+Server.prototype.close = function() {
+ this.webServer.close();
+ if (this._socket) this._socket.end();
+}