From 415f6c39ed691e02bd8e4caf64122624a7c93657 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 22 Apr 2013 16:55:29 +0000 Subject: [PATCH] accidentally committed node_modules --- node_modules/.bin/express | 1 - node_modules/connect/.npmignore | 12 - node_modules/connect/.travis.yml | 5 - node_modules/connect/LICENSE | 24 - node_modules/connect/index.js | 4 - node_modules/connect/lib/cache.js | 81 - node_modules/connect/lib/connect.js | 92 - node_modules/connect/lib/index.js | 50 - .../connect/lib/middleware/basicAuth.js | 103 - .../connect/lib/middleware/bodyParser.js | 61 - .../connect/lib/middleware/compress.js | 152 -- .../connect/lib/middleware/cookieParser.js | 62 - .../connect/lib/middleware/cookieSession.js | 117 - node_modules/connect/lib/middleware/csrf.js | 73 - .../connect/lib/middleware/directory.js | 229 -- .../connect/lib/middleware/errorHandler.js | 86 - .../connect/lib/middleware/favicon.js | 80 - node_modules/connect/lib/middleware/json.js | 86 - node_modules/connect/lib/middleware/limit.js | 78 - node_modules/connect/lib/middleware/logger.js | 339 --- .../connect/lib/middleware/methodOverride.js | 40 - .../connect/lib/middleware/multipart.js | 133 -- node_modules/connect/lib/middleware/query.js | 46 - .../connect/lib/middleware/responseTime.js | 32 - .../connect/lib/middleware/session.js | 356 --- .../connect/lib/middleware/session/cookie.js | 140 -- .../connect/lib/middleware/session/memory.js | 129 -- .../connect/lib/middleware/session/session.js | 116 - .../connect/lib/middleware/session/store.js | 84 - node_modules/connect/lib/middleware/static.js | 95 - .../connect/lib/middleware/staticCache.js | 231 -- .../connect/lib/middleware/timeout.js | 55 - .../connect/lib/middleware/urlencoded.js | 78 - node_modules/connect/lib/middleware/vhost.js | 40 - node_modules/connect/lib/patch.js | 79 - node_modules/connect/lib/proto.js | 230 -- .../connect/lib/public/directory.html | 81 - node_modules/connect/lib/public/error.html | 14 - node_modules/connect/lib/public/favicon.ico | Bin 1406 -> 0 bytes .../connect/lib/public/icons/page.png | Bin 635 -> 0 bytes .../connect/lib/public/icons/page_add.png | Bin 739 -> 0 bytes .../connect/lib/public/icons/page_attach.png | Bin 794 -> 0 bytes .../connect/lib/public/icons/page_code.png | Bin 818 -> 0 bytes .../connect/lib/public/icons/page_copy.png | Bin 663 -> 0 bytes .../connect/lib/public/icons/page_delete.png | Bin 740 -> 0 bytes .../connect/lib/public/icons/page_edit.png | Bin 807 -> 0 bytes .../connect/lib/public/icons/page_error.png | Bin 793 -> 0 bytes .../connect/lib/public/icons/page_excel.png | Bin 817 -> 0 bytes .../connect/lib/public/icons/page_find.png | Bin 879 -> 0 bytes .../connect/lib/public/icons/page_gear.png | Bin 833 -> 0 bytes .../connect/lib/public/icons/page_go.png | Bin 779 -> 0 bytes .../connect/lib/public/icons/page_green.png | Bin 621 -> 0 bytes .../connect/lib/public/icons/page_key.png | Bin 801 -> 0 bytes .../lib/public/icons/page_lightning.png | Bin 839 -> 0 bytes .../connect/lib/public/icons/page_link.png | Bin 830 -> 0 bytes .../lib/public/icons/page_paintbrush.png | Bin 813 -> 0 bytes .../connect/lib/public/icons/page_paste.png | Bin 703 -> 0 bytes .../connect/lib/public/icons/page_red.png | Bin 641 -> 0 bytes .../connect/lib/public/icons/page_refresh.png | Bin 858 -> 0 bytes .../connect/lib/public/icons/page_save.png | Bin 774 -> 0 bytes .../connect/lib/public/icons/page_white.png | Bin 294 -> 0 bytes .../lib/public/icons/page_white_acrobat.png | Bin 591 -> 0 bytes .../public/icons/page_white_actionscript.png | Bin 664 -> 0 bytes .../lib/public/icons/page_white_add.png | Bin 512 -> 0 bytes .../connect/lib/public/icons/page_white_c.png | Bin 587 -> 0 bytes .../lib/public/icons/page_white_camera.png | Bin 656 -> 0 bytes .../lib/public/icons/page_white_cd.png | Bin 666 -> 0 bytes .../lib/public/icons/page_white_code.png | Bin 603 -> 0 bytes .../lib/public/icons/page_white_code_red.png | Bin 587 -> 0 bytes .../public/icons/page_white_coldfusion.png | Bin 592 -> 0 bytes .../public/icons/page_white_compressed.png | Bin 724 -> 0 bytes .../lib/public/icons/page_white_copy.png | Bin 309 -> 0 bytes .../lib/public/icons/page_white_cplusplus.png | Bin 621 -> 0 bytes .../lib/public/icons/page_white_csharp.png | Bin 700 -> 0 bytes .../lib/public/icons/page_white_cup.png | Bin 639 -> 0 bytes .../lib/public/icons/page_white_database.png | Bin 579 -> 0 bytes .../lib/public/icons/page_white_delete.png | Bin 536 -> 0 bytes .../lib/public/icons/page_white_dvd.png | Bin 638 -> 0 bytes .../lib/public/icons/page_white_edit.png | Bin 618 -> 0 bytes .../lib/public/icons/page_white_error.png | Bin 623 -> 0 bytes .../lib/public/icons/page_white_excel.png | Bin 663 -> 0 bytes .../lib/public/icons/page_white_find.png | Bin 676 -> 0 bytes .../lib/public/icons/page_white_flash.png | Bin 582 -> 0 bytes .../lib/public/icons/page_white_freehand.png | Bin 639 -> 0 bytes .../lib/public/icons/page_white_gear.png | Bin 402 -> 0 bytes .../lib/public/icons/page_white_get.png | Bin 516 -> 0 bytes .../lib/public/icons/page_white_go.png | Bin 612 -> 0 bytes .../connect/lib/public/icons/page_white_h.png | Bin 603 -> 0 bytes .../public/icons/page_white_horizontal.png | Bin 296 -> 0 bytes .../lib/public/icons/page_white_key.png | Bin 616 -> 0 bytes .../lib/public/icons/page_white_lightning.png | Bin 669 -> 0 bytes .../lib/public/icons/page_white_link.png | Bin 614 -> 0 bytes .../lib/public/icons/page_white_magnify.png | Bin 554 -> 0 bytes .../lib/public/icons/page_white_medal.png | Bin 706 -> 0 bytes .../lib/public/icons/page_white_office.png | Bin 779 -> 0 bytes .../lib/public/icons/page_white_paint.png | Bin 688 -> 0 bytes .../public/icons/page_white_paintbrush.png | Bin 618 -> 0 bytes .../lib/public/icons/page_white_paste.png | Bin 620 -> 0 bytes .../lib/public/icons/page_white_php.png | Bin 538 -> 0 bytes .../lib/public/icons/page_white_picture.png | Bin 650 -> 0 bytes .../public/icons/page_white_powerpoint.png | Bin 588 -> 0 bytes .../lib/public/icons/page_white_put.png | Bin 523 -> 0 bytes .../lib/public/icons/page_white_ruby.png | Bin 626 -> 0 bytes .../lib/public/icons/page_white_stack.png | Bin 317 -> 0 bytes .../lib/public/icons/page_white_star.png | Bin 565 -> 0 bytes .../lib/public/icons/page_white_swoosh.png | Bin 634 -> 0 bytes .../lib/public/icons/page_white_text.png | Bin 342 -> 0 bytes .../public/icons/page_white_text_width.png | Bin 315 -> 0 bytes .../lib/public/icons/page_white_tux.png | Bin 668 -> 0 bytes .../lib/public/icons/page_white_vector.png | Bin 644 -> 0 bytes .../public/icons/page_white_visualstudio.png | Bin 702 -> 0 bytes .../lib/public/icons/page_white_width.png | Bin 309 -> 0 bytes .../lib/public/icons/page_white_word.png | Bin 651 -> 0 bytes .../lib/public/icons/page_white_world.png | Bin 734 -> 0 bytes .../lib/public/icons/page_white_wrench.png | Bin 613 -> 0 bytes .../lib/public/icons/page_white_zip.png | Bin 386 -> 0 bytes .../connect/lib/public/icons/page_word.png | Bin 777 -> 0 bytes .../connect/lib/public/icons/page_world.png | Bin 903 -> 0 bytes node_modules/connect/lib/public/style.css | 141 -- node_modules/connect/lib/utils.js | 404 ---- node_modules/connect/package.json | 53 - node_modules/connect/test.js | 40 - node_modules/express/.npmignore | 9 - node_modules/express/.travis.yml | 4 - node_modules/express/History.md | 1115 ---------- node_modules/express/LICENSE | 22 - node_modules/express/Makefile | 33 - node_modules/express/Readme.md | 180 -- node_modules/express/bin/express | 422 ---- node_modules/express/client.js | 25 - node_modules/express/index.js | 4 - node_modules/express/lib/application.js | 531 ----- node_modules/express/lib/express.js | 92 - node_modules/express/lib/middleware.js | 33 - node_modules/express/lib/request.js | 526 ----- node_modules/express/lib/response.js | 756 ------- node_modules/express/lib/router/index.js | 273 --- node_modules/express/lib/router/route.js | 72 - node_modules/express/lib/utils.js | 313 --- node_modules/express/lib/view.js | 76 - node_modules/express/package.json | 87 - node_modules/express/test.js | 20 - node_modules/redis/.npmignore | 1 - node_modules/redis/README.md | 707 ------ node_modules/redis/benches/buffer_bench.js | 89 - node_modules/redis/benches/hiredis_parser.js | 38 - node_modules/redis/benches/re_sub_test.js | 14 - node_modules/redis/benches/reconnect_test.js | 29 - node_modules/redis/benches/stress/codec.js | 16 - .../redis/benches/stress/pubsub/pub.js | 38 - node_modules/redis/benches/stress/pubsub/run | 10 - .../redis/benches/stress/pubsub/server.js | 23 - .../redis/benches/stress/rpushblpop/pub.js | 49 - .../redis/benches/stress/rpushblpop/run | 6 - .../redis/benches/stress/rpushblpop/server.js | 30 - node_modules/redis/benches/stress/speed/00 | 13 - node_modules/redis/benches/stress/speed/plot | 13 - .../redis/benches/stress/speed/size-rate.png | Bin 6672 -> 0 bytes .../redis/benches/stress/speed/speed.js | 84 - node_modules/redis/benches/sub_quit_test.js | 18 - node_modules/redis/changelog.md | 240 -- node_modules/redis/diff_multi_bench_output.js | 90 - node_modules/redis/examples/auth.js | 5 - .../redis/examples/backpressure_drain.js | 33 - node_modules/redis/examples/eval.js | 14 - node_modules/redis/examples/extend.js | 24 - node_modules/redis/examples/file.js | 32 - node_modules/redis/examples/mget.js | 5 - node_modules/redis/examples/monitor.js | 10 - node_modules/redis/examples/multi.js | 46 - node_modules/redis/examples/multi2.js | 29 - node_modules/redis/examples/psubscribe.js | 33 - node_modules/redis/examples/pub_sub.js | 41 - node_modules/redis/examples/simple.js | 24 - node_modules/redis/examples/sort.js | 17 - node_modules/redis/examples/subqueries.js | 15 - node_modules/redis/examples/subquery.js | 19 - node_modules/redis/examples/unix_socket.js | 29 - node_modules/redis/examples/web_server.js | 31 - node_modules/redis/generate_commands.js | 39 - node_modules/redis/index.js | 1144 ---------- node_modules/redis/lib/commands.js | 149 -- node_modules/redis/lib/parser/hiredis.js | 46 - node_modules/redis/lib/parser/javascript.js | 301 --- node_modules/redis/lib/queue.js | 59 - node_modules/redis/lib/to_array.js | 12 - node_modules/redis/lib/util.js | 11 - node_modules/redis/multi_bench.js | 222 -- node_modules/redis/package.json | 40 - node_modules/redis/test.js | 1955 ----------------- node_modules/socket.io/.npmignore | 3 - node_modules/socket.io/.travis.yml | 6 - node_modules/socket.io/History.md | 315 --- node_modules/socket.io/LICENSE | 22 - node_modules/socket.io/Makefile | 31 - node_modules/socket.io/Readme.md | 364 --- node_modules/socket.io/TODO | 1 - .../socket.io/benchmarks/decode.bench.js | 64 - .../socket.io/benchmarks/encode.bench.js | 90 - node_modules/socket.io/benchmarks/runner.js | 55 - node_modules/socket.io/index.js | 8 - node_modules/socket.io/lib/logger.js | 97 - node_modules/socket.io/lib/manager.js | 1027 --------- node_modules/socket.io/lib/namespace.js | 355 --- node_modules/socket.io/lib/parser.js | 249 --- node_modules/socket.io/lib/socket.io.js | 143 -- node_modules/socket.io/lib/socket.js | 369 ---- node_modules/socket.io/lib/static.js | 395 ---- node_modules/socket.io/lib/store.js | 98 - node_modules/socket.io/lib/stores/memory.js | 143 -- node_modules/socket.io/lib/stores/redis.js | 269 --- node_modules/socket.io/lib/transport.js | 534 ----- .../socket.io/lib/transports/flashsocket.js | 129 -- .../socket.io/lib/transports/htmlfile.js | 82 - .../socket.io/lib/transports/http-polling.js | 147 -- node_modules/socket.io/lib/transports/http.js | 121 - .../socket.io/lib/transports/index.js | 12 - .../socket.io/lib/transports/jsonp-polling.js | 97 - .../socket.io/lib/transports/websocket.js | 36 - .../lib/transports/websocket/default.js | 362 --- .../lib/transports/websocket/hybi-07-12.js | 622 ------ .../lib/transports/websocket/hybi-16.js | 622 ------ .../lib/transports/websocket/index.js | 11 - .../socket.io/lib/transports/xhr-polling.js | 69 - node_modules/socket.io/lib/util.js | 50 - node_modules/socket.io/package.json | 72 - 226 files changed, 21908 deletions(-) delete mode 120000 node_modules/.bin/express delete mode 100644 node_modules/connect/.npmignore delete mode 100644 node_modules/connect/.travis.yml delete mode 100644 node_modules/connect/LICENSE delete mode 100644 node_modules/connect/index.js delete mode 100644 node_modules/connect/lib/cache.js delete mode 100644 node_modules/connect/lib/connect.js delete mode 100644 node_modules/connect/lib/index.js delete mode 100644 node_modules/connect/lib/middleware/basicAuth.js delete mode 100644 node_modules/connect/lib/middleware/bodyParser.js delete mode 100644 node_modules/connect/lib/middleware/compress.js delete mode 100644 node_modules/connect/lib/middleware/cookieParser.js delete mode 100644 node_modules/connect/lib/middleware/cookieSession.js delete mode 100644 node_modules/connect/lib/middleware/csrf.js delete mode 100644 node_modules/connect/lib/middleware/directory.js delete mode 100644 node_modules/connect/lib/middleware/errorHandler.js delete mode 100644 node_modules/connect/lib/middleware/favicon.js delete mode 100644 node_modules/connect/lib/middleware/json.js delete mode 100644 node_modules/connect/lib/middleware/limit.js delete mode 100644 node_modules/connect/lib/middleware/logger.js delete mode 100644 node_modules/connect/lib/middleware/methodOverride.js delete mode 100644 node_modules/connect/lib/middleware/multipart.js delete mode 100644 node_modules/connect/lib/middleware/query.js delete mode 100644 node_modules/connect/lib/middleware/responseTime.js delete mode 100644 node_modules/connect/lib/middleware/session.js delete mode 100644 node_modules/connect/lib/middleware/session/cookie.js delete mode 100644 node_modules/connect/lib/middleware/session/memory.js delete mode 100644 node_modules/connect/lib/middleware/session/session.js delete mode 100644 node_modules/connect/lib/middleware/session/store.js delete mode 100644 node_modules/connect/lib/middleware/static.js delete mode 100644 node_modules/connect/lib/middleware/staticCache.js delete mode 100644 node_modules/connect/lib/middleware/timeout.js delete mode 100644 node_modules/connect/lib/middleware/urlencoded.js delete mode 100644 node_modules/connect/lib/middleware/vhost.js delete mode 100644 node_modules/connect/lib/patch.js delete mode 100644 node_modules/connect/lib/proto.js delete mode 100644 node_modules/connect/lib/public/directory.html delete mode 100644 node_modules/connect/lib/public/error.html delete mode 100644 node_modules/connect/lib/public/favicon.ico delete mode 100644 node_modules/connect/lib/public/icons/page.png delete mode 100644 node_modules/connect/lib/public/icons/page_add.png delete mode 100644 node_modules/connect/lib/public/icons/page_attach.png delete mode 100644 node_modules/connect/lib/public/icons/page_code.png delete mode 100644 node_modules/connect/lib/public/icons/page_copy.png delete mode 100644 node_modules/connect/lib/public/icons/page_delete.png delete mode 100644 node_modules/connect/lib/public/icons/page_edit.png delete mode 100644 node_modules/connect/lib/public/icons/page_error.png delete mode 100644 node_modules/connect/lib/public/icons/page_excel.png delete mode 100644 node_modules/connect/lib/public/icons/page_find.png delete mode 100644 node_modules/connect/lib/public/icons/page_gear.png delete mode 100644 node_modules/connect/lib/public/icons/page_go.png delete mode 100644 node_modules/connect/lib/public/icons/page_green.png delete mode 100644 node_modules/connect/lib/public/icons/page_key.png delete mode 100644 node_modules/connect/lib/public/icons/page_lightning.png delete mode 100644 node_modules/connect/lib/public/icons/page_link.png delete mode 100644 node_modules/connect/lib/public/icons/page_paintbrush.png delete mode 100644 node_modules/connect/lib/public/icons/page_paste.png delete mode 100644 node_modules/connect/lib/public/icons/page_red.png delete mode 100644 node_modules/connect/lib/public/icons/page_refresh.png delete mode 100644 node_modules/connect/lib/public/icons/page_save.png delete mode 100644 node_modules/connect/lib/public/icons/page_white.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_acrobat.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_actionscript.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_add.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_c.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_camera.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_cd.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_code.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_code_red.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_coldfusion.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_compressed.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_copy.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_cplusplus.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_csharp.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_cup.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_database.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_delete.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_dvd.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_edit.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_error.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_excel.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_find.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_flash.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_freehand.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_gear.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_get.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_go.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_h.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_horizontal.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_key.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_lightning.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_link.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_magnify.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_medal.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_office.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_paint.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_paintbrush.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_paste.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_php.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_picture.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_powerpoint.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_put.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_ruby.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_stack.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_star.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_swoosh.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_text.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_text_width.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_tux.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_vector.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_visualstudio.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_width.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_word.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_world.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_wrench.png delete mode 100644 node_modules/connect/lib/public/icons/page_white_zip.png delete mode 100644 node_modules/connect/lib/public/icons/page_word.png delete mode 100644 node_modules/connect/lib/public/icons/page_world.png delete mode 100644 node_modules/connect/lib/public/style.css delete mode 100644 node_modules/connect/lib/utils.js delete mode 100644 node_modules/connect/package.json delete mode 100644 node_modules/connect/test.js delete mode 100644 node_modules/express/.npmignore delete mode 100644 node_modules/express/.travis.yml delete mode 100644 node_modules/express/History.md delete mode 100644 node_modules/express/LICENSE delete mode 100644 node_modules/express/Makefile delete mode 100644 node_modules/express/Readme.md delete mode 100644 node_modules/express/bin/express delete mode 100644 node_modules/express/client.js delete mode 100644 node_modules/express/index.js delete mode 100644 node_modules/express/lib/application.js delete mode 100644 node_modules/express/lib/express.js delete mode 100644 node_modules/express/lib/middleware.js delete mode 100644 node_modules/express/lib/request.js delete mode 100644 node_modules/express/lib/response.js delete mode 100644 node_modules/express/lib/router/index.js delete mode 100644 node_modules/express/lib/router/route.js delete mode 100644 node_modules/express/lib/utils.js delete mode 100644 node_modules/express/lib/view.js delete mode 100644 node_modules/express/package.json delete mode 100644 node_modules/express/test.js delete mode 100644 node_modules/redis/.npmignore delete mode 100644 node_modules/redis/README.md delete mode 100644 node_modules/redis/benches/buffer_bench.js delete mode 100644 node_modules/redis/benches/hiredis_parser.js delete mode 100644 node_modules/redis/benches/re_sub_test.js delete mode 100644 node_modules/redis/benches/reconnect_test.js delete mode 100644 node_modules/redis/benches/stress/codec.js delete mode 100644 node_modules/redis/benches/stress/pubsub/pub.js delete mode 100644 node_modules/redis/benches/stress/pubsub/run delete mode 100644 node_modules/redis/benches/stress/pubsub/server.js delete mode 100644 node_modules/redis/benches/stress/rpushblpop/pub.js delete mode 100644 node_modules/redis/benches/stress/rpushblpop/run delete mode 100644 node_modules/redis/benches/stress/rpushblpop/server.js delete mode 100644 node_modules/redis/benches/stress/speed/00 delete mode 100644 node_modules/redis/benches/stress/speed/plot delete mode 100644 node_modules/redis/benches/stress/speed/size-rate.png delete mode 100644 node_modules/redis/benches/stress/speed/speed.js delete mode 100644 node_modules/redis/benches/sub_quit_test.js delete mode 100644 node_modules/redis/changelog.md delete mode 100644 node_modules/redis/diff_multi_bench_output.js delete mode 100644 node_modules/redis/examples/auth.js delete mode 100644 node_modules/redis/examples/backpressure_drain.js delete mode 100644 node_modules/redis/examples/eval.js delete mode 100644 node_modules/redis/examples/extend.js delete mode 100644 node_modules/redis/examples/file.js delete mode 100644 node_modules/redis/examples/mget.js delete mode 100644 node_modules/redis/examples/monitor.js delete mode 100644 node_modules/redis/examples/multi.js delete mode 100644 node_modules/redis/examples/multi2.js delete mode 100644 node_modules/redis/examples/psubscribe.js delete mode 100644 node_modules/redis/examples/pub_sub.js delete mode 100644 node_modules/redis/examples/simple.js delete mode 100644 node_modules/redis/examples/sort.js delete mode 100644 node_modules/redis/examples/subqueries.js delete mode 100644 node_modules/redis/examples/subquery.js delete mode 100644 node_modules/redis/examples/unix_socket.js delete mode 100644 node_modules/redis/examples/web_server.js delete mode 100644 node_modules/redis/generate_commands.js delete mode 100644 node_modules/redis/index.js delete mode 100644 node_modules/redis/lib/commands.js delete mode 100644 node_modules/redis/lib/parser/hiredis.js delete mode 100644 node_modules/redis/lib/parser/javascript.js delete mode 100644 node_modules/redis/lib/queue.js delete mode 100644 node_modules/redis/lib/to_array.js delete mode 100644 node_modules/redis/lib/util.js delete mode 100644 node_modules/redis/multi_bench.js delete mode 100644 node_modules/redis/package.json delete mode 100644 node_modules/redis/test.js delete mode 100644 node_modules/socket.io/.npmignore delete mode 100644 node_modules/socket.io/.travis.yml delete mode 100644 node_modules/socket.io/History.md delete mode 100644 node_modules/socket.io/LICENSE delete mode 100644 node_modules/socket.io/Makefile delete mode 100644 node_modules/socket.io/Readme.md delete mode 100644 node_modules/socket.io/TODO delete mode 100644 node_modules/socket.io/benchmarks/decode.bench.js delete mode 100644 node_modules/socket.io/benchmarks/encode.bench.js delete mode 100644 node_modules/socket.io/benchmarks/runner.js delete mode 100644 node_modules/socket.io/index.js delete mode 100644 node_modules/socket.io/lib/logger.js delete mode 100644 node_modules/socket.io/lib/manager.js delete mode 100644 node_modules/socket.io/lib/namespace.js delete mode 100644 node_modules/socket.io/lib/parser.js delete mode 100644 node_modules/socket.io/lib/socket.io.js delete mode 100644 node_modules/socket.io/lib/socket.js delete mode 100644 node_modules/socket.io/lib/static.js delete mode 100644 node_modules/socket.io/lib/store.js delete mode 100644 node_modules/socket.io/lib/stores/memory.js delete mode 100644 node_modules/socket.io/lib/stores/redis.js delete mode 100644 node_modules/socket.io/lib/transport.js delete mode 100644 node_modules/socket.io/lib/transports/flashsocket.js delete mode 100644 node_modules/socket.io/lib/transports/htmlfile.js delete mode 100644 node_modules/socket.io/lib/transports/http-polling.js delete mode 100644 node_modules/socket.io/lib/transports/http.js delete mode 100644 node_modules/socket.io/lib/transports/index.js delete mode 100644 node_modules/socket.io/lib/transports/jsonp-polling.js delete mode 100644 node_modules/socket.io/lib/transports/websocket.js delete mode 100644 node_modules/socket.io/lib/transports/websocket/default.js delete mode 100644 node_modules/socket.io/lib/transports/websocket/hybi-07-12.js delete mode 100644 node_modules/socket.io/lib/transports/websocket/hybi-16.js delete mode 100644 node_modules/socket.io/lib/transports/websocket/index.js delete mode 100644 node_modules/socket.io/lib/transports/xhr-polling.js delete mode 100644 node_modules/socket.io/lib/util.js delete mode 100644 node_modules/socket.io/package.json diff --git a/node_modules/.bin/express b/node_modules/.bin/express deleted file mode 120000 index b741d99c66..0000000000 --- a/node_modules/.bin/express +++ /dev/null @@ -1 +0,0 @@ -../express/bin/express \ No newline at end of file diff --git a/node_modules/connect/.npmignore b/node_modules/connect/.npmignore deleted file mode 100644 index 9046dde51c..0000000000 --- a/node_modules/connect/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -*.markdown -*.md -.git* -Makefile -benchmarks/ -docs/ -examples/ -install.sh -support/ -test/ -.DS_Store -coverage.html diff --git a/node_modules/connect/.travis.yml b/node_modules/connect/.travis.yml deleted file mode 100644 index c46b989508..0000000000 --- a/node_modules/connect/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.6" - - "0.8" - - "0.10" \ No newline at end of file diff --git a/node_modules/connect/LICENSE b/node_modules/connect/LICENSE deleted file mode 100644 index 0c5d22d96d..0000000000 --- a/node_modules/connect/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(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/connect/index.js b/node_modules/connect/index.js deleted file mode 100644 index 23240eedaa..0000000000 --- a/node_modules/connect/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.CONNECT_COV - ? require('./lib-cov/connect') - : require('./lib/connect'); \ No newline at end of file diff --git a/node_modules/connect/lib/cache.js b/node_modules/connect/lib/cache.js deleted file mode 100644 index 052fcdb3d5..0000000000 --- a/node_modules/connect/lib/cache.js +++ /dev/null @@ -1,81 +0,0 @@ - -/*! - * 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/connect/lib/connect.js b/node_modules/connect/lib/connect.js deleted file mode 100644 index c4f81c03a2..0000000000 --- a/node_modules/connect/lib/connect.js +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * 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.6'; - -/** - * 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/connect/lib/index.js b/node_modules/connect/lib/index.js deleted file mode 100644 index 2618ddca41..0000000000 --- a/node_modules/connect/lib/index.js +++ /dev/null @@ -1,50 +0,0 @@ - -/** - * 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/connect/lib/middleware/basicAuth.js b/node_modules/connect/lib/middleware/basicAuth.js deleted file mode 100644 index bc7ec97aa7..0000000000 --- a/node_modules/connect/lib/middleware/basicAuth.js +++ /dev/null @@ -1,103 +0,0 @@ - -/*! - * 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/connect/lib/middleware/bodyParser.js b/node_modules/connect/lib/middleware/bodyParser.js deleted file mode 100644 index 9f692cdcaa..0000000000 --- a/node_modules/connect/lib/middleware/bodyParser.js +++ /dev/null @@ -1,61 +0,0 @@ - -/*! - * 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/connect/lib/middleware/compress.js b/node_modules/connect/lib/middleware/compress.js deleted file mode 100644 index e71ea8c827..0000000000 --- a/node_modules/connect/lib/middleware/compress.js +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * Connect - compress - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var zlib = require('zlib'); - -/** - * 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')); - * }; - * - * 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; - - return function compress(req, res, next){ - var accept = req.headers['accept-encoding'] - , vary = res.getHeader('Vary') - , write = res.write - , end = res.end - , stream - , method; - - // vary - if (!vary) { - res.setHeader('Vary', 'Accept-Encoding'); - } else if (!~vary.indexOf('Accept-Encoding')) { - res.setHeader('Vary', vary + ', Accept-Encoding'); - } - - // 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) this.write(chunk, encoding); - return stream - ? stream.end() - : end.call(res); - }; - - res.on('header', function(){ - 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(); - }; -}; diff --git a/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/connect/lib/middleware/cookieParser.js deleted file mode 100644 index 5da23f2580..0000000000 --- a/node_modules/connect/lib/middleware/cookieParser.js +++ /dev/null @@ -1,62 +0,0 @@ - -/*! - * 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/connect/lib/middleware/cookieSession.js b/node_modules/connect/lib/middleware/cookieSession.js deleted file mode 100644 index 402fd55f4b..0000000000 --- a/node_modules/connect/lib/middleware/cookieSession.js +++ /dev/null @@ -1,117 +0,0 @@ - -/*! - * 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) - , secured = cookie.secure && tls; - - // only send secure cookies via https - if (cookie.secure && !secured) 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/connect/lib/middleware/csrf.js b/node_modules/connect/lib/middleware/csrf.js deleted file mode 100644 index e3c353ea76..0000000000 --- a/node_modules/connect/lib/middleware/csrf.js +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * Connect - csrf - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * 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 = utils.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']); -} diff --git a/node_modules/connect/lib/middleware/directory.js b/node_modules/connect/lib/middleware/directory.js deleted file mode 100644 index 1c925a7da3..0000000000 --- a/node_modules/connect/lib/middleware/directory.js +++ /dev/null @@ -1,229 +0,0 @@ - -/*! - * 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 '' + part + ''; - }).join(' / '); -} - -/** - * Map html `files`, returning an html unordered list. - */ - -function html(files, dir, useIcons) { - return ''; -} - -/** - * 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/connect/lib/middleware/errorHandler.js b/node_modules/connect/lib/middleware/errorHandler.js deleted file mode 100644 index 4a84edca01..0000000000 --- a/node_modules/connect/lib/middleware/errorHandler.js +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * 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 '
  • ' + v + '
  • '; }).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/connect/lib/middleware/favicon.js b/node_modules/connect/lib/middleware/favicon.js deleted file mode 100644 index ef543544ce..0000000000 --- a/node_modules/connect/lib/middleware/favicon.js +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * 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/connect/lib/middleware/json.js b/node_modules/connect/lib/middleware/json.js deleted file mode 100644 index 17e591838a..0000000000 --- a/node_modules/connect/lib/middleware/json.js +++ /dev/null @@ -1,86 +0,0 @@ - -/*! - * 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 ('application/json' != 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(); - }); - }); - }; -}; diff --git a/node_modules/connect/lib/middleware/limit.js b/node_modules/connect/lib/middleware/limit.js deleted file mode 100644 index 09bd1c47ce..0000000000 --- a/node_modules/connect/lib/middleware/limit.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * 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/connect/lib/middleware/logger.js b/node_modules/connect/lib/middleware/logger.js deleted file mode 100644 index de72244991..0000000000 --- a/node_modules/connect/lib/middleware/logger.js +++ /dev/null @@ -1,339 +0,0 @@ -/*! - * 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 '\033[90m' + req.method - + ' ' + req.originalUrl + ' ' - + '\033[' + color + 'm' + res.statusCode - + ' \033[90m' - + (new Date - req._startTime) - + 'ms' + len - + '\033[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/connect/lib/middleware/methodOverride.js b/node_modules/connect/lib/middleware/methodOverride.js deleted file mode 100644 index aaf4014f26..0000000000 --- a/node_modules/connect/lib/middleware/methodOverride.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - methodOverride - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * 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) { - req.originalMethod = req.originalMethod || req.method; - - // req.body - if (req.body && key in req.body) { - req.method = req.body[key].toUpperCase(); - delete req.body[key]; - // check X-HTTP-Method-Override - } else if (req.headers['x-http-method-override']) { - req.method = req.headers['x-http-method-override'].toUpperCase(); - } - - next(); - }; -}; - diff --git a/node_modules/connect/lib/middleware/multipart.js b/node_modules/connect/lib/middleware/multipart.js deleted file mode 100644 index 7b26fae807..0000000000 --- a/node_modules/connect/lib/middleware/multipart.js +++ /dev/null @@ -1,133 +0,0 @@ -/*! - * 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/connect/lib/middleware/query.js b/node_modules/connect/lib/middleware/query.js deleted file mode 100644 index 93fc5d347b..0000000000 --- a/node_modules/connect/lib/middleware/query.js +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * 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/connect/lib/middleware/responseTime.js b/node_modules/connect/lib/middleware/responseTime.js deleted file mode 100644 index 62abc04948..0000000000 --- a/node_modules/connect/lib/middleware/responseTime.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * 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/connect/lib/middleware/session.js b/node_modules/connect/lib/middleware/session.js deleted file mode 100644 index 9be6c8b6e8..0000000000 --- a/node_modules/connect/lib/middleware/session.js +++ /dev/null @@ -1,356 +0,0 @@ - -/*! - * 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') - , 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('

    views: ' + sess.views + '

    '); - * res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); - * 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 = utils.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) - , secured = cookie.secure && tls - , isNew = unsignedCookie != req.sessionID; - - // only send secure cookies via https - if (cookie.secure && !secured) 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/connect/lib/middleware/session/cookie.js b/node_modules/connect/lib/middleware/session/cookie.js deleted file mode 100644 index cdce2a5e67..0000000000 --- a/node_modules/connect/lib/middleware/session/cookie.js +++ /dev/null @@ -1,140 +0,0 @@ - -/*! - * 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/connect/lib/middleware/session/memory.js b/node_modules/connect/lib/middleware/session/memory.js deleted file mode 100644 index fb93939280..0000000000 --- a/node_modules/connect/lib/middleware/session/memory.js +++ /dev/null @@ -1,129 +0,0 @@ - -/*! - * 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/connect/lib/middleware/session/session.js b/node_modules/connect/lib/middleware/session/session.js deleted file mode 100644 index 0dd4b40072..0000000000 --- a/node_modules/connect/lib/middleware/session/session.js +++ /dev/null @@ -1,116 +0,0 @@ - -/*! - * 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/connect/lib/middleware/session/store.js b/node_modules/connect/lib/middleware/session/store.js deleted file mode 100644 index 54294cbdf7..0000000000 --- a/node_modules/connect/lib/middleware/session/store.js +++ /dev/null @@ -1,84 +0,0 @@ - -/*! - * 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/connect/lib/middleware/static.js b/node_modules/connect/lib/middleware/static.js deleted file mode 100644 index f69b58e8a1..0000000000 --- a/node_modules/connect/lib/middleware/static.js +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * 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 static(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('static() root path required'); - - // default redirect - var redirect = false !== options.redirect; - - return function static(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 = 301; - 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/connect/lib/middleware/staticCache.js b/node_modules/connect/lib/middleware/staticCache.js deleted file mode 100644 index 7354a8ffdb..0000000000 --- a/node_modules/connect/lib/middleware/staticCache.js +++ /dev/null @@ -1,231 +0,0 @@ - -/*! - * 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/connect/lib/middleware/timeout.js b/node_modules/connect/lib/middleware/timeout.js deleted file mode 100644 index dba4654d30..0000000000 --- a/node_modules/connect/lib/middleware/timeout.js +++ /dev/null @@ -1,55 +0,0 @@ -/*! - * 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 == 408`. - * - * @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/connect/lib/middleware/urlencoded.js b/node_modules/connect/lib/middleware/urlencoded.js deleted file mode 100644 index cceafc0c89..0000000000 --- a/node_modules/connect/lib/middleware/urlencoded.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * 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/connect/lib/middleware/vhost.js b/node_modules/connect/lib/middleware/vhost.js deleted file mode 100644 index abbb0500a7..0000000000 --- a/node_modules/connect/lib/middleware/vhost.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * 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/connect/lib/patch.js b/node_modules/connect/lib/patch.js deleted file mode 100644 index 7cf001255d..0000000000 --- a/node_modules/connect/lib/patch.js +++ /dev/null @@ -1,79 +0,0 @@ - -/*! - * 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/connect/lib/proto.js b/node_modules/connect/lib/proto.js deleted file mode 100644 index b304cf72ff..0000000000 --- a/node_modules/connect/lib/proto.js +++ /dev/null @@ -1,230 +0,0 @@ - -/*! - * 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 ' + 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', layer.handle.name || 'anonymous'); - 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/connect/lib/public/directory.html b/node_modules/connect/lib/public/directory.html deleted file mode 100644 index 2d63704214..0000000000 --- a/node_modules/connect/lib/public/directory.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - listing directory {directory} - - - - - -
    -

    {linked-path}

    - {files} -
    - - \ No newline at end of file diff --git a/node_modules/connect/lib/public/error.html b/node_modules/connect/lib/public/error.html deleted file mode 100644 index a6d3fafd87..0000000000 --- a/node_modules/connect/lib/public/error.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - {error} - - - -
    -

    {title}

    -

    {statusCode} {error}

    - -
    - - diff --git a/node_modules/connect/lib/public/favicon.ico b/node_modules/connect/lib/public/favicon.ico deleted file mode 100644 index 895fc96a76b68b4924f1c51d022e1b82fa0f461f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&}i&OouUjIY8@C}uZw4x5z5N2 zvEG^C^vXtt_xtJ?p3O32c(KTx;lsgZhW%5M85Sf}k-mf`L80)|7ga~M{a znlL=>m1Q`#uoPkbC~GtXMnhnDh5$DU1D6mx+;2QAKt3ZQFH}H~1y~00GcqzVg9QXw z_<%(a7y$V|wJgF=E>MgE#Aid|14}IyCM5MhEnxFF;pTzOK(>#80puP=gnOXwAd33` mpMe2}f66m3eB@_fcnmb^7!b1nO#opK8zcsj1F30)+jEP);68^d)m`eN0o>(5%D`Q(1;j>g@G;xlf`0VBQ`PFY?6)!N&f?*K}$p; zB!U=NBn{eB8${1}&-2_L*HuZp@ZP1@clS@cHp)4iM1ewzw59vko7eMM{e9z|%NNdX z0V;`?KKSzTCvTm5bc{L^CIKLUxc2X{i{ISz$8Sgf{q)1nXTP{`{s?9mQ$4&hPiKC- zY8q7(Y1Xu5iCf33=O4Vy(+|zQ?rW#gkKB0f%}?+6{G*qT22|DQB-73`YzA{N4W^=s zq0kQYcbtFfz zLz)H<&|z(Y4kBG67=JY6c|L1R-#TR>fC$3^Y%QEnYO1xHsf)+GU`3F<{J0kR(;pbF3)zyg$H+idfnl-wl5Wkh!vUH z4Z32YP=l_}1rZd1W_D&^$A($A+&a0e&P?xx0!ctY2}*<#p+qPVN*B(YzvAWXa*%bzq z7Fz41LKILT(GWohi9|LgIzSZBhb*Zf6R6O}WYQ4GOi&71s9lmll0x6;8&ILOl$j(c z0Z1T(6Tg09{?wd{moFHNN6PS?$|e>1MxSJ(0Z7o2)J-Zv|>acY@f`(Y@g7GwsEj5NLQo+q|HsxQ5}XSX_d@*^A9ZT9=A{W~j+$GyI1 zc4oqTHx@1FlRjw4XWyPN5i2~l_F3@aBk!0yu^aoRDvXy}8@HCjUVQUsuSH4$T5|r< zzZOn^?Wfa6y|Q($Hx4{ws+)wX6-HP4zo!S?4KJ@7PG@G3G{CjXs(p*kIrj6rHs7_y z+=<-=Q62s9FuWa^X~WKgJIAAZJR&XBB002ovPDHLkV1jCMPILeO diff --git a/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/connect/lib/public/icons/page_attach.png deleted file mode 100644 index 89ee2da0753040d1ba0a3487473a715a8fe89322..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 794 zcmV+#1LgdQP)i_t#ewV_0K6;=bl;e_Jt7$~$sQ)q$+ia<4Ec+jeaGt9oWH@O|2`W6&O0t!k{B9sUvLWxkCaPsd9W(`fa z;j-|^ZI^2XnzhgZWYRW-kP&J>DWPo`%;JaBX}or79k=+Jo@h%4Eo72tqev+cB?PjP zO<|ByL#>Tehyq$jR74O$B9WDW1`tK`LzYyL3A9iAcRxLkJ`I)n}v%Od-3H>j$OTBtk>(k-9o?8PqI=0 zB&f-+KOXVnjyKJlf4iHOtnuiE_4+ZVJ$dHjU<^o^YCjQ-wt^!;rPpBv(@pFO{9rdw98 z_s@3+yta93oyfL>7AD5}r=|`zS3Gm$_|(iSl8XBd9k%=91J0j2=ivT5cJ18ZmDjh{ z$-RMd{jQ#X79#Sc diff --git a/node_modules/connect/lib/public/icons/page_code.png b/node_modules/connect/lib/public/icons/page_code.png deleted file mode 100644 index f7ea90419d950f9e69d977a1f5847456d96a5f0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 818 zcmV-21I_%2P)@LCln44|RX7Ti z0HI3&7jPq){odH{?_{%nYVq_;n_c4WbUpvU(&Cvnj!vq|kVC-vpF6vp^;;e0mm6HW z+WPzA`AZ|;pPp$&dNjzrc??4rt`k%Q1l*u-BPD0MQ}Fbm8jnsyezNt7+u{23>t7Em zJtETY?ja9KrVs^!LJ$xEMF3-bAZO;-IQJavE60KA7fO$VY_%N)R6s>g5mW>fL4&aR z*EVgKKTBXm!=L?S0?xM zYqL@C$|EDF2q*3zWW7;PDZ}SK*IE8;i!3U62=qn80C&*I1Le7WwNP5EcX;_oh2dJn zf#HgBe4@r$GcjHjmj2vAfT%(YN?}kK=(*+1*DkNNc1H5R++vfBMhACi<5uFUU+N4+ z<&U*CPmWi}REa7C6-t>2im1CWv5Jkefxa6>)dEj-CAW wWa{_}BJ!}~75?MkfaCnj>Dn=~vkLS70Pk`;z)@TQj{pDw07*qoM6N<$f@imYHUIzs diff --git a/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/connect/lib/public/icons/page_copy.png deleted file mode 100644 index 195dc6d6c365d298e466026b37c1959d96119ea7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 663 zcmV;I0%-k-P)^@R5;6Z z(>-WZK@^7J_sq=QY_e{46@P+~LNG}sRzZsxQHvCsN*h5ir6^j7pq-$xu$N#V1gx}9 zClV7;5)7zih-s3DB)G=7|99>ji@So7-P24n=VQ(@GctDX!^_@$bj%oviY6e4Dh;od zooe%Wvs8LEKQ&&bL&@bwi=STIAI@!-gB2jC5+?y?VR~VkrNxam-`6*8&po|RZ5LpS zNKdJ%c4bTX`XjKsnecf%W>1%6WT?pKNdLLq{=(f(Col?P1+oq@R>)W(n=x!|*BIIh z6DJGw_w`)u6yN|vAhMteYK5#b%r5^v+VCFl1IGssaclZZMS{vs-LJ2$)n7DAr6==K z<29#%AXsBsDoO}SBaXR#_Ap!JKx)(1)3O2pj0_dYWz5By*X74fRT01$Fk%P_RzOMDtV?GU{nsYq#K8iy zb6qzLYDj`_f5$BwC*WE(t0m#xYJ*=jC2|HQYHh=pf#QG7oowi`h!L!{DB$8|qY{~X zu8@sU1tWq;n$XThR0%;45mdqXM892|{CJ@0DS*}>?ami06Q_^tvM~Y3K(_-`#m!8f z8f!QIrH4y#61;0Ym0cCoLl8{IPombPHtnn7%SbTdI&G-d>ZQo!_wBMF9nzX!g8HVY xYTJPGciz9XMh3w2fmZ(7v{)r*QZD48?mrio{~IaoqP z|1Ep}yDQG09bP~E^Dk?@JiKQJ z6-pO(3~IOP)IYisL6D6;oAEd;E%zR}{U$rMRNuD6nQV7nesKS>)yLo7JuDCrD>Abi zbj3uW23?^GA}9jQ{M^8v?ejL?HaT7AX5WPZNkBmfN`w-jL?{tT7ykZt$%Yln?p_m~ z-?>&d(LD(jAd}h=LPltPQbO$*Wbyl@G-_k5jXbb#qffHY03>M1jfEqoPJQ6Mr=Byp=^jfzePZV1 zLjCmNi31hdIJHa%e;5g=1(`u3BRzfeExY%=VCu{loOr{`%2hUR*x>tL^W_TTaj);0 zpPR6CUD1+0>4TQ6zVfH3TQ;%l6#(_%yspK@3gcmG#Q4!WCPyLU93nMKk7E2pcA=l45({2jNho>sdF*A~bA zxX?-cp~y_z_kFf+yqu3m#QiB}03?Z&9vvR5TNgj<)($Vm)xq5G>|o2sFMag&6aNF+ WAT1?sQBYt20000iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj diff --git a/node_modules/connect/lib/public/icons/page_error.png b/node_modules/connect/lib/public/icons/page_error.png deleted file mode 100644 index f07f449a44ff2761bfc7b752db3d08d0e1238b02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 793 zcmV+!1LpjRP)lHwhvrAu0-@MQwt}+5~MQTtu}C0%;W( z1<{R?aHBz*g;pk%AyQVBR_Zu5m~;ES_vxI-O!vIF|H*|T{l`n#garr?$RMk>)?Y48 z(ZF2yTneKb};DNWF+jK)IF`6_IfJ{i|F3o%Q+l&4_HGBD|ACE8na_6>L z=s{^>-C(a7J$6=8A_%h5W!1K6dcL!D?XX+Ndk)oei?UundDpX_E&1Y&`)3P8#Ny0s z2Ag7_&ZPhyGj%)g&S6V2LNun1;iBQm#Fwlfv zgyESZR$X}2P;=RW!2zid1r$hBL{K7>2qi*f7>pT1=RdT3@-anEoH{ z={KFOO;Dh#bV*jaN>}M>RZqQd`S=6O9C3KpI~I>l%QFYfo;jqQYe5fcn`)+)zMm6P z4X&L(>gnN0!%J4^rhX->?$S5bY<=GEU%jc!KLL8sww-Eg;h z`H-yBHa)yfojYT}&G*GFc$<(Yja_q=lZvj66DC^O5%$B)|Z(CeD=n`|eM04SP; z>-=-l+xdJjA~vR6^xB#o{ehf~tSM`iwaQv$O<8NIHA}W_WOw*~ XD^gE}t;YAo00000NkvXXu0mjfl6ZQ> diff --git a/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/connect/lib/public/icons/page_excel.png deleted file mode 100644 index eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 diff --git a/node_modules/connect/lib/public/icons/page_find.png b/node_modules/connect/lib/public/icons/page_find.png deleted file mode 100644 index 2f193889f7ea091c292acdd684c595dcb206b5c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 879 zcmV-#1CacQP)@+1&aazfGU7ezSm^v zpACwO+tu0su66!(dT=`e05DeeCnCFJW(8|RKtKa{4LGONnx2V85A4m%PEQ?MEtR-esdM$pB-`H542D0)N2zSC6Imf)4L8?>%ZrW+H>xCKi$unm zvGZq-*Q%Aahx;C*=l+K%-?>XB)6TB$-L$r*`RUvlA`xP1NG2?)ge8@TQ4EN|Jks0u zcDg;oFC#-#R`YbWB`D?Q`1#y7l$LXhjSLf8AvQuB84}i#j0^!#g{VE#(K7h@5pFHy zSenl=@XBEdxp`h2Ji>CR%=qXJ7!e|?paKet-~;#ok#jETyeB(5&Bkhp;!+;51~G=) zH?L7xmDUu_h+a$+xuWom;AWW!mS$%%+436Rjc@}y?l1134kgD0AOf$OmjOR zstUlshZk$ZC!bAyIg{Y29z#&@3SJ;6D4+_eFume9^#TmMccC5u0J!ZCTnO6m$lnD| z5JeFHf`Xs~1vP>RLKI1GKDY<~pjr2&bi(fX;6Nj-ss@Ds0CcoO0H{JsEQkm{q03skAA);_bv3q{k31qwVo&s-q`Z?_e+j^w(WL? zl+uETs5+~xBU2};OqEE9ETLGwsMGe1%iTRNue)9}|0~E4B*@5#oRXZ9oRXZ9TqRep zPrGZuoOON4n@=uPbyP1y4G=+HktC6l(gZoFD>@_lXDrN?wo+zozGt3P=Qh+3L7+}q z2!WK7geXLnO3Vw;o12Skp%_E#+N#9;DDWP?Q-VS3B$v~Ha)dDzWn0zG~O(^_1!n0HYp-( z+;wPIdoFgQlpYV!10V>5@a)1LyGBMvoa}miyp(bxbMTM-FYNyx;V@TfYddyT00000 LNkvXXu0mjf90!wr diff --git a/node_modules/connect/lib/public/icons/page_go.png b/node_modules/connect/lib/public/icons/page_go.png deleted file mode 100644 index 80fe1ed0cc75fbb67e9398ae686641f8fb287238..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 779 zcmV+m1N8ifP)JNR2Ufr z!Apo%Wf%b9=l#x^8AolrB&K9H?Pg_|78WA8(M3toqE%3B#7*srcF`i*xhupr27%Nr ziguah1+mN)U5GNmyEfQ3-e%_i&-vb-Co#(>FJ+EhQEwjRYVQ(&UYy{U@%vbY||>@4x=B^vIqabI?L* z;-S&DS^V3-ni4^fl|HMkOEbgX)(390>A}|VIypb5Xee4g;7ck zwKh^A3Mi1Mh@eC$5lV!}Fw%sP623U`g3pd_Hr5sunLvTskx4}&Gm%Q6L}(l4x}jCe z*81q1_4-O*ffi~_nMslo?EQ8t*&Ec(pzEw$vc}pKn_Qp0>D7Jr>ATNC3w@9f|Y+U&+)#!t7l&wKp+nP{PQsb+fb=Yf!Fu&5j8vpRj{FT>jD z>d>$sx;A&+`n$HcF}&sYKSyR;=(=9tvvOj@hUG;~4qTYk^_@E=?$*^_pVh_bGnOt~ z;pEw)j{SK$XVc;qy181rT655gW9NG{(yeablViIL>cDI_ux8m>Pp{tY$J0lgo4#ax za?j0EA3s0S!f>{~ykN9h_RhM&g3K(E`q(dE(Rd49+%xMeR9{qlWnmd{s#(SQ>PmFtSQqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l diff --git a/node_modules/connect/lib/public/icons/page_key.png b/node_modules/connect/lib/public/icons/page_key.png deleted file mode 100644 index d6626cb09eb11a298b90a8a27b0d8eab41f49a82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 801 zcmV++1K#|JP)$lC4gU2-`f*>nhR-;k6IP7e>YO!0^w)WK%3$w02v-#>5Ep64PCP| zJihT#O|N+nT7XR2h7dAB?UEAOhJF^mol1i`QtQB`HSY}RE7=r! z)zaVIHr5?>v2Gz&fdYw&2ug$!p+txby(aWZ7(4QT)l2`jX7eMQ{>)lG6ev(fWKxmH zOr%mM5$6B%u~qGtCf40#`mbGj3s!n+^%wnJ&#rl>g<4Z)lB5J6f!?|AP275)Zswr* z%T}4~{;_(?waU!#?JabbF3Cy-kf0{R{z}6$e=5yMQKt3BPcl2>zoTPMqMwF;3!_n|>sT?~bK_-2O_m+o>GJ6h zt=+g$4n7y%1qVJI7*5Yw(hqM=JusY{d}*?U(Oj*gT655eZ>Ksn(qrd7v3}DX1}C>` z+X+8@+4-pVq_fxG zlU}~Ye!0+%>J+pPk+0wV{GM$QaYM?5ux)w2z59=S&H2+K?;gH$bZGzL&g5>G ft+noNiyiPkP9r@8gT|RZ00000NkvXXu0mjfuqTIu diff --git a/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/connect/lib/public/icons/page_lightning.png deleted file mode 100644 index 7e568703d6432c530224e443771a04fc1e2e59c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 839 zcmV-N1GxN&P)73{`^;G#xwAtHz%LU)4b zqTRU=ve1RNa3QT=ZM7C`iJ~QFQ*9t7<~pX$d^7W%^M8FFCkcQj-~0ZRTBCB(J0^iD z-~e!d9LR`f3#|=(>$bPvx_D-~2jC%pJ=n_e_OK zeJ_2b-KdDDh@@UlzBSMC;EPygH_MwjWBnPGQegihBV73D?-x9PlHL9A=(Vg=8^d<4 z<9r=UkxuIm)*CO=9e###7PztDxUv}e?$0)rQicmYhV`pQ%S!g@;K(?TVfhM#E?bM| z=B0gfb6h@a8bf5FVT-SV~6}?X}9lK@@Yynoty&1zdZP@?RfODsl=2XzzU% zS8gIN43How+9%bK2S@Xbc`O>`z5`%^;pXGy8^4f>9^3!Sp@|O&)m;dOa3q6d;4P-l zca|=H_{G&m?D_+&-}r{u-J$5T=(X4R&)q|O^gN8cgv;s#@5sEPT5_Z)oFo9Ac>l+I zc4ng5zHpps|9)<_Rw>5bKzE(M1j)dFWI_%OH$BJSz0?T+02W0)_a>#vFqb!*d|5wB zzBUN|M&ty51O@=i?kiDrjQ{{}e|^rU?OS|RdxxP1p5mAw36cX72#`R6UsoeCQFI~! z0ATITp!vfeYyQ?Dr=^5BAshfEa0nB~JG?nUa2Aur006MC*<9`)86SPS(W^`H2n+xi ztOWohsFfVfVWrI7PSKW}BmkyPoj(-|J?ES|BGd-}fIxr{00@ANnO*ZR`#)pee4I5T Rmm>fG002ovPDHLkV1i|Hc$okI diff --git a/node_modules/connect/lib/public/icons/page_link.png b/node_modules/connect/lib/public/icons/page_link.png deleted file mode 100644 index 312eab0914ab59271384686255d1be913a6b3add..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 830 zcmV-E1Ht@>P)VWgGzD=Y79#JI$lhEn`|2MpRa?Bt#-nSD~P0P(mbVe{KrOBoKnSsk>m|ML{6l zBosu@om4j#WzNLRAk+{k1JRvL(MfE&vvbb->v>W{*z*1_uMP}0cIRX*?mz+wk%*#O z%0D-+$B*g1nRkvI+_3E8Pr1NC6@5M&4vWaLCnNlr;lNlr4i91z&)eBGqL{L{GNu;Fof}GS9{gM5BJuH;2QWk8yuOZdB3pGR#s8bd~ zAmt<>3Q=YH$t5YJ5;7@+8Uh6=ktBgY6#6Pa%2F?h910?U8cLT43KAj$Z1*==ra&gILO{WkHfs(--F=bly9l~${z@AT>V$oat!YAD@M zBE0v_F{`g#^wOSP-u~!wvlmXdd*uqFqoZ0^{&nEMDU+=!>({S0wrQhFmoB}Yq1)~0 z^{A)L8Xjzdr(W4_exYO6u3a{4*kIeXZMJUR>Q=ksjW_p!rAwDKYUs90>6Q|C>56o@ zbrSq^Xk7Gq#>dAsn@un`Hz$?w$;Ss`%jV7L%9ShgHFV~C)6M>B`Tp%|nqPc&G*A3| z)Qe+}vT4-x^t1~XE@(6wR;^lPWMo9n*~E!cy~)YRsT2{`?fqeIw-e7N@mOA%UcCIq z_kH(_EK7|>pM*1Wt2^DaDAp|cvp*@(ZZDKpYkKC^?97(`0sb&XTXy7N#sB~S07*qo IM6N<$f;YmCWB>pF diff --git a/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/connect/lib/public/icons/page_paintbrush.png deleted file mode 100644 index 246a2f0b426faa0c7f5ba009e32b1deaf88d1288..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 813 zcmV+|1JeA7P)otxGRZMDZ!_a~nK|b_-`n%VosaL{KDuPV10`(1LIen8kX2Xff$3BE zah#djvFGJ&eE^89Pk*-O^+&d>FC~^GjRYVQ(uuPJyS|-v?9lxA-+tM5>1Qu*n+Ir1 z6KhA>X4$XDH6?-|E5oe1E?pQ5-M;2xw_ex!x}I2+b=}mPFW$U%^;o(Zg*LP!K^1kP%8ynsD^= z1y^6xD1#GLjO{VLdh@0GKY7;d$+NGukV)GRLPn^=q=dF%B#XaJrNP`0E6=}e&Gj3d zKJbQre*WXt!60_DnIzgMQc6S#fvjXxsE1v7;T;njHkdy2miIqAS(nX~o%cO+q+b#h z5tIleLWvL=dQE8OC#{%y*Tnku&K`Tuub&_ELI0t_ea{@3f>Jv&sYqld(%}3_GY3Dm z;O{3*Y?v^A`a|D;^qrM=ykI)U6QHd%WhO~VF!SGjGn0GOZrc3mGZudNl9{Q#X5&-F zuGwVReFLBjE5jr!!^-5*L%!I%PkYH#Hs5rMrEBl^)9)9XTD;xjHFxVZMc3~Dw6#k$ z(-S}RE$bgMHv6Z`mS5|u$$78sp4G-8b@lVkl`HtEv+MGn!F&bKcHPi$$oP_;=BrPf z$(~b3&p3CsuQxhoV$%jIR;`lB-s7FDX)xCTXuJ7ZyIQk96uIR=HBt%-P?N*bp`)EF zq14c}QM+O70NTOa@V~_)&GMZ$^cQDlkyOCa(H3Mf+6xhCuZh`VSN{cQBl5Ys9{cp( rh`2H3A^=GuC6HjQ*7|*0>;m{7QlnX3z3MSD00000NkvXXu0mjfR5FYo diff --git a/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/connect/lib/public/icons/page_paste.png deleted file mode 100644 index 968f073fdddc1cc0f0800b1ac4001cd9a55f053d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 703 zcmV;w0zmzVP)AVs!l4K}n~L(tL`6d4Up4iSWnZ3Qg~4n+_J zDGk-qQdogO5JUtO-d5pRp7Nd7_r1^a|M&Zq%mn9Oe((|e0sw%Ur!K7T1pojj=U#f? zQM`qbQrM^DPkwa?DK_be^~z<~RgSMIa<`xP_4P7gg2jCwJ{9^k!fsU=#Ti|%I3p;>90Qd+7|~0h&mIklA#nb>ATL2+v$&u)OBgB z;nsHb)I&QRKeX40H~~cIZxCd}5C} z=79lXoXK%6YlyLtsV$~bSm?Upq|DJh#{|*a7XMm`4QJWZ>s6nL2R1|&J z0VPEwJ9?!n`o5PKAjc->P1Gi8BY*%!5&FVp=#)$mMJYul1Jton}gujiUf??eOy!x&!tsjxy;=Q3_DdcXx=a^OBhW0N~`A@4xB0a*%F? l+@c^sQA%W+?pa#c`9H5UNfS6T{e=Jk002ovPDHLkV1grvM=byV diff --git a/node_modules/connect/lib/public/icons/page_red.png b/node_modules/connect/lib/public/icons/page_red.png deleted file mode 100644 index 0b18247da5850f3c2486373a3e179acd2772e8aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 641 zcmV-{0)G98P);68^@7JE5sw#jpE*579S@TLkU(6yap1yN*Zuy>-hV%Q_v4Ar&!63c8OBr(ZRhFu z_kWs36-AmgZCT>x!RqM;Zu9tqvoHI~k@UmYo_g(*J3c%2{N8}7I+|qKPQzv}7t>%W zsu&9G)UmCzkDYSw{fBnuW4j;1fKV_nicw`$8C6D=F_qu`zUiK$2Oc?5UVY+D(`I@R zW`KlwqLftWHH3Z2_XVNfKn>VgT~k=@- z+N>c>0|@A_HbI9Jn`v0~7cfIF(TS69zaomDS1QtgvaBBfGEPLHccO2~3jc>n^6}^HAEh-2#VxC7YYcDXv!L9X= z-R*SOUvIs;n`8(LxP4~^2|JsiN^hq6cU}5dn4v1~Kl{eT7pm&f$PoY`hyVe%y8G*S bxB&kH@RuR86sIAS00000NkvXXu0mjfZBi!% diff --git a/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/connect/lib/public/icons/page_refresh.png deleted file mode 100644 index cf347c7d4685128a4a447abb9fb8e939417644f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 858 zcmV-g1Eu_lP)`6pHR2Ufr z!EI=jWf;Km|8+n2IrHqe<9xxFVk)&(Nh?w$Xk`TAyvb=#e=0aySC z00NkRDM597_LiNIJ2M^qhuTvB004REvvU8@of{r?P8tmo3;+Pk0F0@*jAMhdOkS&1 zhJPPfQa;pP0|4+Yk%#j>X}o-s#EF1_DMV93FsfPP`G*>Ks>L&)Q}w2g%slu0kBfW1 z+*$*0BC^oTl6>OGIq(9BgG4|C90Dk-N_mPazGrQ7uHZ|>BLD!-KmZ)z1e^#?1Sf(M z!6m}K(^b|i%$TcA5bC}r$tAA?0C)g1@CgWliJ;NAk&ZF+-w#}$`-3nZ32C6IVKrHp zr+(!L2hRfF&AsTw>_@ z1y23;E%Oz}?q^Q2d($ayO;-sON2t7$w(Z|o0Pw1YnSp^}0PI+I5HnDNsFCA?oorkG z5sUIGIq=FSyxcj+xlhkm0en=52Bx3@02o12gdAU$_i?v6iyFMuc7P9#zQ-Hf; zVuV$t9P5`m)F2w1?t6{<8%wk{w-PP#Sj#%1MbsjrSI6n;D_@8q9`~W98dNQf$j=iI z6~hpgww&be%X_HI50Hhx@W==u4TLPB;ei-J-1}G8wH}|{i#Lk-WZAyfv}k4y0|fvU zZTy^$u6L>2nWo(NDSV2@MRD}JQ4(c%G%=dG@_vxH?>gcH#*Ue2HC}9sapf8X?R$Z;XEnm&g zW99mh)5jNw008mK8)r^`_{yH0rNn%u1|SpC(tjf#om=+r#lh+?Kb>DVb9`|C0Bvbv zN3U(>f4-tAC1hosRoA7p(b(hL*V}(j>ug<`&U)|l$6o$)!>PBQ9RQSwn9asj2p*|xhU*R^vq?*Twb0t!lm5}`yW5lRy-U0ZYK?8to!;o!r!XeOE$ z0HB3T+6EEoI4PlR=wonwqJ+TvCoWh&$?CAPVYcU= zD{DS0?AkOtb@-hh^ZLq~FMjxYf19X?pa_YqtgZGvv2TaxcF#KT?O%=_*a-kW_;N|D zakkWsOe!)HsT5WRBiC+p;N-c>0Qwy(1D2MDBC595oXSiR07)sKNk-%9*rDBOO^HUD zZW#;)R&EZpqha<(HK$(tZYU#V29<@0qCXgU{gXeGpc_|pTqQD-WO|}%yKZbeX7k*H z2W~CK$v8NBAq~czrc5A(v51g0Wma7`G8}f=ZcuAiYYxZan@gP(;Ku66M6?bquGiHe z3Q0ya)%Lvk@kLixZfZyU@#UFbv+>pYhcj8TRKSr_sWG8i^X~UA**LvbD3(_Lba3xm ziYcpup*A9qJ$?AA=Og05lndxfwr`!C+O~h|B~4 z01q8H`StcY);%&mId7_+)76ovRpeNWRp&4M?#jx@|E-)x%P*A6t^fc407*qoM6N<$ Ef@ddc(f|Me diff --git a/node_modules/connect/lib/public/icons/page_white.png b/node_modules/connect/lib/public/icons/page_white.png deleted file mode 100644 index 8b8b1ca0000bc8fa8d0379926736029f8fabe364..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H;pyTSqH(@-Vl>|&1p(LP>kg~E zYiz5X^`c$+%8#zC{u)yfe-5 zmgid={Z3k(ERKCKrE7DF;=x4^O+ pzO8rLO8p|Ip=x)jHOtWj`bJBmKdh_V<`47(gQu&X%Q~loCIFbEay|e6 diff --git a/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/connect/lib/public/icons/page_white_acrobat.png deleted file mode 100644 index 8f8095e46fa4965700afe1f9d065d8a37b101676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 591 zcmV-V0~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a diff --git a/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/connect/lib/public/icons/page_white_actionscript.png deleted file mode 100644 index 159b24075191fc259cfd80c797a1b0d74c168422..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 664 zcmV;J0%!e+P)7Z7t2}reCh0o`+ zAlt$F2tW%oO@m<=(B8a-_VgLl#~yUMUDWG!0qFPppd^03e+x1WpkO1NhIaKD2A)-@ z=Py8(Wi%R%JtYZG#sTKH@6Z+&!S3Edf8jFJJNKuva#KJQD3X^7;H^fd2di znEN&c58aUG>`>P{Vqq$kLb+TP{?I!d4(|o59X_%|nVEZq2Rk60n7072SWJ{64CV?3 zgS!EB=eYxwQ>P2&$}(iT6UMvuFgHHIEdNA29!EBtg=v~X!DxxEH~}L2zn|52%xalaq@DTdhh{EVwv0IaQ=!?daer zTKp4I`l8SDt;d{8Q`5Ko;BXUi&oAG1l4}59P-{|^S(Rmord5s6qsh<&m@Ab^wqCD) zHyRD}lKLDzpYN&@q5&*47mGzGiqcXpmqR9#K|CH8kXS4RNs`(iEF%HjP%f8ItyaZK z6$%Apvsok(2>~dTO5jTZfq;N?0ch4l01f$k9?4{~Youl-#x{UDMr#AFIkz@SDwPtQ z$gQ^$2|*(Ps9LQiav_8o8Ne<=Zx1*M*syo80sEO1tB%>5 zfdHB`1z+!R@?ghPRKmL)hWEvZE$=*54ose*0JiUNTM_)cMDXhxEKg(?-pD=y<)L4J zT0dSyD0&NhJ$^_8Ko9uom%-ZM4BTM{Tw$9qyPj=-9W;N(Wi@3*-Q4pq`Gcp}^vvNr zyd&PsmG>fpCSZz?K}UIEd;HGgG%0MG>ymxKPwy{>wy(m*Atq7)0000~7 zMNw2LQirBVQoa8G3P(rY+l;L4iy+JwSqmy$9JlSkk z&*$^Eg+c)@!R|v4gdc8+TTn&eWHO0VD&>$!B%o;;WLf4CNs=Inq9d`xA4otCWHK38 zmc{pkX`0Y=9g3oGK{}lVy~OYL|C5lQ&U^l;wrg|7w=BcA9L4-r411?K7f`@348&rw zXD#uW)DK;H`hxO}u%=@Cj{;#u#_;bb1_KgUOT2Hp6;)MvC6P$vQP3=g1O5#aU%I!K zZ1dc@f}YvG&*Spnplm2rIp^VdA^HydZ0X1axdms2!RKi5x-SFA4p@ zC@N|PI$ryHL@t-(!zBsf2-+sYAukhDHU7Lxm88-p zDk^c;sHj}OKUc4lGZU}6umlGVNAJx0%sKDOFwQx|V2pVvxhYKe|L9TNk!~md3BVrm zYPDL8Hk*yU-ER3~LGwJ7N`0ZV&nOhBI{~~A;@ND*=kxg?#^W&`4u`zk?Mg_e)8XlK z`T#M+OaR1!<#Nf_>$S`xrqd}OjYhoJ>q)?3vEX8pY&I()ERjfjrXM$k7e+-Qs3Ihj zNyOuEQ2EGYG7ro!o6VOBQEwuV2z)*tR8>WxP{616FY)p1Pn1d}#9}cxolZC$4n(6- z35hJq0;FlHC{ zp*iF(lgUK(E`($(s9pJ8Kn?(M734H_63WHtf}6SQQ_MXEP!#0|&@>J8dL5TfG&tBw z#tYn{TCGZvAr>cca%YYn^!t73tg8OOJ2FvJ(`YpCyVZi*?Ur+1uUA$hAg8-aK)c;e zQ<)!XwHh|n&ND=$@^)>aF-`~n}#*WMkD*M|f8r$i*z7+W! qF|A!t*4fE(R`<_YIkN&?Jng?3oQ|aAqClPi0000t>5xmo{nArfL4CJwMMm+N`pQ3p^Le$?rMud6Rbxz!-yG7bz2z$^USP5(;udf(gfQ zG~f68y^)EvcNWp#bUoDt2=h+^%o-?-|mo~iieWqLNP<0m@2PTB7ftyb= z@H`K$>v9Pr5X`L|rw&CEN2(9SB7A2SE;d|j9@*F}sd(@*2l|P*fWfK>1drZUrtUA7 zNXO~pKn1cjf~~TLbje1g>EPPzN2GH#UIBxJ{}S9=E`{zs-w#hO?vcH+hJxroI5v?j zD!4lP0WXq8zUx3RAP@|Gq$}6wXCjFLZY^YSWBxN9#&g)ro$%5}aYn#y=tJ_aIT%4d z5d4u`rlp!};XGmbZkJE*kYJoi&N0pd*yxY{0${xD;;Q1h^8f$<07*qoM6N<$f(}t7 Ae*gdg diff --git a/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/connect/lib/public/icons/page_white_code.png deleted file mode 100644 index 0c76bd1297751b66230f74719504b2adb02b1615..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 603 zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT diff --git a/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/connect/lib/public/icons/page_white_code_red.png deleted file mode 100644 index 87a69145075afd8f8fd8b391c5da1249ec8b2889..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 587 zcmV-R0<`^!P)LWh{^|hy<@Q*xw+qo|KpY<+vaXbbW{L4q( zTsjXEJvb}e%bgb=o%W0h?4u1;^bWTqH8}5Th002ovPDHLkV1nrS0P+9; diff --git a/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/connect/lib/public/icons/page_white_coldfusion.png deleted file mode 100644 index c66011fb0fbdcbf210483d676b7131542a0e282b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmV-W0k7R5;6x zlV4BMP#DI+Z{WQcKZBTk0lfkj5F$ztWhP#lcuyb@0@rA^#Kpu5KLA&Rgc}o#aSmis zrZC__xY^&#cI&!!{c|4Q_tcec*#b>|Y15wPcY2=o3;-Bl=(t4;6Ok*pL)-{*A;GX^ zS(@WGp6j~k1wBVR9)BB_gar`}HyRBXh7nM!)u5^>N~MyN6bc0-5{W?44iB<`2biXb zR;wk?jIQg@G!5l)SqhrXCU}x$GU-dY1sra}0uCq@153FUULT=jNwSk}0WBjKz}Jdu z<5gB*<^XtpAmp3m^ZEXQZWd1krhft}CoYaF4cSMvTJ01}X3X37KYdx-D0$c{doUe8 ztY{vlGr-e*;N!WAV%_hgUawyYrhegW>^F)pv%uUTFslHn; zvJ)l{%w(~{!O4`KTmK{Q{zCYltLfs&4?nz|6IdlqHCvX;|HGv~!QW?8P~_d#e0$v$ z)5XHEz{3>qMiH`1+qNYf?huS+@L`J9_$cjJF)Hf?@pu;)`9}BXwGUM{2!{y-4|Z{L zG>z?O%Cp8P5T#j1DID7u_*(Jg?7iss8AZQ+&;u_J{FmILf((9eoiL5nGUe>Fgq*U$z0000 zJ3A|*qoWOonz+4ZQ0KNhDB07SX1?#FrNy8%K)_l}y&kh`*KYdy`Y99&tgNgMLSSrc z?B?+B@HO@P-jS~z2Rgc6yy~Y~%>oJpBxsb$5<&nRLqiuR7K=@0SZj~jTs|sv_jWVX zGe?WflejOaq|Vec=s9+ahmXbyJ|T)Sl*?s82sr2H?Ce~HD5WI+Sz&tmWrN()wI2}+ zKqg92t*l^-#ae~;9%KFlWkmwnY=-UK`_|%ICZ#P1gdjK<2n38VXsuC7{WiU!fZFmm zW~Sda9(Qi@pxO}$ARY+;t##Ao27usOqNt7Hwq6K7G1il@xitj=LIM&{N&#SuX;x4x zmG6FhCg-$PI;hQ=;1iZ>F>^~@)IPi;l}fX?SZ!QiO=X<|pSVkNpJuLHzW(FT_~W-v z?vFpkyE>8ee4d=7wKauH5~dd_M7d2Aa=ICC{Nj7Blqv&DQEP#j_VeWV&WXL>c=LLK zsmYg^_JiDb;%U!UxO%qjFAvsDFj-kzT2$GbV(ZopPM$i$z`!7jvEk07BcC=6FMt4` z*0u3Sy`0b~%#(0000K diff --git a/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/connect/lib/public/icons/page_white_copy.png deleted file mode 100644 index a9f31a278e17993d8d4e13beac2f9d5f7b42d08f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmV-50m}Y~P)sF~CC`eaI+m%Y8jfzomMvZQaNUIT3LIrJ$h)_W{ zwF|LDNlB-g`Hb_G$;>3F$9JF3WYR|3fy2C+_wH}*xp!_4fF2UN4lt#d26oXwru}hT z0+0%Vz-l&|Tdh_L-Ng1G2*RBtBncRx;99K)&+}s0whhxXp{go}$g&Jk6k|vfypI5M z!1sNGVaV?!*L7i87Bo%cfO@?S`bajL{R<($@$|PtgBRcCGIJ_2a|&kO>G-s2aR3E4 zjssoScUa;zIdOeGHBnH13G)W-zt$kUQgNfG;96b=v&4NzRt&@7nN%v3HsG`<<+F$cumMs448N!W3r&2Z*b~D5^$^d6Jxn@SFK5Q8*uKSR7x{I|H-_N1f+AD zSYC5@2K4OKL$==F9U@CH;ONNL(W}oZICHn;d?~pw?GRIsH*x-68Oy6SuK`)`{E)46 z9^3(-HXa#X89SBv?u_YP)WjsQrp;}0X?Bxrvf12IKW8>3t`e~W9|JS<{btTNbNT@EQIWBSNJTX8AMGXD z-SsH|s#>j9Xf~VMtyT-YMD}5^SWHTY5->o`k|d#AE_YQd79j`%GMS7FNvG3b7^Vy9 zn0HYCJy5MyQLoqKnW|JOp-?D*<2V^msZ>BOv0ANd2n7t@{=V;sZrQ>3c})5_%ms4z z7!qXwHHe~!QFj8aR~&*-3F?O|;#(ESIXP~Os%|~y^7c15*q5`gz2-5ol!fU92NIGT z_ves+>+Tf3gfcL?!nimYmR}cw*|BGULzI^7!;k#3K^YO#;!+vM@N~(99+<;fdqr zYPJm+pXYFYk;neQyXXEcTQDNQx57i`Okp9A#n?<7!{#tnKJdsF>utb@JH7dU01gfL zEK2hoPZAnO5+je3&^i*hWM`qCW^vLK!O*?U-#IvXV?#6koWqrwnD{j&K`7N>^tR3G z8zr1(qVOzcF#nF1&0MZ5C$l8*E^Uth0000zE0Ay_3@1Z_7#f-XWL#E{8Al7>L$ z0Rx7lnddoqAyfT%&#`$;v0@*5YdW3w z7mLNoa=FAshK% zDiy@zakyMAxr-H?iQDZi^!t5;Eno2A=?>mMx`Vg(Z!?<53LHLvfTPa`$mjDcX*Qdv zR;ylN4OH+m)fVX&Z#yZpUae;ss@a$K&})gHovkhr@w#xyPVlfVgXti1_357y%I-UHDvRWYvPEX+#g+j4Q9ayba zh7uQN1j%HQgA=Fp9DfODAU^*3*FCs^6IpO7xg`RUXyP)(;=d!ly=#I^l3e0Cub`{H Z`5PU3+D2e&<<>s`J(VpX#y^kqzQ;#=2x({YMw9Q&ndHT&`BD$#%Ql?{+)-OuSA`r}MWJ zVg+2Gc(GW}a=BERPNy^;kEz$|38dTYlFQ{%5S!g@|8f8D_!Nu9_Ni2glF1}xG8xi! zorc39&F6EPOeWOt_XS`W2H_Bo$MXugy}SEctJQj=(TLXTHL(jRXfzs>NF=0SHk;94 zF!&HjdZNX(3U3;LY64IMX__Xv%_wjLC!J2`0Jw?X=zPK$C$`&dYPDKaC={e16bcE@ zgun^<0k;ak*=xLE)@(Lqu~MmsFoMCLY&0Qog`NO(h@kyxaA%EbwJLy8sU*Vi`~52K zX0wrqW;_LmMq@evX4iAM9Od(Q0eHP$1%L|xAh@vrqB`HPQLon}f3aAka=9!3hr=O- z5F9`#J_7Jhah=U(4RjaRhkS4Xkk98kDz-`i!r|~~AQ1TFcDw(@<8g{aBE)l)PNxNE zI(RPyc>9e{@WGSMU%i7*v{!&P$WLz25)0oc=Dl-yy%xYZAm4b-rttL7UjR#%`#j_F R;_m(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000)l$0ECbfb-0$}>7z|u>IvuoHEmW&j4lzv=KA+EpIObc7e7{sGA)QVmnM@*^ z%|h38^m;wC+ilpk%>l#V5LCqP_y2_Cayd^XlX;j*r54R*lW!zbqtSpQNyz8(JVmWm zyV4S$2{Uhyc{Cb0QQbf{ZGT{Kr zvJi{K_&f+q^Pv4MK$hhS4TgFj_FD*rLOePdE-E^T7ZzTFCRUB`*?9&h(a#C!-v8lWG#k3AOJQaUey6Oasked^kDPe=Khg@7s584 zg`XfS1)&u*_c;I76#%`kkBfiZgKKo@0)9d6vZw=ExQUtV?eW{Y1Xv}=4X(2zy85d> Y0C^(qLv?Ui{{R3007*qoM6N<$f-gW7od5s; diff --git a/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/connect/lib/public/icons/page_white_edit.png deleted file mode 100644 index b93e77600def75c9a144d3d0a5088a62c02cbb0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 618 zcmV-w0+s!VP)$>5Y&axjp2O=VLu>*f>1L;s0)kkvKC!*u?s6CVL=HJ6oP~pNfZc; zsKr=bq;7MITw8NXw{SZm%59TId2x_9BQ zV86`NuvGI!>o^V!Na!=$7GJE{Cq`b+XwknM{UcGHFTTfmuS+ zm-zYC!P3+zmY;SG$?!fYkOih`QYaLxyF}A86h$GGN}kFj)_o*0e zjPMP%zTG7FYMAfO2Nn1D`D0Cj?Wl>5q%@CE10nX)KxpNmwk+!IWkzywiYD( zqUXiYYIq3qcRyMGJ;IY`(Gz~E$J$zu2+R{)xGlE*88b3WK6V*J>}2iPY1HH|tER0W z_+^^FdppY?o)Gt5M2`%xwRDH@R3G}^i1l4|6uchm0X0f!@&YdVLB5K&dd7Rv{)DXX zt^&vP;}kqj3f>94j+4xd93>s|Q!Ezi>?r8(Il$P}PFxSqu{d*!Y%*#cX(R0f|Juz# z3o0_xI14Al->1uky@W-rCI_%l&>PK^TXNSN{byMk2AI5vbwp!K-%-@!-vPR3iikL1L7HA!^!~ChCFU#lnGzp88=I z67V8PHBo4(l$u?-AKmT8?#_0rKW9dUNRbpLc`}piywAM9$xZ-3fR1C75T(BjCn-l* zjUcci2oXXo-}iqun@#)+`W@kL_-U&|2>MxZy~3IdmRm&8b)9!2%ksg3R)nNnT*TJOC=6{2hG86Dz+<^p6qfG5$i^UNUh+u)CD7O2 zK>Ioazn;U|+X0x$=feveYZL1W*Fm%e5P1sajd#eW#^5(ddx76*pt$^)b}$Q4oPabL zLc^HF>Z{8za;f$LtN0P$6C?1{X*jtXkRJ8IEeyiSzencvH3Ux_y>y^}wfJrRCQN#9 z?&e+C>sSAfrE%mZD5RfZ`gSndD)=P?+nG5Oq$zmY&-v+gc7R6c0u8^Ke#|XOq?gF@othF3zFpM8Il<8BJrWqBtF>b#_ye4{0)Xbu6j&@UIhRE002ov JPDHLkV1nWI9dZBw diff --git a/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/connect/lib/public/icons/page_white_excel.png deleted file mode 100644 index b977d7e52e2446ea01201c5c7209ac3a05f12c9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 663 zcmV;I0%-k-P)^@R5;6x zlTS!gQ5431_q{u#M2 zg&W%y6a}>qj1Z|7Vu&-DW6d~k-n;jnHsjb-q#u0C^W!_5^C=MlKq<8oNCQ6qS00!X z5eI;XP=g!^f}j{hku}E1zZ?XCjE;`p19k(Rh%^AQQ54xysU+ocx$c#f61Z4HnT#3u~FR(3>BnZniMIF4DouI8Hi4u>cAK%EN)5PO(ip3(% zIgBx+QYirR){Z8QwV$9Z(Mpt=L-Or3#bf-G@66}txq0yc*T(zNTBDT0T8rO^JeNbSI-Tzf5!pBioy4NwAN^?iN#{;fH1Jke4Xa`^fR8m z%h6dq%xX)S?7`zae))(Xst^Scp6B8FejQW?RLTM8@0=vnnntuRGBM2dpo>gbCnTD= z^<;=JuqdSf@O>Z8^XdR?s+KEfhDdB_#ahFj^giCtzT(s8kA$AViyTqaAR;KGaLzUU z<=GqA4bRwpX|IG~*x>pZ!@zLr`XQ`od>m(`;jz|M_*1GDO#$7;n74ppb8=eiqh760 x0yt}J1#p`gw$`o!R{d7zU9~!Un@nJV{4bstt4Au+Up@c;002ovPDHLkV1kWhGjjj{ diff --git a/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/connect/lib/public/icons/page_white_find.png deleted file mode 100644 index 581843637079359a6a58fcdccf0763690c67b063..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmV;V0$crwP)_k3`4d{s8lK_6bi^@vq&To98fNoK}7)fx$e2^Y&@<^jR_Ee+8}KG;X`@ z@bCyiolqX>bb1ZIs%QGnjzFU~L8H~d?e;*XP(h(S262}XyZ3a0h07r{KV?E70l+e- zE`%3x|M5#q+;HOC(h@A^M)7Rn13dm0&>K$j%k_F4wOWlsNCIH+!c_#{eS&TL8v4yc zcpnPEY`cQzZ$ILq{U-MA6Z6Z|1p!FZjQ}tXSb25J@HphEqX-6Hqo?-_Zn@{d#>2Ml zJGhxTAd&emK$lV-QK&VM&ix0Xy{GyS3Wp(+E1^8BhD3T0a)m-Lw@Lu4zQRrP)9(3F z^>$hh@N>OAXrmPYunLi|fJ$_*5i`46;M>~*5D{bp>-OL3{+!MJa`3kv~Q#QfQ%c z)1s}QE<_XaYBG;IuRF=td#+}fi4h(6HgoUyJLi0t(*dA^B)%@8kkG&bdM5P5^Z5WF z%d%>m^SbN0XeV)wbUOXn5Ag#A$gJx+7-OCkMM1S%MWIlTkbFLmOeW(&n&wUd&;`>p zVcRy$Z{K0=?SpNnP^;BYEEXleFbq(UY&LrXX$6qkJ~)8+b{=jj3HEXds;Z(?D%}}L zX3`39&dy=Zyar!ehA}e>w)(*vrCct{PI9^2Jpj&OZS8<3-@{0(gNv%1{)zAiLY+_^ zl}e>Ofd4&#Irj#7>=o=Uhv5IJ@?sN0^J|(WL2Uun$4}si6}TG-s3T#p&6GE<<2W)O zf{^Y2HlO#*QDvTp3v&d@;8*}aUC4lisG9(w7@d5Y8y)}U#FwCkqp*Mcgme4{&gGRf zlBfd`nF9cQBKB2_L{F8G2)7pAf$i)Ds`|}-c>pc^LRW{w4SQ)3N^BbZx)6BlCZts! zKph%`(m#xg-q3I7=(us;9<)*2%iuQ1J`oV3gU6V~T}^JU5714JN33&GwEEru0d}Uo U{MPL+lmGw#07*qoM6N<$f^vibe*gdg diff --git a/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/connect/lib/public/icons/page_white_freehand.png deleted file mode 100644 index 8d719df5205f7415ce657e5c277db4533c82f346..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 639 zcmV-_0)YLAP)p{{sC7)XB-g4w*W1a1)XtvxrMYa1o?wn&v~3 zHnC|#(>B_M1d`_7gfzLiHy=0c<2kQQdXu*33(xYN_xYW39(cz9jEVT%VokB8|DoF~ z8u%Q5sdl@4VB7X#uh+v_;yOGY&pRi?378ghv)P1cngiAAb<}D#l*?rWDV0j_dc6Zk z-|P~AJZQCA=yWcQjG8fYnimzj*3KqTfN0Cy!G^$7)+bQ$+mHVd1J zvwOR^5Lm<|R+uyB1Nu4vL?d4qa3tn?9H7SZH@~u=fFHEDfSH|bHU6kh0O3%cLdyny z{`9S2Sw~WMy0MPy!64i`jdk4Z3>^+KIL_fN2V_d&ywBt`^IJpxUI$=YAph~5`;xCe Z{s%Y0vkUXDnO6V+002ovPDHLkV1loX8z=w( diff --git a/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/connect/lib/public/icons/page_white_gear.png deleted file mode 100644 index 106f5aa3611a4807ec8c21701c631730275089a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 402 zcmV;D0d4+?P)<@FR}JvtGRKa0_WfK^c7uXaFH3q@Y!Hnl8VySc`OtkPN3;#l*y*l23+99h*9JzA00}rAC!#M1dZ#v9YOBH|eC*${MmzzYjBu!!-< zK8tujf&(6i)1biy*F>4{f*Kd(IU-JsG&#b_@NgTnx@40)2@2%c;*=?-2Za=}O}7&( w%_K#(S>e1j&gfY?mR})n>>0+8p`iTe2d1K2h8#$+)&Kwi07*qoM6N<$f(2cptN;K2 diff --git a/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/connect/lib/public/icons/page_white_get.png deleted file mode 100644 index e4a1ecba1b60e54f3777717ed105cdde745b7184..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmV+f0{i`mP)o)wchR-92qq~y6`XqbKmElbB3z{pkZs0VPF`CFvS?7jDn^mFo>d9Y&06* z&1MsS!M-CH3ee+h_sy)Ms%B*ec3R0RpVi9?*mU84yoq(Bw8 z<4(999dJJE!V%pWT~HGRIAb;(#O%2K3?uRpz}AfgE8e9q&OSdr^e^}lC$QXZz;S2A z)w>^oHy>?v)q--`!pmuBe96PxP0u*inQvyFW(llfv9 zXV1s*Jh`y2H%B3ZTA(AzpsQ?hb6_PyZ=c1?_B4fbl>G%!@ubJln=!)x0000#DY{xaiib^#X=YT4@yE_&2#eBulEdzjE`u&@G%2(&u{J-<}d(^uY4W_kMfEX z@!X)AR9F&FL?RJyJRUzvBoeqN{5kY`z3wcM0+du73~_0|*lac! z42Dw(Eg1o{Ash}P8jXrqN+1w`*XxDD;ShmPCZC7#4;wWbHoMvBl$=zF-`?*9j*Nbjd=v@OWt_BgKxP-3wd zy37?ATx&$b+&zRM!K;BD%Okw`Sb@&Pak8$KRX19jWZmC0&n*Ggv%j8nvSPDFw zEkV65AGOoBQ8kf`R|}Px*&INNS%osq9b{Fq2I(x6@xM>tg=vRLF?I`0rWzHyRc>}g~)F_Qn`A>)C_iwK%Z zrIJ;xR)UI1Y4Ozts|-Nho;q zVk9-bX)%F~!;63iu$Fk=VJn3~fmb5S@@)ZqjBT2{f`vT`b2}zxb0$o;EF@G3&BHK^ zc)`1kUzo^Qkk$?KFKHNBD?nP-MJ3b@&4fg;g5l2wMi^g?9qj+~@b;62o_U1_S1J`g z7m^UMg25FX1MJ5AQxAJ5F5WDt=$=-@JV-!LHA2vuxl9kN>PS8x??^AINH6LjF*#nbk4}=n3gfWp$kEX5IpHS zYiQ{@d7Nl&d$#+7-TckP&Q}N91e-C#5QQ<|d}62BjvZR2H60wE-&H<>}%WqH(_V;zPbB1rgSSSC(0? zWlQ#?N3UgnJ9m2C29w!SwoOo5_2Iq!<8vCyEoDoj@#oV($oJEg6Bj@;nD|2g8 s%L|>IZ381yx9RvPhV4J)*SeoEV4lyr#k*`nfWBbxboFyt=akR{0DpOPi2wiq diff --git a/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/connect/lib/public/icons/page_white_key.png deleted file mode 100644 index d61648452284da1bc28b10385f95b5d2bf027901..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 616 zcmV-u0+;=XP)-tZUVHjYHp;RjQ0M0pRlXN=mLv{hk9Ebp9&~+Wj-T9IkpzWPWd#fZ)d=zV^~S`;LE*!&u-?g42^wwN&Xr1~#d5ifl_2*B1OoS}CDno^8a50ArfE8;stQF>AP54J@H~%T zFz84s;dO!QJKD36(~!QOg!t_^gfFcSKDU4yK0+Ypg$NT^mIYcQ6bk*3P(lBLh7Df_ zTu=2xC#+-_%)|{Cv8zz0t|0y4D5M`xAc{gwOKc`ou<*&VjUREFHs1qd<_xSkKeTBt zgyCi=@jj;&Ns^GsWWaIUl0Y2azcDlF@u{(P*!+EH;lnU~b|Lv{4|4Hdkh!qoQHiE$ zY#y>KFA0QEw=4Z|uV{0A^`Y=D}hB$GP&<$bi8q(u;p^0(my3Rz7fP}|# zGZ&#uor4@c3q9r|f?H6-UZmfgKx(iV(MQ`MPWB>iC~SxnN5H*zb*A3#zWwgu&c|}3 zn^g87H{pdeasl%Lhmab&jC?lES}7C?4BFDNA<}20hoY@w_IU%i*T;}}wh!589}7~7 z#Ug`-R~4j&+K_y4kW@X7qLr-)S5qVKU)tO;+kXJ++{vPI@{hVK|PhMVVx_`)vx~zUs}c9O-Ok{00000NkvXXu0mjf DS5_-g diff --git a/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/connect/lib/public/icons/page_white_link.png deleted file mode 100644 index bf7bd1c9bfd78d689c73ba67cf914182933ee68c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 614 zcmV-s0-61ZP)OOAS;jTeL{ZSdz-%)SMH9tDF;N4B6%j=d15J&5qy`F#vB?Ar zqS1nH@%ny_XSI*Y>) z1f5QYdmzT>YciP<3WehS<{GovEaLGv27>{*-7f0&I$yJ^L%ZGPv1YT$V|u;*+ZCWz ztHI~CDVsuy($SfR6-`N~K?9GTB#l%%0h7 z-q`K-y~E)+s8lMyTrPL8^_pUo)9G|SluG5pPqw6!LJB_PzyJUM07*qoM6N<$f^=yZ AYybcN diff --git a/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/connect/lib/public/icons/page_white_magnify.png deleted file mode 100644 index f6b74cc40f82fc83e4dfa6e9647ccc1b34e6ed7e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 554 zcmV+_0@eMAP)Vb2f>2}Fa82O3m(Ob=t*sniin`NpInLyMJgI`saru@YOPfh zy4g0#G*cV!#N%;Gq9_VH9?v%kjS3Rb1j8^;C={$Gp=lbj z*(?%?geA!5^Pok%UauwjA)v4g2`HedDw4_Mk4hhBQt?e7YJ5(hcj|3dNu^TOPGnjB zTTsqd3GIZ=Bb`n=7no)dflv&K(lsWw?lH6T1Yht0F9qgIuzh}ym0%n<3d3EBWB*pg z+G!I0lbAEXyd>k|QNuwr4=KX1D+tLPv)j@C1=N4sA4NF9A>HcO3G47*Y6!+SrUH-7 z1hb;^#S=r|`aMh>J#dWruAEf}gcR(DRUC`ZUev&$Sbh0SgLiTXeeHEU<$_YV;9281 zym`igIE%Sm8DpDw7@71Tv^EB5xSdUR*0$Mqp+Wq8OoaZtOg52&)zZ;;M=7#C1Yd6x svjx>8ad4e2x|*xHHwRjcjs6zA0XLDUqKT6dS^xk507*qoM6N<$f*wetruo^Ag2=LamM1T#~4RmC^m`_ zs}H7d&XJ}mg+hU?tu0noRvyjI&o2SRAeYZFesYkts79I^jJ7!A7%6nJwq8O?iT55M z1OQ` zbL{!Cp5o*IRmE9PInMCSPjTwfT~J+EYkz}tjxY=fg5Yf6EQ@DG$0kMJ9h^&$W}9BU zP1oj2;?MWVkKIEl)r=Y;L^Cx2q|>!)qJJ8zE7-V*-Cf7V8_2#1c0N975t~+&QUpQJ z5(uo(-O_`%Rj@U@t>JYAgd!>L?0Idxtd#oW2gc!jinsAEva8|kF4#Ic**mmml_{d^$s}Q5Q)KCys4sfck5bP1SyeHwh2`A<@N&t2j0^lgHC_^(pAAPCNjwl+>AN%C4Ll>_8Hjda%9 oS~i=#*e)>KsPlg0=2)Qg6BCqJ=F8HdGXMYp07*qoM6N<$f@i)wr~m)} diff --git a/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/connect/lib/public/icons/page_white_office.png deleted file mode 100644 index a65bcb3e1e9613cd9e4950850db43d7025a5fdf9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 779 zcmV+m1N8ifP)JNR5;6x zll@CmQ5eTZ^k*a#RQf}fVOdd`5NJh6S(>6Cf$wEW#f&JyAR#GAn9>Gml;nOf3WCDa z5({5&UB$(IF?G#$x4X@Ickg!Y-HU!Z_rzX=qAq-XI_LS^=lOCT0|0{#{kBkYDS7{3 zD`iu%E=`cDX_^#^#n$5SIQ|4Zhsk8>N|zXHXG@*41$i-7`Jr{8`3S_OEcmY|RF48wXkk?WpdVM4OePBSbfh z#4_=eXJg@3epx~gi>QbUmO}Bm(ENN3+@c?jWiKvSrm(o|W}Ud*?vy~fn1!V~Cl4kB zI-;c!8f~-v)jX82%EG($>?;KSD$64f2&4qQ#=Yyrcpy$57RAVuV#vKMP)0hT$r6m# zc^F^XaJ8R9Q|}x^NoJYIvYZkq-z}Tnj@UJK2l2H zG}p+VvtjP2Z%bsb$~7QLJ9#pC0dKi`ppOd^_V;ME6tdzC0PtV|r=@e@37O`%0k^=5^`%cf$eu00N17Ro!{^30krz>a%3j34C?*{Mt2^a4~ zK=P+Qq%|f;Tc&+9ps;@Mw`EE%rgs&#y=j6BUGg96oIqdwj9-fiy*N(|@o)eD002ov JPDHLkV1j#pUPb@_ diff --git a/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/connect/lib/public/icons/page_white_paint.png deleted file mode 100644 index 23a37b891c2f5faa3b8128d45373ceab794ca609..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcmV;h0#E&kP)PK^TXt2QS_@2qt2T|9~baC-vaPn=ziepcfAwB$0!O2Q)E}1e8!q+9)KT5JVKU z7HNY}h##OS-BxWHWjD0wrPDeEfUClHs%Q6&2u@FTOJkKMQN|_Rlw6rQz$gPzqGNtj z#ruSeFeh835JJFiM6vp@6M5bXj%k7CMt%SIwfbF_fD-3*Os`9Ly_Q3WQ_SX33E{pX z9_WIeeTCGQ3wYALpBcK+P-iuw;3i&7xCua37k5# z`>c`M@sGeC7cdsdz`aE9lOz!hPholbyz%T85LYf6O*@SA+9&+^7k>+4M8$A8iNQq{ zQvn8k?-+dU`Z@gK0z$EtPV#+`^OH`R@cE-cuE&_!D)SZGxmQxeobP_Zwq zMEgi6ePN45N`|V1so0uE8^}1xw8s;VM%Ai@7} z2-&Cyvez_-O4?6uv{zTaj|YeYEk34i~K@`8YW2g{x* zc;7z3lItpVy_et{Z-ZZ)<@*%{l7Ao8mu@V7*gz<_1##mwW*%LEwCdzNsVLYx2*T-J z#HeQ*_a=R~KDdVNk$EVgAIRl$oQi_(`_IrdJciDpH|Xe{K-YsMtc!cRnFi$qzsr4z z5*$;ecov%3->1{YNy6-Gf(Ecy&_I$CjI#laeuE+S120^|Vjsf)W&i*H07*qoM6N<$ Ef)^4A_ab^avY?n0hpS-#mn_4{O$e%cm-@NH=3`90Wq+3`~HKArSdfX`&Z12 z(CY$VW-MNtXX4xy%yUeE?}*~0-|iByA@ZrwXgph4S*bhcc5{HB!DFVm_v}P*g7+Q~K}7K0lcp(^N@X>U zV`{ZpeIf${R6Hgg4FL^`X$Eu75k(PE6ycl$AW0Ic)#@rR7Z(7;V?i-dR1K935Jgcx zPfkwK>2wGokf!Nih^ARp6-6arYFG#(9Ta!x93nFEjoA==z(g?#sDg?Owk?Mg7K+>l zWYsf(<`#+$h9Sp6gFOg_dd+80SkUpk&xM7h0`Sov9W73spU;GP073|VfZ&Gd$J$*0<~TV5aPS|qWH57|VJz+d0000vYep8SaFV10Q$h+;hIUPX_=v5b}%>Tm<(&j1&5;I!55C)oN0s(P%ZB zP3Q#ahfpXKWF@S?jm4U#fv)QovMhrriclyNs6-G12#3R##4PSZ0VY(dRWJ;Lwuq{# zAW0Gwi$yA^R4RZ!;W+L`f&%x{=D^VK#BBWL4Ys{;*!A7Q;!=dN<&D8*GzGaF4`hV4 zDbY0{NrMX>ZqF=0((gR5-zL$kC*b)!fwu{Euru|XrG<$^n#@)7i_>rCmRxnDq>$Y%gJaCkRd|tE*a2x05Pe!I^e13o69#&RQZ36s0 zB=O|K2Yi(jsMqThn}9t?f5E-)L^naZ+db$&%M$!bCdm=jv7?t_lB?3&%Ltq(>ESw? c;MI421LCcoDG!2@;{X5v07*qoM6N<$f`UZt7XSbN diff --git a/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/connect/lib/public/icons/page_white_picture.png deleted file mode 100644 index 134b6693687b2fa5fe36d48a9c0b8001f937c741..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 650 zcmV;50(Jd~P)VHAd+bMNh~)LLRqN>D)-jd9UvB%+hyKX5U|&4t0)fzgD-MPpQ$nHU%yoz=vI zMGb>1Xu!6Hw$NT~@Au<4P-+{9;Uw?&oj31uzH>xX0T7Xkz!(tn|Ed9-s_FqyReC13 z(ll)vW1O{Ck5ihay12Ob2ABc@RUI;zHpaMiyRDs0r>|D4rHw{ItJSJnYjt~jTbGuW z`X(~}?!&86q40R8<4zYw;$qi0^3ec=c&<&H;r`8W%H=Xymf^i;Wo6~<+}zx2UMzpC z*6MZN?(FMv`n|KO3(KFiUaucP0;Z!@LcUNa%8#vGK5aZ>wDgB0Gi=t*argWJcdlMQ z2#MpEX0wU+9&0U?N(F#OgpviU_Y{jYMsj65U3|PjwUOY}lUYj?MTiK_Il}NCVx-Eh zDx-TzMk7se+M#W_>?A1-x}ZXw3kkyz5kW)_hkjsi@RhKadN#H$Hq)$07*qoM6N<$f}lhwPXGV_ diff --git a/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/connect/lib/public/icons/page_white_powerpoint.png deleted file mode 100644 index c4eff0387d5888c638ba09473ba6d2369f7b56f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 588 zcmV-S0<-;zP)HU2HvUSp%6 z*n}iP63IK?dpo;h@sj9~pcxo;VVTc-XLiP@DgefqE#NE=@oyUd-&HjLpsLIuSFXV-EMck)oQ(A`s%*^&wf0(rNiNHsU%=0Rw;WC z(kbc37l6fo`-0uR!pYkYv8U^3?nsh^@pw!K0TH3uYyx1_2>|JbXPmfskJ|1YAw9w! z9`N)1^Aesr;y5Nr5-ODn)oOL|CGi}f9!&iVwpK$khlIX10X$H6^A_stBJqvLhU$?V`QXqKme*s~gVDJ4A;LTs_e15jhc1;By a82kqHEPVYFAD2!50000JNR5;6( zlS@kiVHAe7MZY2;Xi-5)WxDDgv@tCUl*&p14T@Z~3ThM5LP4tuQfLu@EnG;nXc<8S z6&3BN?fx-cv-Kp6>HRiNTHE>$X( zD&=w+?GWC>?RLAGC6Yix;an~UmSt)tSf}1VS6N1N2ONORdD? zaj}w6DAZZdOud9Ep?M?{iQWbE5^9HLLZZF|1kdy0Tu4InEuboP9@nvbZ-P0n4AZTy zyMRIxRDmUE#LdqYuD=-Qz4N^bC`_#S7vcLn1M}{J(Wl3#c4VWczu&)AjUlh(11>gp>f`wv{KnjF%!aA*Jk N002ovPDHLkV1kkt*XsZP diff --git a/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/connect/lib/public/icons/page_white_ruby.png deleted file mode 100644 index f59b7c4365fa1720af1aa04eb47167ddaa6eeed4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 626 zcmV-&0*(ENP)ZS(e|#C2>JN4>y}l*tQ*E7zP@R2CCJnkW?xa6bgk%(hgtZ z0=~d?U3i`+Mvi4!&~+WPT1^NX#{u6&QIx+DE(oR{&T5&-ovF?@wGw)P&AtpHZa|G%V*GUUqL@@!d4V$`8=##4)ytY959JG zdc&Kho)&AL70^i z!PEmeeDWCB-UbK(*4JST44^tV2z_J(dn~+vBMJT97_7rzFio=~XczIv?PQ5$v%u~y zu(bteXb5I1h2zCV{Jc2~V{{yzZipgsP6;k264$*#5q?GzCm|CPa9CKqm4b116h3Pu z?+%Cm52plC8|5P0@igf2GV1KkCfk{Zecu=G@VNrf>s%g9c5D%@cfxVb6$nY`1IW=4 zt10QqSps_2JLp0f3I0j0u>#qA;v!+T))KEbCg|mo3q0pG{OR}p0fPds8+K~d>Hq)$ M07*qoM6N<$g1S2e3jhEB diff --git a/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/connect/lib/public/icons/page_white_stack.png deleted file mode 100644 index 44084add79b9a0fc3354d16bbd4b4b5ff8095da7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R@9E+gqH(@-qA%AW0|7U8+xDRI z0k`B18}ImRw2g{jTGP$Pmx3yI6F_2s&$|`cJ!i0UN zB3H;=r{#{FwLaNVJ&hZl9+MTHGx1T^-A=Q0?hRb#8a~x50X%;`b6ik3cw=#XdxWy= zgrpBoDjpwP&g9<9h3x!k_B!?vuTJVkmIJ-U N;OXk;vd$@?2>|rNdMN+^ diff --git a/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/connect/lib/public/icons/page_white_star.png deleted file mode 100644 index 3a1441c9a12062a4bb3d706000d3ca14399aebca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 565 zcmV-50?Pe~P)SCZIX8XZzY2l?gCw6LlgWJ5Avz#QX4|&mI8LN)w~J1vgL=KLAhlWz*=#m~gyvxa z&;iC6gb?aZvMdXxX`<0+D1hs_pqJ!wxqlEH;CJ)je~uL(gpi@v>!I0f_Kl=E(E+Tq z26na*9gribxx-Oft(HnstyXUUy!39&E-cI%J5Rsy;(PGZH{g{ty!HVC&yGPT3H8x# zw{^gBPW)O0FMoh{k%l<`1a|To_Wl&u&-GXm8izU|&<&utILc4wc6s@u1bmTz6x{qg zTw@7=FQRcg&r`h+gcR$*Jbv+*DPk7v)B@e0o2 z6IlBXW&8xh@9)YKiV~2>+z&XKd24JT55YWz&JtfvCg4r^~bLP79-yS@n$OW00000NkvXXu0mjf DStt2z diff --git a/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/connect/lib/public/icons/page_white_swoosh.png deleted file mode 100644 index e7708292adabf4821612bfca032cbd019c63180b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 634 zcmV-=0)_pFP)KrcWDBzIw9XCtIF5G<@j zP(;CSqHxUrerI>~wKyloM4~t_Ofl@UFEj6$Bmm6p1aK6H{5zI_FOn(%k{CiRq?CT< zoV}Ey-7=-5nVFes;1m!f?EqZLIs4k$n%39XN4dPbtX{9DZnvvaiWV0aH9I>yf;2<< zHmo7WNC<&iE4ji-iKJpsBApDKiAiqWy8R$FV|M@E-RCB03vjWNGQZJxKCc-cSB=dq z#v3snoDMC=4<2BDgiZrv0Veh~mz(X=S@;fbe>CJO_5|oe2o3=wgfW(StLzI-qr&kc zhXEJ?9=`nWXzrUKL_p*Kr9u@95MU9EKqp2vi+%&1&gUn&>Ut_d3>wiyiAJg5G7j%G z#$sf%Kqau!AAHP&4Q?edl!FWqpT=C{D}$15WC#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R>*?YcqH(@;f-l!01CbW>s1Izr z3LkoHh<3E?TVANoG4CX|$empRCCS=R(U(hVJfm~E?IkDKRK&NP2|n`v>d(vV;W1uY zrFGVdwn;4b{qUtE`?GB`)E1ga&i2|7ncUL1b!KMq^QnT#_gn?_Z8(c`1Q~Vy3oL!N z$M8vHL&U1J3SJF!56azQU3B6>r|ZQ{U6)pC|tRy7$(5JQ<@7eB8yk=XcNf-aBIe#;8c_B$^=N z{-Iq&o3%O}V4~G($=zcP(LI|+6dq{?rby~MXwJQ*=!bOvl%?k zYY;jP^@M_k03MHL+-9?_3W5MN=moFW3xmPHU=-4Bw;62MrIhg_lwHEsv)V9U4x>+9cG2kIz8fWo`WyMMfz zdg-)p!<(hFR{VYSDJHEJn09O@#)%q0l?GUg9eS2~vKPUtd+=ak5lWLd-jI=;cjEf# zt$1;~?G!t@s+VLwL=P+Ks;E z!Jkh#NeohG;&02OFD7^EY zP!_PL2~i9VnPEW6Fz?O3dVF_U$duAL$=SU7&hNc@-drC5A4z=IgjR%B|D)?dOEaGb zuwod-$hPex$8oSoqK;@Z8u3EBfK@V2CKKqo?yA%2pjNA)(P%)HWf#)x^$?52W{|1b zPXOA$IfrSQV2q(qC_vLR)a!L9isAxjoeoJRlgE&G0Ga8krBVsGjZJJ-x6y1i(eL-q zwB%+o53no?l}ZJh#drAjlc6nhs3RTn;1IH+x;K#|X)!=#fM76)$IqT4^N}IF%aQ#o zTKS@*)|#L#jiCPi9~);c`x>TR|0{+9a?O5Exg#~V5W2C7G9nAAN(~f z2caqx&t~GhnK;qW3~&OuEke?%u(8Jxs_+ZVVz1^-uLrP95TahadGG$+(D&+%2QMF8 eFxE8s%l`oWamgLPAe&$S0000dKE@duOisOkyZ-5 zuwDqkAi_*y5o3Xrq7ieT<<3p#-R^dGySwea-CgZZZITBc?#1u+FtBuUCJUZe;~j-%Tu@ZpYB;$&ydfdZG#(j;(iB#^yRlqv#C*LO zXWXM0cpKKBlj#L6awm|;A38Zs3mg;sQZmCAZT8m@X{AlP6 zVI=SsiA16x=>2%^XV3U0y4~G+MNE!B{!#;~%L2l(14PX>EblXb{rnCSlVKe0dyf-O zuY#uOf}m&2xq80;4d3i|cuNw}U@sg3VKRU)>Os_1L3pl5mK*|?X3#a}K+EVZt&w?w zefXKP^ZqnW-3y9AhYJZ~r4m*!Z3OSz3d}2Q`nDM_f_u>L%8Cb}8`?bl)x?gwAy>zp z06y57kT6sry1g2l{|V%UW?)JwnbzUugbvpOF3=oZDo}spfs2EWKOH{_^59;ue!o^A z@e7dWS|QI`Ff-E$USJ`LqDF}zH%R}YOlMiv63A=qK^d}n!5_(fW%^k4U_D`_meIDi kNMKea>saR;>gt<+0gk_zsk5>Xc>n+a07*qoM6N<$f>Jg*?*IS* diff --git a/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/connect/lib/public/icons/page_white_width.png deleted file mode 100644 index 1eb880947ddf3e745c29e8d9dc90f09c7e6e323c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c diff --git a/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/connect/lib/public/icons/page_white_word.png deleted file mode 100644 index ae8ecbf47672a874c0958d0d113a56162c2bd364..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 651 zcmV;60(AX}P)hkjP zNW|QGv-YFNLN^qH@tJycPNG5ti6B7;r4mEr#lr@*T8*M85D`{ZR^BWwF23T<%MYIh zdC)S*p=|xk^!~H=+HSZ183~y8v4|mYmZxt&)5{{~>J`>E223Q5>T$=~mtA71q-jdG z+eJhOAyBW^0k9Gk1+rX8)zFx((CG^&tDY>6XaS~Fy!WJON|Gdujg5^~Vzt@o%BcYLiNiTQSD`zL^ociBz_>bDlpw3kriQ@Z`bVsGz-_6N>$&gTDiKDTKR^ z-hB*tHa^>!oD~5TK^0UK5rZ}RBm50Bv}S-yA%s=Ha5RYb{)!z2N&$&64gfhybBu8p lh~_|?8^bu;BRYt{<}Yrwd83Y=s?Goa002ovPDHLkV1l%3CP4rI diff --git a/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/connect/lib/public/icons/page_white_world.png deleted file mode 100644 index 6ed2490ed1432d5d667a76235360824a1088e928..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 734 zcmV<40wMj0P)JT{hN;C#tgf#9krG=I>5!<*aE1_(spcgF}<`n4i zJi-}^6UUeU4jUFwdCiVPDm%`Zx^UBa8J(mnR6wEgz^}o8;)M*Y(@l_!Kfv)}4+NuM zaPXE50z)r)9=D=SR|RIqfQ^j}Hu!fzMeQBo+@PZk1G8hOw|vBTvkx`HM)Xe9q3xao z@`p0`NO!2904FHSLA6E@Y-O6zH$DQzvq@aHsz}}<(!v(Z_+EodX%R&NZW75g+nENo zV0020rxE^;7d!067AN>6*+&YLp$9uH6F-=In`XC{Cn%+o|5)b&boEPr02w@|P*oGm QmjD0&07*qoM6N<$g78X0Q~&?~ diff --git a/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/connect/lib/public/icons/page_white_wrench.png deleted file mode 100644 index fecadd08afed92536be91ab12d8e37b6bf410d5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 613 zcmV-r0-F7aP)wK%m(L+9IV|s|#(WRl-O^4GvaQsnHq|OstfO zIJ3}3<01}YGARE4m!7=)QisvlHUo!Qymx-@-t*p_129Ko-#pVI)6#!*kLj-AGXWNR zyA_{wKii_amK7^YT-v z6#plaNm#8`-kz@OvjIt^4%IN{@J3bR zRI}ME1Mv85p|%;RK>ViR>APPLB4;;BpCtqE@P+*7!G>I4UjNx~e>r3HA^tWCQ@S)l z{BslcSwL-CxQ&_ZZSv_g0Tu{yi*X){Mt|W7)lbE`SQxFP00000NkvXXu0mjf;)M*S diff --git a/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/connect/lib/public/icons/page_white_zip.png deleted file mode 100644 index fd4bbccdf1643f4ff5022fbc59b82546e259317e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmV-|0e$|7P)_QM!1S$Bhw4w+iRuFWf;tfR6D%SMJrb+tx zC9R6{2>Ou6#juIy6u(I?|;&Owi$sRB4^20apB5xE2 z#B9XekY66S6lzfCL!eEQRgo0LokTA55@Y#%_wN!TXPw^Q4IIXsG~v#u_4t;x_HM16EQ@QRY+rut&97&UefsPmLrQ5P zBC2kcbux9L%2bJz$P$XV$*zSxb2e@6_3O#;&!FD<&hLjGn%~%en;7)djE^d6!t$lW7GyIOKlQ46hr`Z zjLNuRDP_53dNoN?wd&HMgL^m1DXFU<5dQsrceN>fSz00000)O9XRTN^$%%`*Fg>ryDtc(lF@?b>dE!20r+y z#Q*>(wbV5H`-E4Do={CJp7=ERhw15hgZi)?jRG88 zzVz(5;g?Td1izJyO33bhjg2Qc7FVY@f9!o)Gu?DII~vm-Dc?}3M!fsgjP?F(7`rgg z+xOk8XD)e?Zl=5+un`5!7kr?F=eq)K-5uqr%yU$1hLv){Vlm=)*5~`lwMciiXFu*g z)*Jkz6AF>#zb(Vx`Iv{bdGZHtlW)v(y5k^|xgSUc9%0}S20nrYrO}78ofk?bV!5)4 z=Ngz@+$9N1>>mA%IWx`Fqa240bWkiW;2TZgd8CZS0U}@mknC;!2;wi$eI@`h0y2JS`Eae0CW}q(2(%!m8 zWq$`PDU>LT1_y*bBv#P5<@q0@ttz$hIH}YMDvAigCc=y*)jY-VOpTd;A8@3t7Xh4r z0KTWOk;N2Ox4!&&^4B*no$WtTX!BXB)rg!y8dvGgKBQKLJNXRRp0}Bsjd1|LNQX~c zbC~fjrk2iL@4dYF*vt;}dFn(%h)n_-vzEIHMOKRkdF%3Lq|zBgKm_h>TEq!))nWjq zzn;B!?!(dQcHu$#=JF`cS&W~C`WHFW^B!~MI#k)>1Vk&eQy8P1O`J6V04{D@|7d6^ zyBABnh-d^H0FX&L07M||E0n_dp4v&Q%PSE9p#R#Hq)`5I_(B5CE#q dxjPz0{s-<+c#AC!i7@~G002ovPDHLkV1iPlpuqqD diff --git a/node_modules/connect/lib/public/style.css b/node_modules/connect/lib/public/style.css deleted file mode 100644 index 32b6507103..0000000000 --- a/node_modules/connect/lib/public/style.css +++ /dev/null @@ -1,141 +0,0 @@ -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/connect/lib/utils.js b/node_modules/connect/lib/utils.js deleted file mode 100644 index 35738b8c14..0000000000 --- a/node_modules/connect/lib/utils.js +++ /dev/null @@ -1,404 +0,0 @@ - -/*! - * 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) { - return 'transfer-encoding' in req.headers || 'content-length' in req.headers; -}; - -/** - * 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, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - - -/** - * Return a unique identifier with the given `len`. - * - * utils.uid(10); - * // => "FDaS435D2z" - * - * @param {Number} len - * @return {String} - * @api private - */ - -exports.uid = function(len) { - return crypto.randomBytes(Math.ceil(len * 3 / 4)) - .toString('base64') - .slice(0, len) - .replace(/\//g, '-') - .replace(/\+/g, '_'); -}; - -/** - * 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 `"-"` - * 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() {} \ No newline at end of file diff --git a/node_modules/connect/package.json b/node_modules/connect/package.json deleted file mode 100644 index cd09b6824b..0000000000 --- a/node_modules/connect/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "connect", - "version": "2.7.6", - "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.5.1", - "formidable": "1.0.11", - "cookie-signature": "1.0.1", - "buffer-crc32": "0.1.1", - "cookie": "0.0.5", - "send": "0.1.0", - "bytes": "0.2.0", - "fresh": "0.1.0", - "pause": "0.0.1", - "debug": "*" - }, - "devDependencies": { - "should": "*", - "mocha": "*", - "jade": "*", - "dox": "*" - }, - "main": "index", - "engines": { - "node": ">= 0.5.0" - }, - "scripts": { - "test": "make" - }, - "_id": "connect@2.7.6", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.4", - "_nodeVersion": "v0.6.12", - "_defaultsLoaded": true, - "_from": "connect@2.7.6" -} diff --git a/node_modules/connect/test.js b/node_modules/connect/test.js deleted file mode 100644 index 92b7003d34..0000000000 --- a/node_modules/connect/test.js +++ /dev/null @@ -1,40 +0,0 @@ - -var connect = require('./'); -var app = connect(); - -app.use(connect.logger('dev')); -app.use(connect.bodyParser()); - -app.use(function(req, res, next){ - if (req.checkContinue) { - res.writeContinue(); - } - res.end('hello'); -}); - -var server = app.listen(3000); - -server.on('checkContinue', function(req, res){ - req.checkContinue = true; - app(req, res); -}); - - -// var http = require('http'); - -// var app = http.createServer(function(req, res){ -// console.log(req.headers); -// }); - -// app.on('checkContinue', function(req, res){ -// if ('application/json' == req.headers['content-type']) { -// res.writeContinue(); -// console.log('ok'); -// res.end('thanks') -// } else { -// res.writeHead(400); -// res.end('bad request, json only'); -// } -// }); - -// app.listen(3000); diff --git a/node_modules/express/.npmignore b/node_modules/express/.npmignore deleted file mode 100644 index caf574de4d..0000000000 --- a/node_modules/express/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -.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 deleted file mode 100644 index cc4dba29d9..0000000000 --- a/node_modules/express/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/express/History.md b/node_modules/express/History.md deleted file mode 100644 index b087720b36..0000000000 --- a/node_modules/express/History.md +++ /dev/null @@ -1,1115 +0,0 @@ - -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 `/_?` 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 /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 deleted file mode 100644 index 36075a3b7f..0000000000 --- a/node_modules/express/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2009-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/Makefile b/node_modules/express/Makefile deleted file mode 100644 index 228f299a9e..0000000000 --- a/node_modules/express/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -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 deleted file mode 100644 index 61ee6eaa19..0000000000 --- a/node_modules/express/Readme.md +++ /dev/null @@ -1,180 +0,0 @@ -![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://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito) - * [Русскоязычная документация](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 <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. diff --git a/node_modules/express/bin/express b/node_modules/express/bin/express deleted file mode 100644 index 337c74e0ae..0000000000 --- a/node_modules/express/bin/express +++ /dev/null @@ -1,422 +0,0 @@ -#!/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 ', 'add stylesheet 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 = [ - '' - , '' - , ' ' - , ' <%= title %>' - , ' ' - , ' ' - , ' ' - , '

    <%= title %>

    ' - , '

    Welcome to <%= title %>

    ' - , ' ' - , '' -].join(eol); - -/** - * JSHTML layout template. - */ - -var jshtmlLayout = [ - '' - , '' - , ' ' - , ' @write(title) ' - , ' ' - , ' ' - , ' ' - , ' @write(body)' - , ' ' - , '' -].join(eol); - -/** - * JSHTML index template. - */ - -var jshtmlIndex = [ - '

    @write(title)

    ' - , '

    Welcome to @write(title)

    ' -].join(eol); - -/** - * Hogan.js index template. - */ -var hoganIndex = [ - '' - , '' - , ' ' - , ' {{ title }}' - , ' ' - , ' ' - , ' ' - , '

    {{ title }}

    ' - , '

    Welcome to {{ title }}

    ' - , ' ' - , '' -].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/client.js b/node_modules/express/client.js deleted file mode 100644 index 8984c44d2d..0000000000 --- a/node_modules/express/client.js +++ /dev/null @@ -1,25 +0,0 @@ - -var http = require('http'); - -var times = 50; - -while (times--) { - var req = http.request({ - port: 3000 - , method: 'POST' - , headers: { 'Content-Type': 'application/x-www-form-urlencoded' } - }); - - req.on('response', function(res){ - console.log(res.statusCode); - }); - - var n = 500000; - while (n--) { - req.write('foo=bar&bar=baz&'); - } - - req.write('foo=bar&bar=baz'); - - req.end(); -} \ No newline at end of file diff --git a/node_modules/express/index.js b/node_modules/express/index.js deleted file mode 100644 index bfe99345b7..0000000000 --- a/node_modules/express/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -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 deleted file mode 100644 index e841c1289d..0000000000 --- a/node_modules/express/lib/application.js +++ /dev/null @@ -1,531 +0,0 @@ -/** - * 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.app = res.app = orig; - 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); - - // 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 deleted file mode 100644 index ab55889077..0000000000 --- a/node_modules/express/lib/express.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * 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; - -/** - * Framework version. - */ - -exports.version = '3.2.0'; - -/** - * 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.response = { __proto__: res }; - 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 deleted file mode 100644 index 308c5bb6d5..0000000000 --- a/node_modules/express/lib/middleware.js +++ /dev/null @@ -1,33 +0,0 @@ - -/** - * 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){ - req.app = res.app = app; - 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 deleted file mode 100644 index fd201e3472..0000000000 --- a/node_modules/express/lib/request.js +++ /dev/null @@ -1,526 +0,0 @@ - -/** - * 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'); - return this.connection.encrypted - ? 'https' - : trustProxy - ? (this.get('X-Forwarded-Proto') || 'http') - : 'http'; -}); - -/** - * 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.get('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'); - 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 deleted file mode 100644 index 50fcd051af..0000000000 --- a/node_modules/express/lib/response.js +++ /dev/null @@ -1,756 +0,0 @@ -/** - * 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('

    some html

    '); - * 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 - , head = 'HEAD' == req.method - , 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) { - 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.charset = this.charset || 'utf-8'; - 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) { - 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('

    hey

    '); - * }, - * - * '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('

    hey

    '); - * }, - * - * 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 ('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 = '

    ' + statusCodes[status] + '. Redirecting to ' + u + '

    '; - }, - - 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 deleted file mode 100644 index 662dc29bff..0000000000 --- a/node_modules/express/lib/router/index.js +++ /dev/null @@ -1,273 +0,0 @@ -/** - * 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 deleted file mode 100644 index c1a0b5ea80..0000000000 --- a/node_modules/express/lib/router/route.js +++ /dev/null @@ -1,72 +0,0 @@ - -/** - * 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 deleted file mode 100644 index fd245a8fbb..0000000000 --- a/node_modules/express/lib/utils.js +++ /dev/null @@ -1,313 +0,0 @@ - -/** - * 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, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * 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 deleted file mode 100644 index ae20b17415..0000000000 --- a/node_modules/express/lib/view.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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) 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; - - // . - if (!utils.isAbsolute(path)) path = join(this.root, path); - if (exists(path)) return path; - - // /index. - 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/package.json b/node_modules/express/package.json deleted file mode 100644 index 1536979e5a..0000000000 --- a/node_modules/express/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "express", - "description": "Sinatra inspired web development framework", - "version": "3.2.0", - "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.7.6", - "commander": "0.6.1", - "range-parser": "0.0.4", - "mkdirp": "~0.3.4", - "cookie": "0.0.5", - "buffer-crc32": "~0.2.1", - "fresh": "0.1.0", - "methods": "0.0.1", - "send": "0.1.0", - "cookie-signature": "1.0.1", - "debug": "*" - }, - "devDependencies": { - "ejs": "*", - "mocha": "*", - "jade": "*", - "hjs": "*", - "stylus": "*", - "should": "*", - "connect-redis": "*", - "github-flavored-markdown": "*", - "supertest": "0.0.1" - }, - "keywords": [ - "express", - "framework", - "sinatra", - "web", - "rest", - "restful", - "router", - "app", - "api" - ], - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/express.git" - }, - "main": "index", - "bin": { - "express": "./bin/express" - }, - "scripts": { - "prepublish": "npm prune", - "test": "make test" - }, - "engines": { - "node": "*" - }, - "_id": "express@3.2.0", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.4", - "_nodeVersion": "v0.6.12", - "_defaultsLoaded": true, - "dist": { - "shasum": "c721c85435f232ed531e0a5fe698daf0e0316cdb" - }, - "_from": "express@3.2.0" -} diff --git a/node_modules/express/test.js b/node_modules/express/test.js deleted file mode 100644 index bb6f6d912d..0000000000 --- a/node_modules/express/test.js +++ /dev/null @@ -1,20 +0,0 @@ - -/** - * Module dependencies. - */ - -var express = require('./') - , app = express() - -app.get('/:foo?/:bar?', function(req, res){ - console.log(req.params); -}); - - -app.post('/:foo?/:bar?', function(req, res){ - console.log(req.params); -}); - - -app.listen(5555); -console.log('listening on 5555'); diff --git a/node_modules/redis/.npmignore b/node_modules/redis/.npmignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/node_modules/redis/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/redis/README.md b/node_modules/redis/README.md deleted file mode 100644 index e0cda3d816..0000000000 --- a/node_modules/redis/README.md +++ /dev/null @@ -1,707 +0,0 @@ -redis - a node.js redis client -=========================== - -This is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from -experimental Redis server branches. - - -Install with: - - npm install redis - -Pieter Noordhuis has provided a binding to the official `hiredis` C library, which is non-blocking and fast. To use `hiredis`, do: - - npm install hiredis redis - -If `hiredis` is installed, `node_redis` will use it by default. Otherwise, a pure JavaScript parser will be used. - -If you use `hiredis`, be sure to rebuild it whenever you upgrade your version of node. There are mysterious failures that can -happen between node and native code modules after a node upgrade. - - -## Usage - -Simple example, included as `examples/simple.js`: - -```js - var redis = require("redis"), - client = redis.createClient(); - - // if you'd like to select database 3, instead of 0 (default), call - // client.select(3, function() { /* ... */ }); - - client.on("error", function (err) { - console.log("Error " + err); - }); - - client.set("string key", "string val", redis.print); - client.hset("hash key", "hashtest 1", "some value", redis.print); - client.hset(["hash key", "hashtest 2", "some other value"], redis.print); - client.hkeys("hash key", function (err, replies) { - console.log(replies.length + " replies:"); - replies.forEach(function (reply, i) { - console.log(" " + i + ": " + reply); - }); - client.quit(); - }); -``` - -This will display: - - mjr:~/work/node_redis (master)$ node example.js - Reply: OK - Reply: 0 - Reply: 0 - 2 replies: - 0: hashtest 1 - 1: hashtest 2 - mjr:~/work/node_redis (master)$ - - -## Performance - -Here are typical results of `multi_bench.js` which is similar to `redis-benchmark` from the Redis distribution. -It uses 50 concurrent connections with no pipelining. - -JavaScript parser: - - PING: 20000 ops 42283.30 ops/sec 0/5/1.182 - SET: 20000 ops 32948.93 ops/sec 1/7/1.515 - GET: 20000 ops 28694.40 ops/sec 0/9/1.740 - INCR: 20000 ops 39370.08 ops/sec 0/8/1.269 - LPUSH: 20000 ops 36429.87 ops/sec 0/8/1.370 - LRANGE (10 elements): 20000 ops 9891.20 ops/sec 1/9/5.048 - LRANGE (100 elements): 20000 ops 1384.56 ops/sec 10/91/36.072 - -hiredis parser: - - PING: 20000 ops 46189.38 ops/sec 1/4/1.082 - SET: 20000 ops 41237.11 ops/sec 0/6/1.210 - GET: 20000 ops 39682.54 ops/sec 1/7/1.257 - INCR: 20000 ops 40080.16 ops/sec 0/8/1.242 - LPUSH: 20000 ops 41152.26 ops/sec 0/3/1.212 - LRANGE (10 elements): 20000 ops 36563.07 ops/sec 1/8/1.363 - LRANGE (100 elements): 20000 ops 21834.06 ops/sec 0/9/2.287 - -The performance of `node_redis` improves dramatically with pipelining, which happens automatically in most normal programs. - - -### Sending Commands - -Each Redis command is exposed as a function on the `client` object. -All functions take either an `args` Array plus optional `callback` Function or -a variable number of individual arguments followed by an optional callback. -Here is an example of passing an array of arguments and a callback: - - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], function (err, res) {}); - -Here is that same call in the second style: - - client.mset("test keys 1", "test val 1", "test keys 2", "test val 2", function (err, res) {}); - -Note that in either form the `callback` is optional: - - client.set("some key", "some val"); - client.set(["some other key", "some val"]); - -If the key is missing, reply will be null (probably): - - client.get("missingkey", function(err, reply) { - // reply is null when the key is missing - console.log(reply); - }); - -For a list of Redis commands, see [Redis Command Reference](http://redis.io/commands) - -The commands can be specified in uppercase or lowercase for convenience. `client.get()` is the same as `client.GET()`. - -Minimal parsing is done on the replies. Commands that return a single line reply return JavaScript Strings, -integer replies return JavaScript Numbers, "bulk" replies return node Buffers, and "multi bulk" replies return a -JavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys. - -# API - -## Connection Events - -`client` will emit some events about the state of the connection to the Redis server. - -### "ready" - -`client` will emit `ready` a connection is established to the Redis server and the server reports -that it is ready to receive commands. Commands issued before the `ready` event are queued, -then replayed just before this event is emitted. - -### "connect" - -`client` will emit `connect` at the same time as it emits `ready` unless `client.options.no_ready_check` -is set. If this options is set, `connect` will be emitted when the stream is connected, and then -you are free to try to send commands. - -### "error" - -`client` will emit `error` when encountering an error connecting to the Redis server. - -Note that "error" is a special event type in node. If there are no listeners for an -"error" event, node will exit. This is usually what you want, but it can lead to some -cryptic error messages like this: - - mjr:~/work/node_redis (master)$ node example.js - - node.js:50 - throw e; - ^ - Error: ECONNREFUSED, Connection refused - at IOWatcher.callback (net:870:22) - at node.js:607:9 - -Not very useful in diagnosing the problem, but if your program isn't ready to handle this, -it is probably the right thing to just exit. - -`client` will also emit `error` if an exception is thrown inside of `node_redis` for whatever reason. -It would be nice to distinguish these two cases. - -### "end" - -`client` will emit `end` when an established Redis server connection has closed. - -### "drain" - -`client` will emit `drain` when the TCP connection to the Redis server has been buffering, but is now -writable. This event can be used to stream commands in to Redis and adapt to backpressure. Right now, -you need to check `client.command_queue.length` to decide when to reduce your send rate. Then you can -resume sending when you get `drain`. - -### "idle" - -`client` will emit `idle` when there are no outstanding commands that are awaiting a response. - -## redis.createClient(port, host, options) - -Create a new client connection. `port` defaults to `6379` and `host` defaults -to `127.0.0.1`. If you have `redis-server` running on the same computer as node, then the defaults for -port and host are probably fine. `options` in an object with the following possible properties: - -* `parser`: which Redis protocol reply parser to use. Defaults to `hiredis` if that module is installed. -This may also be set to `javascript`. -* `return_buffers`: defaults to `false`. If set to `true`, then all replies will be sent to callbacks as node Buffer -objects instead of JavaScript Strings. -* `detect_buffers`: default to `false`. If set to `true`, then replies will be sent to callbacks as node Buffer objects -if any of the input arguments to the original command were Buffer objects. -This option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to -every command on a client. -* `socket_nodelay`: defaults to `true`. Whether to call setNoDelay() on the TCP stream, which disables the -Nagle algorithm on the underlying socket. Setting this option to `false` can result in additional throughput at the -cost of more latency. Most applications will want this set to `true`. -* `no_ready_check`: defaults to `false`. When a connection is established to the Redis server, the server might still -be loading the database from disk. While loading, the server not respond to any commands. To work around this, -`node_redis` has a "ready check" which sends the `INFO` command to the server. The response from the `INFO` command -indicates whether the server is ready for more commands. When ready, `node_redis` emits a `ready` event. -Setting `no_ready_check` to `true` will inhibit this check. -* `enable_offline_queue`: defaults to `true`. By default, if there is no active -connection to the redis server, commands are added to a queue and are executed -once the connection has been established. Setting `enable_offline_queue` to -`false` will disable this feature and the callback will be execute immediately -with an error, or an error will be thrown if no callback is specified. -* `retry_max_delay`: defaults to `null`. By default every time the client tries to connect and fails time before -reconnection (delay) almost doubles. This delay normally grows infinitely, but setting `retry_max_delay` limits delay -to maximum value, provided in milliseconds. -* `connect_timeout` defaults to `false`. By default client will try reconnecting until connected. Setting `connect_timeout` -limits total time for client to reconnect. Value is provided in milliseconds and is counted once the disconnect occured. -* `max_attempts` defaults to `null`. By default client will try reconnecting until connected. Setting `max_attempts` -limits total amount of reconnects. - -```js - var redis = require("redis"), - client = redis.createClient(null, null, {detect_buffers: true}); - - client.set("foo_rand000000000000", "OK"); - - // This will return a JavaScript String - client.get("foo_rand000000000000", function (err, reply) { - console.log(reply.toString()); // Will print `OK` - }); - - // This will return a Buffer since original key is specified as a Buffer - client.get(new Buffer("foo_rand000000000000"), function (err, reply) { - console.log(reply.toString()); // Will print `` - }); - client.end(); -``` - -`createClient()` returns a `RedisClient` object that is named `client` in all of the examples here. - -## client.auth(password, callback) - -When connecting to Redis servers that require authentication, the `AUTH` command must be sent as the -first command after connecting. This can be tricky to coordinate with reconnections, the ready check, -etc. To make this easier, `client.auth()` stashes `password` and will send it after each connection, -including reconnections. `callback` is invoked only once, after the response to the very first -`AUTH` command sent. -NOTE: Your call to `client.auth()` should not be inside the ready handler. If -you are doing this wrong, `client` will emit an error that looks -something like this `Error: Ready check failed: ERR operation not permitted`. - -## client.end() - -Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. -If you want to exit cleanly, call `client.quit()` to send the `QUIT` command after you have handled all replies. - -This example closes the connection to the Redis server before the replies have been read. You probably don't -want to do this: - -```js - var redis = require("redis"), - client = redis.createClient(); - - client.set("foo_rand000000000000", "some fantastic value"); - client.get("foo_rand000000000000", function (err, reply) { - console.log(reply.toString()); - }); - client.end(); -``` - -`client.end()` is useful for timeout cases where something is stuck or taking too long and you want -to start over. - -## Friendlier hash commands - -Most Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings. -When dealing with hash values, there are a couple of useful exceptions to this. - -### client.hgetall(hash) - -The reply from an HGETALL command will be converted into a JavaScript Object by `node_redis`. That way you can interact -with the responses using JavaScript syntax. - -Example: - - client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234"); - client.hgetall("hosts", function (err, obj) { - console.dir(obj); - }); - -Output: - - { mjr: '1', another: '23', home: '1234' } - -### client.hmset(hash, obj, [callback]) - -Multiple values in a hash can be set by supplying an object: - - client.HMSET(key2, { - "0123456789": "abcdefghij", // NOTE: key and value will be coerced to strings - "some manner of key": "a type of value" - }); - -The properties and values of this Object will be set as keys and values in the Redis hash. - -### client.hmset(hash, key1, val1, ... keyn, valn, [callback]) - -Multiple values may also be set by supplying a list: - - client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value"); - - -## Publish / Subscribe - -Here is a simple example of the API for publish / subscribe. This program opens two -client connections, subscribes to a channel on one of them, and publishes to that -channel on the other: - -```js - var redis = require("redis"), - client1 = redis.createClient(), client2 = redis.createClient(), - msg_count = 0; - - client1.on("subscribe", function (channel, count) { - client2.publish("a nice channel", "I am sending a message."); - client2.publish("a nice channel", "I am sending a second message."); - client2.publish("a nice channel", "I am sending my last message."); - }); - - client1.on("message", function (channel, message) { - console.log("client1 channel " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.unsubscribe(); - client1.end(); - client2.end(); - } - }); - - client1.incr("did a thing"); - client1.subscribe("a nice channel"); -``` - -When a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into "pub/sub" mode. -At that point, only commands that modify the subscription set are valid. When the subscription -set is empty, the connection is put back into regular mode. - -If you need to send regular commands to Redis while in pub/sub mode, just open another connection. - -## Pub / Sub Events - -If a client has subscriptions active, it may emit these events: - -### "message" (channel, message) - -Client will emit `message` for every message received that matches an active subscription. -Listeners are passed the channel name as `channel` and the message Buffer as `message`. - -### "pmessage" (pattern, channel, message) - -Client will emit `pmessage` for every message received that matches an active subscription pattern. -Listeners are passed the original pattern used with `PSUBSCRIBE` as `pattern`, the sending channel -name as `channel`, and the message Buffer as `message`. - -### "subscribe" (channel, count) - -Client will emit `subscribe` in response to a `SUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. - -### "psubscribe" (pattern, count) - -Client will emit `psubscribe` in response to a `PSUBSCRIBE` command. Listeners are passed the -original pattern as `pattern`, and the new count of subscriptions for this client as `count`. - -### "unsubscribe" (channel, count) - -Client will emit `unsubscribe` in response to a `UNSUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. When -`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted. - -### "punsubscribe" (pattern, count) - -Client will emit `punsubscribe` in response to a `PUNSUBSCRIBE` command. Listeners are passed the -channel name as `channel` and the new count of subscriptions for this client as `count`. When -`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted. - -## client.multi([commands]) - -`MULTI` commands are queued up until an `EXEC` is issued, and then all commands are run atomically by -Redis. The interface in `node_redis` is to return an individual `Multi` object by calling `client.multi()`. - -```js - var redis = require("./index"), - client = redis.createClient(), set_size = 20; - - client.sadd("bigset", "a member"); - client.sadd("bigset", "another member"); - - while (set_size > 0) { - client.sadd("bigset", "member " + set_size); - set_size -= 1; - } - - // multi chain with an individual callback - client.multi() - .scard("bigset") - .smembers("bigset") - .keys("*", function (err, replies) { - // NOTE: code in this callback is NOT atomic - // this only happens after the the .exec call finishes. - client.mget(replies, redis.print); - }) - .dbsize() - .exec(function (err, replies) { - console.log("MULTI got " + replies.length + " replies"); - replies.forEach(function (reply, index) { - console.log("Reply " + index + ": " + reply.toString()); - }); - }); -``` - -`client.multi()` is a constructor that returns a `Multi` object. `Multi` objects share all of the -same command methods as `client` objects do. Commands are queued up inside the `Multi` object -until `Multi.exec()` is invoked. - -You can either chain together `MULTI` commands as in the above example, or you can queue individual -commands while still sending regular client command as in this example: - -```js - var redis = require("redis"), - client = redis.createClient(), multi; - - // start a separate multi command queue - multi = client.multi(); - multi.incr("incr thing", redis.print); - multi.incr("incr other thing", redis.print); - - // runs immediately - client.mset("incr thing", 100, "incr other thing", 1, redis.print); - - // drains multi queue and runs atomically - multi.exec(function (err, replies) { - console.log(replies); // 101, 2 - }); - - // you can re-run the same transaction if you like - multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); - }); -``` - -In addition to adding commands to the `MULTI` queue individually, you can also pass an array -of commands and arguments to the constructor: - -```js - var redis = require("redis"), - client = redis.createClient(), multi; - - client.multi([ - ["mget", "multifoo", "multibar", redis.print], - ["incr", "multifoo"], - ["incr", "multibar"] - ]).exec(function (err, replies) { - console.log(replies); - }); -``` - - -## Monitor mode - -Redis supports the `MONITOR` command, which lets you see all commands received by the Redis server -across all client connections, including from other client libraries and other computers. - -After you send the `MONITOR` command, no other commands are valid on that connection. `node_redis` -will emit a `monitor` event for every new monitor message that comes across. The callback for the -`monitor` event takes a timestamp from the Redis server and an array of command arguments. - -Here is a simple example: - -```js - var client = require("redis").createClient(), - util = require("util"); - - client.monitor(function (err, res) { - console.log("Entering monitoring mode."); - }); - - client.on("monitor", function (time, args) { - console.log(time + ": " + util.inspect(args)); - }); -``` - -# Extras - -Some other things you might like to know about. - -## client.server_info - -After the ready probe completes, the results from the INFO command are saved in the `client.server_info` -object. - -The `versions` key contains an array of the elements of the version string for easy comparison. - - > client.server_info.redis_version - '2.3.0' - > client.server_info.versions - [ 2, 3, 0 ] - -## redis.print() - -A handy callback function for displaying return values when testing. Example: - -```js - var redis = require("redis"), - client = redis.createClient(); - - client.on("connect", function () { - client.set("foo_rand000000000000", "some fantastic value", redis.print); - client.get("foo_rand000000000000", redis.print); - }); -``` - -This will print: - - Reply: OK - Reply: some fantastic value - -Note that this program will not exit cleanly because the client is still connected. - -## redis.debug_mode - -Boolean to enable debug mode and protocol tracing. - -```js - var redis = require("redis"), - client = redis.createClient(); - - redis.debug_mode = true; - - client.on("connect", function () { - client.set("foo_rand000000000000", "some fantastic value"); - }); -``` - -This will display: - - mjr:~/work/node_redis (master)$ node ~/example.js - send command: *3 - $3 - SET - $20 - foo_rand000000000000 - $20 - some fantastic value - - on_data: +OK - -`send command` is data sent into Redis and `on_data` is data received from Redis. - -## Multi-word commands - -To execute redis multi-word commands like `SCRIPT LOAD` or `CLIENT LIST` pass -the second word as first parameter: - - client.script('load', 'return 1'); - client.multi().script('load', 'return 1').exec(...); - client.multi([['script', 'load', 'return 1']]).exec(...); - -## client.send_command(command_name, args, callback) - -Used internally to send commands to Redis. For convenience, nearly all commands that are published on the Redis -Wiki have been added to the `client` object. However, if I missed any, or if new commands are introduced before -this library is updated, you can use `send_command()` to send arbitrary commands to Redis. - -All commands are sent as multi-bulk commands. `args` can either be an Array of arguments, or omitted. - -## client.connected - -Boolean tracking the state of the connection to the Redis server. - -## client.command_queue.length - -The number of commands that have been sent to the Redis server but not yet replied to. You can use this to -enforce some kind of maximum queue depth for commands while connected. - -Don't mess with `client.command_queue` though unless you really know what you are doing. - -## client.offline_queue.length - -The number of commands that have been queued up for a future connection. You can use this to enforce -some kind of maximum queue depth for pre-connection commands. - -## client.retry_delay - -Current delay in milliseconds before a connection retry will be attempted. This starts at `250`. - -## client.retry_backoff - -Multiplier for future retry timeouts. This should be larger than 1 to add more time between retries. -Defaults to 1.7. The default initial connection retry is 250, so the second retry will be 425, followed by 723.5, etc. - -### Commands with Optional and Keyword arguments - -This applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset count]` in the [redis.io/commands](http://redis.io/commands) documentation. - -Example: -```js -var args = [ 'myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine' ]; -client.zadd(args, function (err, response) { - if (err) throw err; - console.log('added '+response+' items.'); - - // -Infinity and +Infinity also work - var args1 = [ 'myzset', '+inf', '-inf' ]; - client.zrevrangebyscore(args1, function (err, response) { - if (err) throw err; - console.log('example1', response); - // write your code here - }); - - var max = 3, min = 1, offset = 1, count = 2; - var args2 = [ 'myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count ]; - client.zrevrangebyscore(args2, function (err, response) { - if (err) throw err; - console.log('example2', response); - // write your code here - }); -}); -``` - -## TODO - -Better tests for auth, disconnect/reconnect, and all combinations thereof. - -Stream large set/get values into and out of Redis. Otherwise the entire value must be in node's memory. - -Performance can be better for very large values. - -I think there are more performance improvements left in there for smaller values, especially for large lists of small values. - -## How to Contribute -- open a pull request and then wait for feedback (if - [DTrejo](http://github.com/dtrejo) does not get back to you within 2 days, - comment again with indignation!) - -## Contributors -Some people have have added features and fixed bugs in `node_redis` other than me. - -Ordered by date of first contribution. -[Auto-generated](http://github.com/dtrejo/node-authors) on Wed Jul 25 2012 19:14:59 GMT-0700 (PDT). - -- [Matt Ranney aka `mranney`](https://github.com/mranney) -- [Tim-Smart aka `tim-smart`](https://github.com/tim-smart) -- [Tj Holowaychuk aka `visionmedia`](https://github.com/visionmedia) -- [rick aka `technoweenie`](https://github.com/technoweenie) -- [Orion Henry aka `orionz`](https://github.com/orionz) -- [Aivo Paas aka `aivopaas`](https://github.com/aivopaas) -- [Hank Sims aka `hanksims`](https://github.com/hanksims) -- [Paul Carey aka `paulcarey`](https://github.com/paulcarey) -- [Pieter Noordhuis aka `pietern`](https://github.com/pietern) -- [nithesh aka `nithesh`](https://github.com/nithesh) -- [Andy Ray aka `andy2ray`](https://github.com/andy2ray) -- [unknown aka `unknowdna`](https://github.com/unknowdna) -- [Dave Hoover aka `redsquirrel`](https://github.com/redsquirrel) -- [Vladimir Dronnikov aka `dvv`](https://github.com/dvv) -- [Umair Siddique aka `umairsiddique`](https://github.com/umairsiddique) -- [Louis-Philippe Perron aka `lp`](https://github.com/lp) -- [Mark Dawson aka `markdaws`](https://github.com/markdaws) -- [Ian Babrou aka `bobrik`](https://github.com/bobrik) -- [Felix Geisendörfer aka `felixge`](https://github.com/felixge) -- [Jean-Hugues Pinson aka `undefined`](https://github.com/undefined) -- [Maksim Lin aka `maks`](https://github.com/maks) -- [Owen Smith aka `orls`](https://github.com/orls) -- [Zachary Scott aka `zzak`](https://github.com/zzak) -- [TEHEK Firefox aka `TEHEK`](https://github.com/TEHEK) -- [Isaac Z. Schlueter aka `isaacs`](https://github.com/isaacs) -- [David Trejo aka `DTrejo`](https://github.com/DTrejo) -- [Brian Noguchi aka `bnoguchi`](https://github.com/bnoguchi) -- [Philip Tellis aka `bluesmoon`](https://github.com/bluesmoon) -- [Marcus Westin aka `marcuswestin2`](https://github.com/marcuswestin2) -- [Jed Schmidt aka `jed`](https://github.com/jed) -- [Dave Peticolas aka `jdavisp3`](https://github.com/jdavisp3) -- [Trae Robrock aka `trobrock`](https://github.com/trobrock) -- [Shankar Karuppiah aka `shankar0306`](https://github.com/shankar0306) -- [Ignacio Burgueño aka `ignacio`](https://github.com/ignacio) - -Thanks. - -## LICENSE - "MIT License" - -Copyright (c) 2010 Matthew Ranney, http://ranney.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. - -![spacer](http://ranney.com/1px.gif) diff --git a/node_modules/redis/benches/buffer_bench.js b/node_modules/redis/benches/buffer_bench.js deleted file mode 100644 index a504fbc087..0000000000 --- a/node_modules/redis/benches/buffer_bench.js +++ /dev/null @@ -1,89 +0,0 @@ -var source = new Buffer(100), - dest = new Buffer(100), i, j, k, tmp, count = 1000000, bytes = 100; - -for (i = 99 ; i >= 0 ; i--) { - source[i] = 120; -} - -var str = "This is a nice String.", - buf = new Buffer("This is a lovely Buffer."); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (Buffer.isBuffer(str)) {} -} -var end = new Date(); -console.log("Buffer.isBuffer(str) " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (Buffer.isBuffer(buf)) {} -} -var end = new Date(); -console.log("Buffer.isBuffer(buf) " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (str instanceof Buffer) {} -} -var end = new Date(); -console.log("str instanceof Buffer " + (end - start) + " ms"); - -var start = new Date(); -for (i = count * 100; i > 0 ; i--) { - if (buf instanceof Buffer) {} -} -var end = new Date(); -console.log("buf instanceof Buffer " + (end - start) + " ms"); - -for (i = bytes ; i > 0 ; i --) { - var start = new Date(); - for (j = count ; j > 0; j--) { - tmp = source.toString("ascii", 0, bytes); - } - var end = new Date(); - console.log("toString() " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i --) { - var start = new Date(); - for (j = count ; j > 0; j--) { - tmp = ""; - for (k = 0; k <= i ; k++) { - tmp += String.fromCharCode(source[k]); - } - } - var end = new Date(); - console.log("manual string " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - for (k = i ; k > 0 ; k--) { - dest[k] = source[k]; - } - } - var end = new Date(); - console.log("Manual copy " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - for (k = i ; k > 0 ; k--) { - dest[k] = 120; - } - } - var end = new Date(); - console.log("Direct assignment " + i + " bytes " + (end - start) + " ms"); -} - -for (i = bytes ; i > 0 ; i--) { - var start = new Date(); - for (j = count ; j > 0 ; j--) { - source.copy(dest, 0, 0, i); - } - var end = new Date(); - console.log("Buffer.copy() " + i + " bytes " + (end - start) + " ms"); -} diff --git a/node_modules/redis/benches/hiredis_parser.js b/node_modules/redis/benches/hiredis_parser.js deleted file mode 100644 index f1515b110b..0000000000 --- a/node_modules/redis/benches/hiredis_parser.js +++ /dev/null @@ -1,38 +0,0 @@ -var Parser = require('../lib/parser/hiredis').Parser; -var assert = require('assert'); - -/* -This test makes sure that exceptions thrown inside of "reply" event handlers -are not trapped and mistakenly emitted as parse errors. -*/ -(function testExecuteDoesNotCatchReplyCallbackExceptions() { - var parser = new Parser(); - var replies = [{}]; - - parser.reader = { - feed: function() {}, - get: function() { - return replies.shift(); - } - }; - - var emittedError = false; - var caughtException = false; - - parser - .on('error', function() { - emittedError = true; - }) - .on('reply', function() { - throw new Error('bad'); - }); - - try { - parser.execute(); - } catch (err) { - caughtException = true; - } - - assert.equal(caughtException, true); - assert.equal(emittedError, false); -})(); diff --git a/node_modules/redis/benches/re_sub_test.js b/node_modules/redis/benches/re_sub_test.js deleted file mode 100644 index 64b8f31287..0000000000 --- a/node_modules/redis/benches/re_sub_test.js +++ /dev/null @@ -1,14 +0,0 @@ -var client = require('../index').createClient() - , client2 = require('../index').createClient() - , assert = require('assert'); - -client.once('subscribe', function (channel, count) { - client.unsubscribe('x'); - client.subscribe('x', function () { - client.quit(); - client2.quit(); - }); - client2.publish('x', 'hi'); -}); - -client.subscribe('x'); diff --git a/node_modules/redis/benches/reconnect_test.js b/node_modules/redis/benches/reconnect_test.js deleted file mode 100644 index 7abdd51665..0000000000 --- a/node_modules/redis/benches/reconnect_test.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("../index").createClient(null, null, { -// max_attempts: 4 -}); - -redis.on("error", function (err) { - console.log("Redis says: " + err); -}); - -redis.on("ready", function () { - console.log("Redis ready."); -}); - -redis.on("reconnecting", function (arg) { - console.log("Redis reconnecting: " + JSON.stringify(arg)); -}); -redis.on("connect", function () { - console.log("Redis connected."); -}); - -setInterval(function () { - var now = Date.now(); - redis.set("now", now, function (err, res) { - if (err) { - console.log(now + " Redis reply error: " + err); - } else { - console.log(now + " Redis reply: " + res); - } - }); -}, 100); diff --git a/node_modules/redis/benches/stress/codec.js b/node_modules/redis/benches/stress/codec.js deleted file mode 100644 index 7d764f6072..0000000000 --- a/node_modules/redis/benches/stress/codec.js +++ /dev/null @@ -1,16 +0,0 @@ -var json = { - encode: JSON.stringify, - decode: JSON.parse -}; - -var MsgPack = require('node-msgpack'); -msgpack = { - encode: MsgPack.pack, - decode: function(str) { return MsgPack.unpack(new Buffer(str)); } -}; - -bison = require('bison'); - -module.exports = json; -//module.exports = msgpack; -//module.exports = bison; diff --git a/node_modules/redis/benches/stress/pubsub/pub.js b/node_modules/redis/benches/stress/pubsub/pub.js deleted file mode 100644 index 0acde7a6eb..0000000000 --- a/node_modules/redis/benches/stress/pubsub/pub.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var profiler = require('v8-profiler'); -var codec = require('../codec'); - -var sent = 0; - -var pub = require('redis').createClient(null, null, { - //command_queue_high_water: 5, - //command_queue_low_water: 1 -}) -.on('ready', function() { - this.emit('drain'); -}) -.on('drain', function() { - process.nextTick(exec); -}); - -var payload = '1'; for (var i = 0; i < 12; ++i) payload += payload; -console.log('Message payload length', payload.length); - -function exec() { - pub.publish('timeline', codec.encode({ foo: payload })); - ++sent; - if (!pub.should_buffer) { - process.nextTick(exec); - } -} - -profiler.takeSnapshot('s_0'); - -exec(); - -setInterval(function() { - profiler.takeSnapshot('s_' + sent); - console.error('sent', sent, 'free', freemem(), 'cmdqlen', pub.command_queue.length, 'offqlen', pub.offline_queue.length); -}, 2000); diff --git a/node_modules/redis/benches/stress/pubsub/run b/node_modules/redis/benches/stress/pubsub/run deleted file mode 100644 index bd9ac39253..0000000000 --- a/node_modules/redis/benches/stress/pubsub/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node server.js & -node --debug pub.js diff --git a/node_modules/redis/benches/stress/pubsub/server.js b/node_modules/redis/benches/stress/pubsub/server.js deleted file mode 100644 index 035e6b7440..0000000000 --- a/node_modules/redis/benches/stress/pubsub/server.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var codec = require('../codec'); - -var id = Math.random(); -var recv = 0; - -var sub = require('redis').createClient() - .on('ready', function() { - this.subscribe('timeline'); - }) - .on('message', function(channel, message) { - var self = this; - if (message) { - message = codec.decode(message); - ++recv; - } - }); - -setInterval(function() { - console.error('id', id, 'received', recv, 'free', freemem()); -}, 2000); diff --git a/node_modules/redis/benches/stress/rpushblpop/pub.js b/node_modules/redis/benches/stress/rpushblpop/pub.js deleted file mode 100644 index 9caf1d0b82..0000000000 --- a/node_modules/redis/benches/stress/rpushblpop/pub.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -//var profiler = require('v8-profiler'); -var codec = require('../codec'); - -var sent = 0; - -var pub = require('redis').createClient(null, null, { - //command_queue_high_water: 5, - //command_queue_low_water: 1 -}) -.on('ready', function() { - this.del('timeline'); - this.emit('drain'); -}) -.on('drain', function() { - process.nextTick(exec); -}); - -var payload = '1'; for (var i = 0; i < 12; ++i) payload += payload; -console.log('Message payload length', payload.length); - -function exec() { - pub.rpush('timeline', codec.encode({ foo: payload })); - ++sent; - if (!pub.should_buffer) { - process.nextTick(exec); - } -} - -//profiler.takeSnapshot('s_0'); - -exec(); - -setInterval(function() { - //var ss = profiler.takeSnapshot('s_' + sent); - //console.error(ss.stringify()); - pub.llen('timeline', function(err, result) { - console.error('sent', sent, 'free', freemem(), - 'cmdqlen', pub.command_queue.length, 'offqlen', pub.offline_queue.length, - 'llen', result - ); - }); -}, 2000); - -/*setTimeout(function() { - process.exit(); -}, 30000);*/ diff --git a/node_modules/redis/benches/stress/rpushblpop/run b/node_modules/redis/benches/stress/rpushblpop/run deleted file mode 100644 index 8045ae8045..0000000000 --- a/node_modules/redis/benches/stress/rpushblpop/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -node server.js & -#node server.js & -#node server.js & -#node server.js & -node --debug pub.js diff --git a/node_modules/redis/benches/stress/rpushblpop/server.js b/node_modules/redis/benches/stress/rpushblpop/server.js deleted file mode 100644 index 9cbcdd9ed7..0000000000 --- a/node_modules/redis/benches/stress/rpushblpop/server.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -var freemem = require('os').freemem; -var codec = require('../codec'); - -var id = Math.random(); -var recv = 0; - -var cmd = require('redis').createClient(); -var sub = require('redis').createClient() - .on('ready', function() { - this.emit('timeline'); - }) - .on('timeline', function() { - var self = this; - this.blpop('timeline', 0, function(err, result) { - var message = result[1]; - if (message) { - message = codec.decode(message); - ++recv; - } - self.emit('timeline'); - }); - }); - -setInterval(function() { - cmd.llen('timeline', function(err, result) { - console.error('id', id, 'received', recv, 'free', freemem(), 'llen', result); - }); -}, 2000); diff --git a/node_modules/redis/benches/stress/speed/00 b/node_modules/redis/benches/stress/speed/00 deleted file mode 100644 index 29d7bf7c5d..0000000000 --- a/node_modules/redis/benches/stress/speed/00 +++ /dev/null @@ -1,13 +0,0 @@ -# size JSON msgpack bison -26602 2151.0170848180414 -25542 ? 2842.589272665782 -24835 ? ? 7280.4538397469805 -6104 6985.234528557929 -5045 ? 7217.461392841478 -4341 ? ? 14261.406335354604 -4180 15864.633685636572 -4143 ? 12954.806235781925 -4141 ? ? 44650.70733912719 -75 114227.07313350472 -40 ? 30162.440062810834 -39 ? ? 119815.66013519121 diff --git a/node_modules/redis/benches/stress/speed/plot b/node_modules/redis/benches/stress/speed/plot deleted file mode 100644 index 2563797cf5..0000000000 --- a/node_modules/redis/benches/stress/speed/plot +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -gnuplot >size-rate.jpg << _EOF_ - -set terminal png nocrop enhanced font verdana 12 size 640,480 -set logscale x -set logscale y -set grid -set xlabel 'Serialized object size, octets' -set ylabel 'decode(encode(obj)) rate, 1/sec' -plot '00' using 1:2 title 'json' smooth bezier, '00' using 1:3 title 'msgpack' smooth bezier, '00' using 1:4 title 'bison' smooth bezier - -_EOF_ diff --git a/node_modules/redis/benches/stress/speed/size-rate.png b/node_modules/redis/benches/stress/speed/size-rate.png deleted file mode 100644 index c9c2bee6b076040ccf7e6bc337c307732c400463..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6672 zcmb_gcT^KkyG}v^p$MTvXrUJokPcD;(wj5^r5FTh(xga{5<-_^Kn-960g+w=L3$7= z3Me3;NLN5QD1!9djsEWUefOOE&pqev*|R%4JM+HJJp0bfK5w$Qnf@snBn=1zI%Q~} zV+jI5upkh47ES@wKo}&)fCpJ~6Kh=(i3HT-<>irYL=Xr|B7#VujSV6i)Y}Wv@|+_P zQ6Mauh$YEjuqhxA8Ve#}NztT{XA%-XSM=;4&<}}3%E`%@nwq+~xkX1u=j7zn*47e< z#Qy&Ng@pyc#g?oregj|ed2#FF)+~v%F@+=5cT{a`kUoI`Zy;CT8ZD3_AeCbK=Q)Lw z(;t8W0u3a-Uj>mNl0ff=NGx|r(dJuNEJ+u1fDKqCgl{dTwl-XUl|Z|*Gnt1)k)DAz za2xkPAE)xB@aE`?*QK#6AS??D77d(OEQW~1kg#O@Xi^?(EE* zk7)_z5_GydHtiN8^X5S(R-w4)Bkdp5^J_1CUpo5a1bugab382tSo&X%)A=P;Q6ujz z*B?A;tK?!F5GE$s)a!%2MlU{I`_--$-PzZWypEhD4py5&9KJMrg+I5Lc^SLWcI9}R zWdlr^8espWd4Wefft|msbaPmlGF0YW#iw=0_AvLb`;J$B3&dZ?QrsQXc{b5p&+BOm z9y`x0mWM_p8F~m#ge-o#9Ndwwq)GV-p^N>wmtNe>ZO&(1#8ow^s=mBov@_cAqdg(^ z+V+%HUtdPSwI}Vr7)(?!?rjD79bUV-eDJV?8rx4%p|y2()kn{wF+8x8&Cegw<)pOl zq;!R%!UK^ab@obya%oq-9Cl?nwcTG_Pd6L;){=^Z@fBS~&`K3CpA3fx1+DU(@1uSy zL7XipFh&t2o=7rv@AKySf;SOq@)ix)kR-ha#rEFCJ+dn5s*h+5=Vg6=c_#~S#1-mJ z75eo|{H}N)YW3QxVXb}f%xOM?7zAAO%;|ideMe=k?}Km#Iw;(X{0BH!BHXaBnM3h#BMu6FMIW-tAIKOgBgw(SM}n4?E;w_Zv$ z#_fMdu}Me*1D1KqKKEEu7pp1=C4jW#y&Q#PHBO)XK%tFAA%C2l=m?sQoRNaVWgdIZ zV>@#-rvtxO!;%6d*)Y5ap#+b@gbM3@^SsIwok#)Q$d@i@|`hJ51JiM*Tx-%2gj2QT%>7ga!ME84X_Q$gDO{D9BR0V za4v|F{3X6($haJq{=lQ~EF;gonx-hpnwk64Wy1G&eDJY_ z<3UQ&J;S$Zj)GL}N+}{&tMVrxMK|-j>mh2=t+^>bgPC8#&Bv&~C*%GLH0nu!+np0# zN!W+$w8ezYliOZ1kfXyl(G4@r2U1_0=>5tpwtm@VA|-Ey#PcFB=Jk+C!t{l0?6ES#=VkTswjEzy|LHYi z+38=X6`Qw9zBj{;WRYZ6D>5z4)2ox{z&5T^5}d)`Di~fI^_|fXOgqP~MtqDHL}08@ zXgo`PhR6!r7X6R`b8uOx*SG6xDR0p9*$I2mA@D&cL~`=$X<#U7+dj&U5q#HjBFN2c zex%03zeRn$L3k^Q^vw5V{os&Zb#l^t`54nT&zvS7K$P!a*jw4;bI*x@55_fsp4%Sp zjLPnl#{E4rxOJu^p47a&yFH`%T6P}*x+@Yqm%6Ywu#xi$-#33ZP0pg>w!2i%Cl$=S zYd@3qkSZ8t{Wccxl?XDmqm|J>pbTipXlX+e{}mp+;6@PmK{X3T^&|ASwV&0T5;^1!4In#b~(~;>rN+g*6+LU9>N|F*jC?#yV7| z1l0|&WKaZjNDW&qNqY^PkZVmQbekR%*8Dn^YjIM_QjKtbbBwyrQx3KlcUHkwcrt6` zd5=^|gqQZ=jwZfD9!x+66G?O)K4+R8y2hpxD<$ z^S?)H#ef=TM<6$|lcf3rv>gJ_ts(AqD6~{jg?>ly85a{Bss>QKt02+tKWKAdU#_&( zEm083r>%X2IK++cQ%E+U?mq(sz6I|H)e+S&H(Z5?HkYH{f#G=CF-QOHE;)W8AK^mR z+smHPM>+r#QV1U}vKM}|`85Gzo2RafCLQqnS*Pi6S2h#Q4;1xOGvQ<^_=od-%o*$m z3u*zxY(#LGT>vv`BMx){jYWwAAEu96hDR}@(iXQb_mIYC7D<5g3sQL#+%t^WP{uzI zdHC0JR%Uy$TQk__#xW>6fXb}-UOnt>(n&1cvUXk7_U70#xMufn$v|RIHDlgahuGX! z=p`DNJKS69`8kyn@4_AQ<_5I<8%k3Wwp{9QYhotY3h$oPn=d|+oOqxi*B5nS@fZo5 zP7~wD;GH*V$fgz*_{La*%Xv7gh~K)fXVu6e?V)OmO48gIn~T4i5{~RCj&=6u!6GWb zo~mAgTe#N}o3ntGzUkGgi+!LQ=WW%|4=qk;tg2j#r%sH=7+erP`&T2iyH{z{dqk&sj%EoLhNqOf zQS%vDhjHb)v5(7pR2G$}-us3nI__voLFQ{O^nQ;;J`nq?+cbSdOB3VB5-b5fmC&X5 zzGau1Q(y3he3DkL;N&iK4&|E+a#?N-D1UdQ*-WWr#7M#$Uz*UeRd(on)(w9WC9XoH z_Ts&X3ucYy(89mV4e{bds|u5EIAtuJDqLkihHo*g^{zj1(Sfr2xDkbPRfgB31CQQ&%`r)>GG|w4o(Z*bX7?OQb=*?IE77vRLTySeTFYfa`z)%XCW~E~ zFU?(gM$kNU74b8P<$!rn&ijO4f|!yYd4X*9hNRwX4u#pHtTMN0*6#vnae|GEWE?DX zXP!x<V z+dCW?i@$aAjzDs?LJ24B*0B>q(Lc7GzDjnu0;`;>d+(K>;ZGxFnM`7R9-XC$>N{-Z zePulO)q%GFbEP$-6=>f`Re&*`_6wCWLICEnQ*r87Yrb24O;@G`cgGdmkJ%aGugQ8a zE{Bgp3@yCb*Ek=heOERbR2YuQN)#8M;trdEpL`S3$~QIDf<#Db`KY8pYu|z=G~UUh zMoH|IcI%*r+PFq|^~GBwNtM!J&kJSnSr~~&ye3M&m408i0jZlzetZWyMOY*TcF?Oy z_`Bz%K-LA+*O@-uZ_&WK3R)`Rnzm2>0$+S_p%;HleV-zqqvKSWukzwZ5L+yMKr-m9 zqrZ81w*YIR1D?F2EPxIC8HNn9l;Jsz*0b>oFNBxsoP)PKiTSY5ak$fEdg%_y0HRSA zv{cJr_A2qVcjp@IM3nMgp@|gao_4f&c>Aof-RbI)C=TYKlTIdgE%VwY@&Z7tE?ER-HPO6s(Y1p7z5Zfjepseg0afb!hOE zy}i^^#=2JK;ZkA7HdB-z+iQjXI|3#I`bcicLraX5N*?lPtmD%{vG((#X!%>Ni8V>m zutfo4__nmzSxYONgo!41db$;@ow)*?!l@Tr^v(0w_=}w!XPld+4eW2OB+3!;KFaaK zq|AOb%*Q9gvfcDVvbbfCC6fXf>>?bgK)e}F8C7)zbO<$Y!g1lK}d!an1Ac@gCMzo3gKAP_XOXWndj#xw`rbTM`Z>ZgV;W< zD|ulFAlkN(agVM_zjp6~NgyEdKXT~D4Y%SK%tICf-h!WB6Mwd~*~^0Xcl=VAz3`x?3QqfwsZf=H;|tn5;&!zdEFU#0;VJdhzn0S=<=mSRCNlJc^>xS-Z}e{xw4Zli%H8Ak-d6DN~!z zm3OR(K6@;Z-`Q!3y}w;7^xM#Lb+iVu?@Sb?nw%S>bJJj{@dk62Gh_!PJ7q--CPILp zg#xXS3Nbt5!Om0^)B`_7zVt-(1GjD=pe> zu!hjGf+Zy7_a?$if#BB#no?~l>=}z>r-1q zOR}S%Nh`&`uOW$6ojwL69cDr~#nfTVRF@nidT2v;MR%fos?uEkZj8-Xftw#a_ta0i zDQ^Ec!&nss9O0u(nnZ8rz{FzJ{dJE#E|#*BDV|r&3-{@ucIv@hV>H%9AH`(63%Sm6 z4rcm1oQMteW$mbd`mh$i%q`?f53(}7?d4#(xQHsX7xov`dhVng4~@-o89n^;FqUuf z>pN4~r6S_qvHw;;`5H7^pZ=Atu)XSqJ!a*&fOGDv8GD{|?$VvR14>jIzWYM8TD|XbppSj~(sVLWLq(L3ppI5X zH3c5s7;9LzZ$tkhl|I-N@hykLIWDa-@?ksZPoTKfk6y&TN%wJ@@30{6JuT!n&lu`9`PC&_ZSQ&6iWREb}x6ArJ0}5!0X_M4=y# zhphwArQ7HCUl?u8Cze1xc)qh0%tka?VPyYE^c*=Q+&vZp`Qcu0r;H&UPu{l97>mb8 z>+hnmPnB&kQn7gP!|TRU24@~y0V^$v5h1hK$-S%%UpYwO1V z?}Ag)yoOD6Y7u!QL~oINU?-`-nNMw%5*;Y{hXCDTLB}LCNK17k|I;bB3?&N-M?|ud zk_|q-dG2neRuS$%w5|Xw zU*JpJGtm9z3z^iM);h6X!);Bc*&SnwlPGC(p;I!W!r`&@Aon+$34f%YK#&r*74DDp zsw@f)v(bTRWAnavMq6X#shP;h4m%k_aW@ck26tNx2VzQ0G!r0iyE#=bMgkIeZ`$nl z^2T6fkvmKekAlKW3wFOJF1!Y&KCsJoCF;gJ6$ZEmk{EA(68$k`djZ7x@;l{J7lD-s z5QFYT-^36Q=xF?If!NuoP@K^3ma@} zyw}*H_tzug&Nw{0S(Yq#Q_emm#|lRrUT`p7;14HlXL_| z5HjWris3iy5Pmc>0TSW!r5Pxhk9*8C{B1iMYBjI_ClJwd7ym+%)nJ8_g>>FC&pR}6 zAgyavkIi}we1DI0*W0) z_N+rsUe~Y2fBN^H$PjvAKz`vFD1!nJ^kslz1+?{lB*DmH`2Q0C;U`S&!CTAI*Tb?hkO6eHBY9*d>TfQjkuh)_X^ zN)Iiz8dT1KP(lTu_$NEe?o=SC%lam;2-m*vA?K(6eV~+khL3gJ1V1-KnD7@}+T5*3 z?M^#RcUg`SsAXK6&?rI-m4_VK=zZ&s`cM<3nK2IE_2IKh@)&E5JY8_ZC7LKUVdScq zeyk(xb;s@e=V(9qxM14hdwou0eIjR(pAQPg5xX;7X}pK(2o!W_rU~}Xtrwg@anRt~ z;a0~|Yd#~x)pK%xh&aYKkWfvU_V}78ucu$YzQX19?Q^^AzpR+<ffXJpQWv*itUYIncYVgkvp-rxs)wS2ThfShdV~R@&V#RxdSD$){~fkoK$T7r-Y62H7q9^z-^>ez6agpH_NnHg;JjpL5#t%`ohD-#3Pd(I*GK zY?DX6>UE{xV!}$z@0gn~#3#=M7#)9ScTy%D{i;0iZA0{C>@enBTPO-2bC|iU6*r(k zwbll7r8K1T;)))o--JiTXwhr$tn4g~+*E$Kt~5}PyB6$WCO3#65rlO^uudtYyd{5sT3vAGc@{Jx{k3Tfrf6neyAQVVJi{G4SqaV%!HL~B|w>&ppSwHn1X-hb#E(w>gH!|nuq=@9gLe?e`> z@s5T6`=HiG8*z1=9cmN>S4K=T^&(a;VXYQNE1tJKq;j~xYIH6@(cy#2?A!P(wt;M_ zM;e;Bz#C~OHs)5l*kFE4F5?EooBk~dR6mkj?+X4`XmOrUeXS8zTs@s^My@l|HPflo H#^C-7XAtZ( diff --git a/node_modules/redis/benches/stress/speed/speed.js b/node_modules/redis/benches/stress/speed/speed.js deleted file mode 100644 index 8e43cbc03b..0000000000 --- a/node_modules/redis/benches/stress/speed/speed.js +++ /dev/null @@ -1,84 +0,0 @@ -var msgpack = require('node-msgpack'); -var bison = require('bison'); -var codec = { - JSON: { - encode: JSON.stringify, - decode: JSON.parse - }, - msgpack: { - encode: msgpack.pack, - decode: msgpack.unpack - }, - bison: bison -}; - -var obj, l; - -var s = '0'; -for (var i = 0; i < 12; ++i) s += s; - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [], - a: s, - ccc: s, - b: s + s + s -}; -for (i = 0; i < 100; ++i) obj.rand.push(Math.random()); -forObj(obj); - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -for (i = 0; i < 100; ++i) obj.rand.push(Math.random()); -forObj(obj); - -obj = { - foo: s, - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -forObj(obj); - -obj = { - arrrrrr: [{a:1,b:false,c:null,d:1.0}, 1111, 2222, 33333333], - rand: [] -}; -forObj(obj); - -function run(obj, codec) { - var t1 = Date.now(); - var n = 10000; - for (var i = 0; i < n; ++i) { - codec.decode(l = codec.encode(obj)); - } - var t2 = Date.now(); - //console.log('DONE', n*1000/(t2-t1), 'codecs/sec, length=', l.length); - return [n*1000/(t2-t1), l.length]; -} - -function series(obj, cname, n) { - var rate = 0; - var len = 0; - for (var i = 0; i < n; ++i) { - var r = run(obj, codec[cname]); - rate += r[0]; - len += r[1]; - } - rate /= n; - len /= n; - console.log(cname + ' ' + rate + ' ' + len); - return [rate, len]; -} - -function forObj(obj) { - var r = { - JSON: series(obj, 'JSON', 20), - msgpack: series(obj, 'msgpack', 20), - bison: series(obj, 'bison', 20) - }; - return r; -} diff --git a/node_modules/redis/benches/sub_quit_test.js b/node_modules/redis/benches/sub_quit_test.js deleted file mode 100644 index ad1f413228..0000000000 --- a/node_modules/redis/benches/sub_quit_test.js +++ /dev/null @@ -1,18 +0,0 @@ -var client = require("redis").createClient(), - client2 = require("redis").createClient(); - -client.subscribe("something"); -client.on("subscribe", function (channel, count) { - console.log("Got sub: " + channel); - client.unsubscribe("something"); -}); - -client.on("unsubscribe", function (channel, count) { - console.log("Got unsub: " + channel + ", quitting"); - client.quit(); -}); - -// exercise unsub before sub -client2.unsubscribe("something"); -client2.subscribe("another thing"); -client2.quit(); diff --git a/node_modules/redis/changelog.md b/node_modules/redis/changelog.md deleted file mode 100644 index e4e3277b54..0000000000 --- a/node_modules/redis/changelog.md +++ /dev/null @@ -1,240 +0,0 @@ -Changelog -========= - -## v0.8.2 - November 11, 2012 - -Another version bump because 0.8.1 didn't get applied properly for some mysterious reason. -Sorry about that. - -Changed name of "faster" parser to "javascript". - -## v0.8.1 - September 11, 2012 - -Important bug fix for null responses (Jerry Sievert) - -## v0.8.0 - September 10, 2012 - -Many contributed features and fixes, including: - -* Pure JavaScript reply parser that is usually faster than hiredis (Jerry Sievert) -* Remove hiredis as optionalDependency from package.json. It still works if you want it. -* Restore client state on reconnect, including select, subscribe, and monitor. (Ignacio Burgueño) -* Fix idle event (Trae Robrock) -* Many documentation improvements and bug fixes (David Trejo) - -## v0.7.2 - April 29, 2012 - -Many contributed fixes. Thank you, contributors. - -* [GH-190] - pub/sub mode fix (Brian Noguchi) -* [GH-165] - parser selection fix (TEHEK) -* numerous documentation and examples updates -* auth errors emit Errors instead of Strings (David Trejo) - -## v0.7.1 - November 15, 2011 - -Fix regression in reconnect logic. - -Very much need automated tests for reconnection and queue logic. - -## v0.7.0 - November 14, 2011 - -Many contributed fixes. Thanks everybody. - -* [GH-127] - properly re-initialize parser on reconnect -* [GH-136] - handle passing undefined as callback (Ian Babrou) -* [GH-139] - properly handle exceptions thrown in pub/sub event handlers (Felix Geisendörfer) -* [GH-141] - detect closing state on stream error (Felix Geisendörfer) -* [GH-142] - re-select database on reconnection (Jean-Hugues Pinson) -* [GH-146] - add sort example (Maksim Lin) - -Some more goodies: - -* Fix bugs with node 0.6 -* Performance improvements -* New version of `multi_bench.js` that tests more realistic scenarios -* [GH-140] - support optional callback for subscribe commands -* Properly flush and error out command queue when connection fails -* Initial work on reconnection thresholds - -## v0.6.7 - July 30, 2011 - -(accidentally skipped v0.6.6) - -Fix and test for [GH-123] - -Passing an Array as as the last argument should expand as users -expect. The old behavior was to coerce the arguments into Strings, -which did surprising things with Arrays. - -## v0.6.5 - July 6, 2011 - -Contributed changes: - -* Support SlowBuffers (Umair Siddique) -* Add Multi to exports (Louis-Philippe Perron) -* Fix for drain event calculation (Vladimir Dronnikov) - -Thanks! - -## v0.6.4 - June 30, 2011 - -Fix bug with optional callbacks for hmset. - -## v0.6.2 - June 30, 2011 - -Bugs fixed: - -* authentication retry while server is loading db (danmaz74) [GH-101] -* command arguments processing issue with arrays - -New features: - -* Auto update of new commands from redis.io (Dave Hoover) -* Performance improvements and backpressure controls. -* Commands now return the true/false value from the underlying socket write(s). -* Implement command_queue high water and low water for more better control of queueing. - -See `examples/backpressure_drain.js` for more information. - -## v0.6.1 - June 29, 2011 - -Add support and tests for Redis scripting through EXEC command. - -Bug fix for monitor mode. (forddg) - -Auto update of new commands from redis.io (Dave Hoover) - -## v0.6.0 - April 21, 2011 - -Lots of bugs fixed. - -* connection error did not properly trigger reconnection logic [GH-85] -* client.hmget(key, [val1, val2]) was not expanding properly [GH-66] -* client.quit() while in pub/sub mode would throw an error [GH-87] -* client.multi(['hmset', 'key', {foo: 'bar'}]) fails [GH-92] -* unsubscribe before subscribe would make things very confused [GH-88] -* Add BRPOPLPUSH [GH-79] - -## v0.5.11 - April 7, 2011 - -Added DISCARD - -I originally didn't think DISCARD would do anything here because of the clever MULTI interface, but somebody -pointed out to me that DISCARD can be used to flush the WATCH set. - -## v0.5.10 - April 6, 2011 - -Added HVALS - -## v0.5.9 - March 14, 2011 - -Fix bug with empty Array arguments - Andy Ray - -## v0.5.8 - March 14, 2011 - -Add `MONITOR` command and special monitor command reply parsing. - -## v0.5.7 - February 27, 2011 - -Add magical auth command. - -Authentication is now remembered by the client and will be automatically sent to the server -on every connection, including any reconnections. - -## v0.5.6 - February 22, 2011 - -Fix bug in ready check with `return_buffers` set to `true`. - -Thanks to Dean Mao and Austin Chau. - -## v0.5.5 - February 16, 2011 - -Add probe for server readiness. - -When a Redis server starts up, it might take a while to load the dataset into memory. -During this time, the server will accept connections, but will return errors for all non-INFO -commands. Now node_redis will send an INFO command whenever it connects to a server. -If the info command indicates that the server is not ready, the client will keep trying until -the server is ready. Once it is ready, the client will emit a "ready" event as well as the -"connect" event. The client will queue up all commands sent before the server is ready, just -like it did before. When the server is ready, all offline/non-ready commands will be replayed. -This should be backward compatible with previous versions. - -To disable this ready check behavior, set `options.no_ready_check` when creating the client. - -As a side effect of this change, the key/val params from the info command are available as -`client.server_options`. Further, the version string is decomposed into individual elements -in `client.server_options.versions`. - -## v0.5.4 - February 11, 2011 - -Fix excess memory consumption from Queue backing store. - -Thanks to Gustaf Sjöberg. - -## v0.5.3 - February 5, 2011 - -Fix multi/exec error reply callback logic. - -Thanks to Stella Laurenzo. - -## v0.5.2 - January 18, 2011 - -Fix bug where unhandled error replies confuse the parser. - -## v0.5.1 - January 18, 2011 - -Fix bug where subscribe commands would not handle redis-server startup error properly. - -## v0.5.0 - December 29, 2010 - -Some bug fixes: - -* An important bug fix in reconnection logic. Previously, reply callbacks would be invoked twice after - a reconnect. -* Changed error callback argument to be an actual Error object. - -New feature: - -* Add friendly syntax for HMSET using an object. - -## v0.4.1 - December 8, 2010 - -Remove warning about missing hiredis. You probably do want it though. - -## v0.4.0 - December 5, 2010 - -Support for multiple response parsers and hiredis C library from Pieter Noordhuis. -Return Strings instead of Buffers by default. -Empty nested mb reply bug fix. - -## v0.3.9 - November 30, 2010 - -Fix parser bug on failed EXECs. - -## v0.3.8 - November 10, 2010 - -Fix for null MULTI response when WATCH condition fails. - -## v0.3.7 - November 9, 2010 - -Add "drain" and "idle" events. - -## v0.3.6 - November 3, 2010 - -Add all known Redis commands from Redis master, even ones that are coming in 2.2 and beyond. - -Send a friendlier "error" event message on stream errors like connection refused / reset. - -## v0.3.5 - October 21, 2010 - -A few bug fixes. - -* Fixed bug with `nil` multi-bulk reply lengths that showed up with `BLPOP` timeouts. -* Only emit `end` once when connection goes away. -* Fixed bug in `test.js` where driver finished before all tests completed. - -## unversioned wasteland - -See the git history for what happened before. diff --git a/node_modules/redis/diff_multi_bench_output.js b/node_modules/redis/diff_multi_bench_output.js deleted file mode 100644 index 7396472019..0000000000 --- a/node_modules/redis/diff_multi_bench_output.js +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -var colors = require('colors'), - fs = require('fs'), - _ = require('underscore'), - metrics = require('metrics'), - - // `node diff_multi_bench_output.js before.txt after.txt` - before = process.argv[2], - after = process.argv[3]; - -if (!before || !after) { - console.log('Please supply two file arguments:'); - var n = __filename; - n = n.substring(n.lastIndexOf('/', n.length)); - console.log(' ./' + n + ' multiBenchBefore.txt multiBenchAfter.txt'); - console.log('To generate multiBenchBefore.txt, run'); - console.log(' node multi_bench.js > multiBenchBefore.txt'); - console.log('Thank you for benchmarking responsibly.'); - return; -} - -var before_lines = fs.readFileSync(before, 'utf8').split('\n'), - after_lines = fs.readFileSync(after, 'utf8').split('\n'); - -console.log('Comparing before,', before.green, '(', before_lines.length, - 'lines)', 'to after,', after.green, '(', after_lines.length, 'lines)'); - -var total_ops = new metrics.Histogram.createUniformHistogram(); - -before_lines.forEach(function(b, i) { - var a = after_lines[i]; - if (!a || !b || !b.trim() || !a.trim()) { - // console.log('#ignored#', '>'+a+'<', '>'+b+'<'); - return; - } - - b_words = b.split(' ').filter(is_whitespace); - a_words = a.split(' ').filter(is_whitespace); - - var ops = - [b_words, a_words] - .map(function(words) { - // console.log(words); - return parseInt10(words.slice(-2, -1)); - }).filter(function(num) { - var isNaN = !num && num !== 0; - return !isNaN; - }); - if (ops.length != 2) return - - var delta = ops[1] - ops[0]; - var pct = ((delta / ops[0]) * 100).toPrecision(3); - - total_ops.update(delta); - - delta = humanize_diff(delta); - pct = humanize_diff(pct, '%'); - console.log( - // name of test - command_name(a_words) == command_name(b_words) - ? command_name(a_words) + ':' - : '404:', - // results of test - ops.join(' -> '), 'ops/sec (∆', delta, pct, ')'); -}); - -console.log('Mean difference in ops/sec:', humanize_diff(total_ops.mean().toPrecision(6))); - -function is_whitespace(s) { - return !!s.trim(); -} - -function parseInt10(s) { - return parseInt(s, 10); -} - -// green if greater than 0, red otherwise -function humanize_diff(num, unit) { - unit = unit || ""; - if (num > 0) { - return ('+' + num + unit).green; - } - return ('' + num + unit).red; -} - -function command_name(words) { - var line = words.join(' '); - return line.substr(0, line.indexOf(',')); -} diff --git a/node_modules/redis/examples/auth.js b/node_modules/redis/examples/auth.js deleted file mode 100644 index 6c0a563cd8..0000000000 --- a/node_modules/redis/examples/auth.js +++ /dev/null @@ -1,5 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -// This command is magical. Client stashes the password and will issue on every connect. -client.auth("somepass"); diff --git a/node_modules/redis/examples/backpressure_drain.js b/node_modules/redis/examples/backpressure_drain.js deleted file mode 100644 index 3488ef4d3f..0000000000 --- a/node_modules/redis/examples/backpressure_drain.js +++ /dev/null @@ -1,33 +0,0 @@ -var redis = require("../index"), - client = redis.createClient(null, null, { - command_queue_high_water: 5, - command_queue_low_water: 1 - }), - remaining_ops = 100000, paused = false; - -function op() { - if (remaining_ops <= 0) { - console.error("Finished."); - process.exit(0); - } - - remaining_ops--; - if (client.hset("test hash", "val " + remaining_ops, remaining_ops) === false) { - console.log("Pausing at " + remaining_ops); - paused = true; - } else { - process.nextTick(op); - } -} - -client.on("drain", function () { - if (paused) { - console.log("Resuming at " + remaining_ops); - paused = false; - process.nextTick(op); - } else { - console.log("Got drain while not paused at " + remaining_ops); - } -}); - -op(); diff --git a/node_modules/redis/examples/eval.js b/node_modules/redis/examples/eval.js deleted file mode 100644 index a3ff6b0793..0000000000 --- a/node_modules/redis/examples/eval.js +++ /dev/null @@ -1,14 +0,0 @@ -var redis = require("../index"), - client = redis.createClient(); - -redis.debug_mode = true; - -client.eval("return 100.5", 0, function (err, res) { - console.dir(err); - console.dir(res); -}); - -client.eval([ "return 100.5", 0 ], function (err, res) { - console.dir(err); - console.dir(res); -}); diff --git a/node_modules/redis/examples/extend.js b/node_modules/redis/examples/extend.js deleted file mode 100644 index 488b8c2dc5..0000000000 --- a/node_modules/redis/examples/extend.js +++ /dev/null @@ -1,24 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -// Extend the RedisClient prototype to add a custom method -// This one converts the results from "INFO" into a JavaScript Object - -redis.RedisClient.prototype.parse_info = function (callback) { - this.info(function (err, res) { - var lines = res.toString().split("\r\n").sort(); - var obj = {}; - lines.forEach(function (line) { - var parts = line.split(':'); - if (parts[1]) { - obj[parts[0]] = parts[1]; - } - }); - callback(obj) - }); -}; - -client.parse_info(function (info) { - console.dir(info); - client.quit(); -}); diff --git a/node_modules/redis/examples/file.js b/node_modules/redis/examples/file.js deleted file mode 100644 index 4d2b5d1c98..0000000000 --- a/node_modules/redis/examples/file.js +++ /dev/null @@ -1,32 +0,0 @@ -// Read a file from disk, store it in Redis, then read it back from Redis. - -var redis = require("redis"), - client = redis.createClient(), - fs = require("fs"), - filename = "kids_in_cart.jpg"; - -// Get the file I use for testing like this: -// curl http://ranney.com/kids_in_cart.jpg -o kids_in_cart.jpg -// or just use your own file. - -// Read a file from fs, store it in Redis, get it back from Redis, write it back to fs. -fs.readFile(filename, function (err, data) { - if (err) throw err - console.log("Read " + data.length + " bytes from filesystem."); - - client.set(filename, data, redis.print); // set entire file - client.get(filename, function (err, reply) { // get entire file - if (err) { - console.log("Get error: " + err); - } else { - fs.writeFile("duplicate_" + filename, reply, function (err) { - if (err) { - console.log("Error on write: " + err) - } else { - console.log("File written."); - } - client.end(); - }); - } - }); -}); diff --git a/node_modules/redis/examples/mget.js b/node_modules/redis/examples/mget.js deleted file mode 100644 index 936740d32f..0000000000 --- a/node_modules/redis/examples/mget.js +++ /dev/null @@ -1,5 +0,0 @@ -var client = require("redis").createClient(); - -client.mget(["sessions started", "sessions started", "foo"], function (err, res) { - console.dir(res); -}); \ No newline at end of file diff --git a/node_modules/redis/examples/monitor.js b/node_modules/redis/examples/monitor.js deleted file mode 100644 index 2cb6a4e1ec..0000000000 --- a/node_modules/redis/examples/monitor.js +++ /dev/null @@ -1,10 +0,0 @@ -var client = require("../index").createClient(), - util = require("util"); - -client.monitor(function (err, res) { - console.log("Entering monitoring mode."); -}); - -client.on("monitor", function (time, args) { - console.log(time + ": " + util.inspect(args)); -}); diff --git a/node_modules/redis/examples/multi.js b/node_modules/redis/examples/multi.js deleted file mode 100644 index 35c08e1840..0000000000 --- a/node_modules/redis/examples/multi.js +++ /dev/null @@ -1,46 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(), set_size = 20; - -client.sadd("bigset", "a member"); -client.sadd("bigset", "another member"); - -while (set_size > 0) { - client.sadd("bigset", "member " + set_size); - set_size -= 1; -} - -// multi chain with an individual callback -client.multi() - .scard("bigset") - .smembers("bigset") - .keys("*", function (err, replies) { - client.mget(replies, redis.print); - }) - .dbsize() - .exec(function (err, replies) { - console.log("MULTI got " + replies.length + " replies"); - replies.forEach(function (reply, index) { - console.log("Reply " + index + ": " + reply.toString()); - }); - }); - -client.mset("incr thing", 100, "incr other thing", 1, redis.print); - -// start a separate multi command queue -var multi = client.multi(); -multi.incr("incr thing", redis.print); -multi.incr("incr other thing", redis.print); - -// runs immediately -client.get("incr thing", redis.print); // 100 - -// drains multi queue and runs atomically -multi.exec(function (err, replies) { - console.log(replies); // 101, 2 -}); - -// you can re-run the same transaction if you like -multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); -}); diff --git a/node_modules/redis/examples/multi2.js b/node_modules/redis/examples/multi2.js deleted file mode 100644 index 8be4d7313c..0000000000 --- a/node_modules/redis/examples/multi2.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(), multi; - -// start a separate command queue for multi -multi = client.multi(); -multi.incr("incr thing", redis.print); -multi.incr("incr other thing", redis.print); - -// runs immediately -client.mset("incr thing", 100, "incr other thing", 1, redis.print); - -// drains multi queue and runs atomically -multi.exec(function (err, replies) { - console.log(replies); // 101, 2 -}); - -// you can re-run the same transaction if you like -multi.exec(function (err, replies) { - console.log(replies); // 102, 3 - client.quit(); -}); - -client.multi([ - ["mget", "multifoo", "multibar", redis.print], - ["incr", "multifoo"], - ["incr", "multibar"] -]).exec(function (err, replies) { - console.log(replies.toString()); -}); diff --git a/node_modules/redis/examples/psubscribe.js b/node_modules/redis/examples/psubscribe.js deleted file mode 100644 index c57117b8a6..0000000000 --- a/node_modules/redis/examples/psubscribe.js +++ /dev/null @@ -1,33 +0,0 @@ -var redis = require("redis"), - client1 = redis.createClient(), - client2 = redis.createClient(), - client3 = redis.createClient(), - client4 = redis.createClient(), - msg_count = 0; - -redis.debug_mode = false; - -client1.on("psubscribe", function (pattern, count) { - console.log("client1 psubscribed to " + pattern + ", " + count + " total subscriptions"); - client2.publish("channeltwo", "Me!"); - client3.publish("channelthree", "Me too!"); - client4.publish("channelfour", "And me too!"); -}); - -client1.on("punsubscribe", function (pattern, count) { - console.log("client1 punsubscribed from " + pattern + ", " + count + " total subscriptions"); - client4.end(); - client3.end(); - client2.end(); - client1.end(); -}); - -client1.on("pmessage", function (pattern, channel, message) { - console.log("("+ pattern +")" + " client1 received message on " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.punsubscribe(); - } -}); - -client1.psubscribe("channel*"); diff --git a/node_modules/redis/examples/pub_sub.js b/node_modules/redis/examples/pub_sub.js deleted file mode 100644 index aa508d6c9d..0000000000 --- a/node_modules/redis/examples/pub_sub.js +++ /dev/null @@ -1,41 +0,0 @@ -var redis = require("redis"), - client1 = redis.createClient(), msg_count = 0, - client2 = redis.createClient(); - -redis.debug_mode = false; - -// Most clients probably don't do much on "subscribe". This example uses it to coordinate things within one program. -client1.on("subscribe", function (channel, count) { - console.log("client1 subscribed to " + channel + ", " + count + " total subscriptions"); - if (count === 2) { - client2.publish("a nice channel", "I am sending a message."); - client2.publish("another one", "I am sending a second message."); - client2.publish("a nice channel", "I am sending my last message."); - } -}); - -client1.on("unsubscribe", function (channel, count) { - console.log("client1 unsubscribed from " + channel + ", " + count + " total subscriptions"); - if (count === 0) { - client2.end(); - client1.end(); - } -}); - -client1.on("message", function (channel, message) { - console.log("client1 channel " + channel + ": " + message); - msg_count += 1; - if (msg_count === 3) { - client1.unsubscribe(); - } -}); - -client1.on("ready", function () { - // if you need auth, do it here - client1.incr("did a thing"); - client1.subscribe("a nice channel", "another one"); -}); - -client2.on("ready", function () { - // if you need auth, do it here -}); diff --git a/node_modules/redis/examples/simple.js b/node_modules/redis/examples/simple.js deleted file mode 100644 index f1f2e3209b..0000000000 --- a/node_modules/redis/examples/simple.js +++ /dev/null @@ -1,24 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -client.on("error", function (err) { - console.log("error event - " + client.host + ":" + client.port + " - " + err); -}); - -client.set("string key", "string val", redis.print); -client.hset("hash key", "hashtest 1", "some value", redis.print); -client.hset(["hash key", "hashtest 2", "some other value"], redis.print); -client.hkeys("hash key", function (err, replies) { - if (err) { - return console.error("error response - " + err); - } - - console.log(replies.length + " replies:"); - replies.forEach(function (reply, i) { - console.log(" " + i + ": " + reply); - }); -}); - -client.quit(function (err, res) { - console.log("Exiting from quit command."); -}); diff --git a/node_modules/redis/examples/sort.js b/node_modules/redis/examples/sort.js deleted file mode 100644 index e7c6249e40..0000000000 --- a/node_modules/redis/examples/sort.js +++ /dev/null @@ -1,17 +0,0 @@ -var redis = require("redis"), - client = redis.createClient(); - -client.sadd("mylist", 1); -client.sadd("mylist", 2); -client.sadd("mylist", 3); - -client.set("weight_1", 5); -client.set("weight_2", 500); -client.set("weight_3", 1); - -client.set("object_1", "foo"); -client.set("object_2", "bar"); -client.set("object_3", "qux"); - -client.sort("mylist", "by", "weight_*", "get", "object_*", redis.print); -// Prints Reply: qux,foo,bar \ No newline at end of file diff --git a/node_modules/redis/examples/subqueries.js b/node_modules/redis/examples/subqueries.js deleted file mode 100644 index 560db2404e..0000000000 --- a/node_modules/redis/examples/subqueries.js +++ /dev/null @@ -1,15 +0,0 @@ -// Sending commands in response to other commands. -// This example runs "type" against every key in the database -// -var client = require("redis").createClient(); - -client.keys("*", function (err, keys) { - keys.forEach(function (key, pos) { - client.type(key, function (err, keytype) { - console.log(key + " is " + keytype); - if (pos === (keys.length - 1)) { - client.quit(); - } - }); - }); -}); diff --git a/node_modules/redis/examples/subquery.js b/node_modules/redis/examples/subquery.js deleted file mode 100644 index 861657e1f3..0000000000 --- a/node_modules/redis/examples/subquery.js +++ /dev/null @@ -1,19 +0,0 @@ -var client = require("redis").createClient(); - -function print_results(obj) { - console.dir(obj); -} - -// build a map of all keys and their types -client.keys("*", function (err, all_keys) { - var key_types = {}; - - all_keys.forEach(function (key, pos) { // use second arg of forEach to get pos - client.type(key, function (err, type) { - key_types[key] = type; - if (pos === all_keys.length - 1) { // callbacks all run in order - print_results(key_types); - } - }); - }); -}); diff --git a/node_modules/redis/examples/unix_socket.js b/node_modules/redis/examples/unix_socket.js deleted file mode 100644 index 4a5e0bb0e8..0000000000 --- a/node_modules/redis/examples/unix_socket.js +++ /dev/null @@ -1,29 +0,0 @@ -var redis = require("redis"), - client = redis.createClient("/tmp/redis.sock"), - profiler = require("v8-profiler"); - -client.on("connect", function () { - console.log("Got Unix socket connection.") -}); - -client.on("error", function (err) { - console.log(err.message); -}); - -client.set("space chars", "space value"); - -setInterval(function () { - client.get("space chars"); -}, 100); - -function done() { - client.info(function (err, reply) { - console.log(reply.toString()); - client.quit(); - }); -} - -setTimeout(function () { - console.log("Taking snapshot."); - var snap = profiler.takeSnapshot(); -}, 5000); diff --git a/node_modules/redis/examples/web_server.js b/node_modules/redis/examples/web_server.js deleted file mode 100644 index 9fd85923de..0000000000 --- a/node_modules/redis/examples/web_server.js +++ /dev/null @@ -1,31 +0,0 @@ -// A simple web server that generates dyanmic content based on responses from Redis - -var http = require("http"), server, - redis_client = require("redis").createClient(); - -server = http.createServer(function (request, response) { - response.writeHead(200, { - "Content-Type": "text/plain" - }); - - var redis_info, total_requests; - - redis_client.info(function (err, reply) { - redis_info = reply; // stash response in outer scope - }); - redis_client.incr("requests", function (err, reply) { - total_requests = reply; // stash response in outer scope - }); - redis_client.hincrby("ip", request.connection.remoteAddress, 1); - redis_client.hgetall("ip", function (err, reply) { - // This is the last reply, so all of the previous replies must have completed already - response.write("This page was generated after talking to redis.\n\n" + - "Redis info:\n" + redis_info + "\n" + - "Total requests: " + total_requests + "\n\n" + - "IP count: \n"); - Object.keys(reply).forEach(function (ip) { - response.write(" " + ip + ": " + reply[ip] + "\n"); - }); - response.end(); - }); -}).listen(80); diff --git a/node_modules/redis/generate_commands.js b/node_modules/redis/generate_commands.js deleted file mode 100644 index e6949d3a14..0000000000 --- a/node_modules/redis/generate_commands.js +++ /dev/null @@ -1,39 +0,0 @@ -var http = require("http"), - fs = require("fs"); - -function prettyCurrentTime() { - var date = new Date(); - return date.toLocaleString(); -} - -function write_file(commands, path) { - var file_contents, out_commands; - - console.log("Writing " + Object.keys(commands).length + " commands to " + path); - - file_contents = "// This file was generated by ./generate_commands.js on " + prettyCurrentTime() + "\n"; - - out_commands = Object.keys(commands).map(function (key) { - return key.toLowerCase(); - }); - - file_contents += "module.exports = " + JSON.stringify(out_commands, null, " ") + ";\n"; - - fs.writeFile(path, file_contents); -} - -http.get({host: "redis.io", path: "/commands.json"}, function (res) { - var body = ""; - - console.log("Response from redis.io/commands.json: " + res.statusCode); - - res.on('data', function (chunk) { - body += chunk; - }); - - res.on('end', function () { - write_file(JSON.parse(body), "lib/commands.js"); - }); -}).on('error', function (e) { - console.log("Error fetching command list from redis.io: " + e.message); -}); diff --git a/node_modules/redis/index.js b/node_modules/redis/index.js deleted file mode 100644 index 283c743fb1..0000000000 --- a/node_modules/redis/index.js +++ /dev/null @@ -1,1144 +0,0 @@ -/*global Buffer require exports console setTimeout */ - -var net = require("net"), - util = require("./lib/util"), - Queue = require("./lib/queue"), - to_array = require("./lib/to_array"), - events = require("events"), - crypto = require("crypto"), - parsers = [], commands, - connection_id = 0, - default_port = 6379, - default_host = "127.0.0.1"; - -// can set this to true to enable for all connections -exports.debug_mode = false; - -// hiredis might not be installed -try { - require("./lib/parser/hiredis"); - parsers.push(require("./lib/parser/hiredis")); -} catch (err) { - if (exports.debug_mode) { - console.warn("hiredis parser not installed."); - } -} - -parsers.push(require("./lib/parser/javascript")); - -function RedisClient(stream, options) { - this.stream = stream; - this.options = options = options || {}; - - this.connection_id = ++connection_id; - this.connected = false; - this.ready = false; - this.connections = 0; - if (this.options.socket_nodelay === undefined) { - this.options.socket_nodelay = true; - } - this.should_buffer = false; - this.command_queue_high_water = this.options.command_queue_high_water || 1000; - this.command_queue_low_water = this.options.command_queue_low_water || 0; - this.max_attempts = null; - if (options.max_attempts && !isNaN(options.max_attempts) && options.max_attempts > 0) { - this.max_attempts = +options.max_attempts; - } - this.command_queue = new Queue(); // holds sent commands to de-pipeline them - this.offline_queue = new Queue(); // holds commands issued but not able to be sent - this.commands_sent = 0; - this.connect_timeout = false; - if (options.connect_timeout && !isNaN(options.connect_timeout) && options.connect_timeout > 0) { - this.connect_timeout = +options.connect_timeout; - } - this.enable_offline_queue = true; - if (typeof this.options.enable_offline_queue === "boolean") { - this.enable_offline_queue = this.options.enable_offline_queue; - } - this.retry_max_delay = null; - if (options.retry_max_delay !== undefined && !isNaN(options.retry_max_delay) && options.retry_max_delay > 0) { - this.retry_max_delay = options.retry_max_delay; - } - - this.initialize_retry_vars(); - this.pub_sub_mode = false; - this.subscription_set = {}; - this.monitoring = false; - this.closing = false; - this.server_info = {}; - this.auth_pass = null; - this.parser_module = null; - this.selected_db = null; // save the selected db here, used when reconnecting - - this.old_state = null; - - var self = this; - - this.stream.on("connect", function () { - self.on_connect(); - }); - - this.stream.on("data", function (buffer_from_socket) { - self.on_data(buffer_from_socket); - }); - - this.stream.on("error", function (msg) { - self.on_error(msg.message); - }); - - this.stream.on("close", function () { - self.connection_gone("close"); - }); - - this.stream.on("end", function () { - self.connection_gone("end"); - }); - - this.stream.on("drain", function () { - self.should_buffer = false; - self.emit("drain"); - }); - - events.EventEmitter.call(this); -} -util.inherits(RedisClient, events.EventEmitter); -exports.RedisClient = RedisClient; - -RedisClient.prototype.initialize_retry_vars = function () { - this.retry_timer = null; - this.retry_totaltime = 0; - this.retry_delay = 150; - this.retry_backoff = 1.7; - this.attempts = 1; -}; - -// flush offline_queue and command_queue, erroring any items with a callback first -RedisClient.prototype.flush_and_error = function (message) { - var command_obj; - while (this.offline_queue.length > 0) { - command_obj = this.offline_queue.shift(); - if (typeof command_obj.callback === "function") { - command_obj.callback(message); - } - } - this.offline_queue = new Queue(); - - while (this.command_queue.length > 0) { - command_obj = this.command_queue.shift(); - if (typeof command_obj.callback === "function") { - command_obj.callback(message); - } - } - this.command_queue = new Queue(); -}; - -RedisClient.prototype.on_error = function (msg) { - var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg; - - if (this.closing) { - return; - } - - if (exports.debug_mode) { - console.warn(message); - } - - this.flush_and_error(message); - - this.connected = false; - this.ready = false; - - this.emit("error", new Error(message)); - // "error" events get turned into exceptions if they aren't listened for. If the user handled this error - // then we should try to reconnect. - this.connection_gone("error"); -}; - -RedisClient.prototype.do_auth = function () { - var self = this; - - if (exports.debug_mode) { - console.log("Sending auth to " + self.host + ":" + self.port + " id " + self.connection_id); - } - self.send_anyway = true; - self.send_command("auth", [this.auth_pass], function (err, res) { - if (err) { - if (err.toString().match("LOADING")) { - // if redis is still loading the db, it will not authenticate and everything else will fail - console.log("Redis still loading, trying to authenticate later"); - setTimeout(function () { - self.do_auth(); - }, 2000); // TODO - magic number alert - return; - } else { - return self.emit("error", new Error("Auth error: " + err.message)); - } - } - if (res.toString() !== "OK") { - return self.emit("error", new Error("Auth failed: " + res.toString())); - } - if (exports.debug_mode) { - console.log("Auth succeeded " + self.host + ":" + self.port + " id " + self.connection_id); - } - if (self.auth_callback) { - self.auth_callback(err, res); - self.auth_callback = null; - } - - // now we are really connected - self.emit("connect"); - if (self.options.no_ready_check) { - self.on_ready(); - } else { - self.ready_check(); - } - }); - self.send_anyway = false; -}; - -RedisClient.prototype.on_connect = function () { - if (exports.debug_mode) { - console.log("Stream connected " + this.host + ":" + this.port + " id " + this.connection_id); - } - - this.connected = true; - this.ready = false; - this.attempts = 0; - this.connections += 1; - this.command_queue = new Queue(); - this.emitted_end = false; - this.initialize_retry_vars(); - if (this.options.socket_nodelay) { - this.stream.setNoDelay(); - } - this.stream.setTimeout(0); - - this.init_parser(); - - if (this.auth_pass) { - this.do_auth(); - } else { - this.emit("connect"); - - if (this.options.no_ready_check) { - this.on_ready(); - } else { - this.ready_check(); - } - } -}; - -RedisClient.prototype.init_parser = function () { - var self = this; - - if (this.options.parser) { - if (! parsers.some(function (parser) { - if (parser.name === self.options.parser) { - self.parser_module = parser; - if (exports.debug_mode) { - console.log("Using parser module: " + self.parser_module.name); - } - return true; - } - })) { - throw new Error("Couldn't find named parser " + self.options.parser + " on this system"); - } - } else { - if (exports.debug_mode) { - console.log("Using default parser module: " + parsers[0].name); - } - this.parser_module = parsers[0]; - } - - this.parser_module.debug_mode = exports.debug_mode; - - // return_buffers sends back Buffers from parser to callback. detect_buffers sends back Buffers from parser, but - // converts to Strings if the input arguments are not Buffers. - this.reply_parser = new this.parser_module.Parser({ - return_buffers: self.options.return_buffers || self.options.detect_buffers || false - }); - - // "reply error" is an error sent back by Redis - this.reply_parser.on("reply error", function (reply) { - self.return_error(new Error(reply)); - }); - this.reply_parser.on("reply", function (reply) { - self.return_reply(reply); - }); - // "error" is bad. Somehow the parser got confused. It'll try to reset and continue. - this.reply_parser.on("error", function (err) { - self.emit("error", new Error("Redis reply parser error: " + err.stack)); - }); -}; - -RedisClient.prototype.on_ready = function () { - var self = this; - - this.ready = true; - - if (this.old_state !== null) { - this.monitoring = this.old_state.monitoring; - this.pub_sub_mode = this.old_state.pub_sub_mode; - this.selected_db = this.old_state.selected_db; - this.old_state = null; - } - - // magically restore any modal commands from a previous connection - if (this.selected_db !== null) { - // this trick works if and only if the following send_command - // never goes into the offline queue - var pub_sub_mode = this.pub_sub_mode; - this.pub_sub_mode = false; - this.send_command('select', [this.selected_db]); - this.pub_sub_mode = pub_sub_mode; - } - if (this.pub_sub_mode === true) { - // only emit "ready" when all subscriptions were made again - var callback_count = 0; - var callback = function () { - callback_count--; - if (callback_count === 0) { - self.emit("ready"); - } - }; - Object.keys(this.subscription_set).forEach(function (key) { - var parts = key.split(" "); - if (exports.debug_mode) { - console.warn("sending pub/sub on_ready " + parts[0] + ", " + parts[1]); - } - callback_count++; - self.send_command(parts[0] + "scribe", [parts[1]], callback); - }); - return; - } else if (this.monitoring) { - this.send_command("monitor"); - } else { - this.send_offline_queue(); - } - this.emit("ready"); -}; - -RedisClient.prototype.on_info_cmd = function (err, res) { - var self = this, obj = {}, lines, retry_time; - - if (err) { - return self.emit("error", new Error("Ready check failed: " + err.message)); - } - - lines = res.toString().split("\r\n"); - - lines.forEach(function (line) { - var parts = line.split(':'); - if (parts[1]) { - obj[parts[0]] = parts[1]; - } - }); - - obj.versions = []; - obj.redis_version.split('.').forEach(function (num) { - obj.versions.push(+num); - }); - - // expose info key/vals to users - this.server_info = obj; - - if (!obj.loading || (obj.loading && obj.loading === "0")) { - if (exports.debug_mode) { - console.log("Redis server ready."); - } - this.on_ready(); - } else { - retry_time = obj.loading_eta_seconds * 1000; - if (retry_time > 1000) { - retry_time = 1000; - } - if (exports.debug_mode) { - console.log("Redis server still loading, trying again in " + retry_time); - } - setTimeout(function () { - self.ready_check(); - }, retry_time); - } -}; - -RedisClient.prototype.ready_check = function () { - var self = this; - - if (exports.debug_mode) { - console.log("checking server ready state..."); - } - - this.send_anyway = true; // secret flag to send_command to send something even if not "ready" - this.info(function (err, res) { - self.on_info_cmd(err, res); - }); - this.send_anyway = false; -}; - -RedisClient.prototype.send_offline_queue = function () { - var command_obj, buffered_writes = 0; - - while (this.offline_queue.length > 0) { - command_obj = this.offline_queue.shift(); - if (exports.debug_mode) { - console.log("Sending offline command: " + command_obj.command); - } - buffered_writes += !this.send_command(command_obj.command, command_obj.args, command_obj.callback); - } - this.offline_queue = new Queue(); - // Even though items were shifted off, Queue backing store still uses memory until next add, so just get a new Queue - - if (!buffered_writes) { - this.should_buffer = false; - this.emit("drain"); - } -}; - -RedisClient.prototype.connection_gone = function (why) { - var self = this; - - // If a retry is already in progress, just let that happen - if (this.retry_timer) { - return; - } - - if (exports.debug_mode) { - console.warn("Redis connection is gone from " + why + " event."); - } - this.connected = false; - this.ready = false; - - if (this.old_state === null) { - var state = { - monitoring: this.monitoring, - pub_sub_mode: this.pub_sub_mode, - selected_db: this.selected_db - }; - this.old_state = state; - this.monitoring = false; - this.pub_sub_mode = false; - this.selected_db = null; - } - - // since we are collapsing end and close, users don't expect to be called twice - if (! this.emitted_end) { - this.emit("end"); - this.emitted_end = true; - } - - this.flush_and_error("Redis connection gone from " + why + " event."); - - // If this is a requested shutdown, then don't retry - if (this.closing) { - this.retry_timer = null; - if (exports.debug_mode) { - console.warn("connection ended from quit command, not retrying."); - } - return; - } - - if (this.retry_max_delay !== null && this.retry_delay > this.retry_max_delay) { - this.retry_delay = this.retry_max_delay; - } else { - this.retry_delay = Math.floor(this.retry_delay * this.retry_backoff); - } - - if (exports.debug_mode) { - console.log("Retry connection in " + this.retry_delay + " ms"); - } - - if (this.max_attempts && this.attempts >= this.max_attempts) { - this.retry_timer = null; - // TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others - // want the program to exit. Right now, we just log, which doesn't really help in either case. - console.error("node_redis: Couldn't get Redis connection after " + this.max_attempts + " attempts."); - return; - } - - this.attempts += 1; - this.emit("reconnecting", { - delay: self.retry_delay, - attempt: self.attempts - }); - this.retry_timer = setTimeout(function () { - if (exports.debug_mode) { - console.log("Retrying connection..."); - } - - self.retry_totaltime += self.retry_delay; - - if (self.connect_timeout && self.retry_totaltime >= self.connect_timeout) { - self.retry_timer = null; - // TODO - engage Redis is Broken mode for future commands, or whatever - console.error("node_redis: Couldn't get Redis connection after " + self.retry_totaltime + "ms."); - return; - } - - self.stream.connect(self.port, self.host); - self.retry_timer = null; - }, this.retry_delay); -}; - -RedisClient.prototype.on_data = function (data) { - if (exports.debug_mode) { - console.log("net read " + this.host + ":" + this.port + " id " + this.connection_id + ": " + data.toString()); - } - - try { - this.reply_parser.execute(data); - } catch (err) { - // This is an unexpected parser problem, an exception that came from the parser code itself. - // Parser should emit "error" events if it notices things are out of whack. - // Callbacks that throw exceptions will land in return_reply(), below. - // TODO - it might be nice to have a different "error" event for different types of errors - this.emit("error", err); - } -}; - -RedisClient.prototype.return_error = function (err) { - var command_obj = this.command_queue.shift(), queue_len = this.command_queue.getLength(); - - if (this.pub_sub_mode === false && queue_len === 0) { - this.command_queue = new Queue(); - this.emit("idle"); - } - if (this.should_buffer && queue_len <= this.command_queue_low_water) { - this.emit("drain"); - this.should_buffer = false; - } - - if (command_obj && typeof command_obj.callback === "function") { - try { - command_obj.callback(err); - } catch (callback_err) { - // if a callback throws an exception, re-throw it on a new stack so the parser can keep going - process.nextTick(function () { - throw callback_err; - }); - } - } else { - console.log("node_redis: no callback to send error: " + err.message); - // this will probably not make it anywhere useful, but we might as well throw - process.nextTick(function () { - throw err; - }); - } -}; - -// if a callback throws an exception, re-throw it on a new stack so the parser can keep going. -// put this try/catch in its own function because V8 doesn't optimize this well yet. -function try_callback(callback, reply) { - try { - callback(null, reply); - } catch (err) { - process.nextTick(function () { - throw err; - }); - } -} - -// hgetall converts its replies to an Object. If the reply is empty, null is returned. -function reply_to_object(reply) { - var obj = {}, j, jl, key, val; - - if (reply.length === 0) { - return null; - } - - for (j = 0, jl = reply.length; j < jl; j += 2) { - key = reply[j].toString(); - val = reply[j + 1]; - obj[key] = val; - } - - return obj; -} - -function reply_to_strings(reply) { - var i; - - if (Buffer.isBuffer(reply)) { - return reply.toString(); - } - - if (Array.isArray(reply)) { - for (i = 0; i < reply.length; i++) { - if (reply[i] !== null && reply[i] !== undefined) { - reply[i] = reply[i].toString(); - } - } - return reply; - } - - return reply; -} - -RedisClient.prototype.return_reply = function (reply) { - var command_obj, len, type, timestamp, argindex, args, queue_len; - - // If the "reply" here is actually a message received asynchronously due to a - // pubsub subscription, don't pop the command queue as we'll only be consuming - // the head command prematurely. - if (Array.isArray(reply) && reply.length > 0 && reply[0]) { - type = reply[0].toString(); - } - - if (type !== 'message' && type !== 'pmessage') { - command_obj = this.command_queue.shift(); - } - - queue_len = this.command_queue.getLength(); - - if (this.pub_sub_mode === false && queue_len === 0) { - this.command_queue = new Queue(); // explicitly reclaim storage from old Queue - this.emit("idle"); - } - if (this.should_buffer && queue_len <= this.command_queue_low_water) { - this.emit("drain"); - this.should_buffer = false; - } - - if (command_obj && !command_obj.sub_command) { - if (typeof command_obj.callback === "function") { - if (this.options.detect_buffers && command_obj.buffer_args === false) { - // If detect_buffers option was specified, then the reply from the parser will be Buffers. - // If this command did not use Buffer arguments, then convert the reply to Strings here. - reply = reply_to_strings(reply); - } - - // TODO - confusing and error-prone that hgetall is special cased in two places - if (reply && 'hgetall' === command_obj.command.toLowerCase()) { - reply = reply_to_object(reply); - } - - try_callback(command_obj.callback, reply); - } else if (exports.debug_mode) { - console.log("no callback for reply: " + (reply && reply.toString && reply.toString())); - } - } else if (this.pub_sub_mode || (command_obj && command_obj.sub_command)) { - if (Array.isArray(reply)) { - type = reply[0].toString(); - - if (type === "message") { - this.emit("message", reply[1].toString(), reply[2]); // channel, message - } else if (type === "pmessage") { - this.emit("pmessage", reply[1].toString(), reply[2].toString(), reply[3]); // pattern, channel, message - } else if (type === "subscribe" || type === "unsubscribe" || type === "psubscribe" || type === "punsubscribe") { - if (reply[2] === 0) { - this.pub_sub_mode = false; - if (this.debug_mode) { - console.log("All subscriptions removed, exiting pub/sub mode"); - } - } else { - this.pub_sub_mode = true; - } - // subscribe commands take an optional callback and also emit an event, but only the first response is included in the callback - // TODO - document this or fix it so it works in a more obvious way - if (command_obj && typeof command_obj.callback === "function") { - try_callback(command_obj.callback, reply[1].toString()); - } - this.emit(type, reply[1].toString(), reply[2]); // channel, count - } else { - throw new Error("subscriptions are active but got unknown reply type " + type); - } - } else if (! this.closing) { - throw new Error("subscriptions are active but got an invalid reply: " + reply); - } - } else if (this.monitoring) { - len = reply.indexOf(" "); - timestamp = reply.slice(0, len); - argindex = reply.indexOf('"'); - args = reply.slice(argindex + 1, -1).split('" "').map(function (elem) { - return elem.replace(/\\"/g, '"'); - }); - this.emit("monitor", timestamp, args); - } else { - throw new Error("node_redis command queue state error. If you can reproduce this, please report it."); - } -}; - -// This Command constructor is ever so slightly faster than using an object literal, but more importantly, using -// a named constructor helps it show up meaningfully in the V8 CPU profiler and in heap snapshots. -function Command(command, args, sub_command, buffer_args, callback) { - this.command = command; - this.args = args; - this.sub_command = sub_command; - this.buffer_args = buffer_args; - this.callback = callback; -} - -RedisClient.prototype.send_command = function (command, args, callback) { - var arg, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type; - - if (typeof command !== "string") { - throw new Error("First argument to send_command must be the command name string, not " + typeof command); - } - - if (Array.isArray(args)) { - if (typeof callback === "function") { - // probably the fastest way: - // client.command([arg1, arg2], cb); (straight passthrough) - // send_command(command, [arg1, arg2], cb); - } else if (! callback) { - // most people find this variable argument length form more convenient, but it uses arguments, which is slower - // client.command(arg1, arg2, cb); (wraps up arguments into an array) - // send_command(command, [arg1, arg2, cb]); - // client.command(arg1, arg2); (callback is optional) - // send_command(command, [arg1, arg2]); - // client.command(arg1, arg2, undefined); (callback is undefined) - // send_command(command, [arg1, arg2, undefined]); - last_arg_type = typeof args[args.length - 1]; - if (last_arg_type === "function" || last_arg_type === "undefined") { - callback = args.pop(); - } - } else { - throw new Error("send_command: last argument must be a callback or undefined"); - } - } else { - throw new Error("send_command: second argument must be an array"); - } - - // if the last argument is an array and command is sadd, expand it out: - // client.sadd(arg1, [arg2, arg3, arg4], cb); - // converts to: - // client.sadd(arg1, arg2, arg3, arg4, cb); - if ((command === 'sadd' || command === 'SADD') && args.length > 0 && Array.isArray(args[args.length - 1])) { - args = args.slice(0, -1).concat(args[args.length - 1]); - } - - // if the value is undefined or null and command is set or setx, need not to send message to redis - if (command === 'set' || command === 'setex') { - if(args[args.length - 1] === undefined || args[args.length - 1] === null) { - var err = new Error('send_command: ' + command + ' value must not be undefined or null'); - return callback(err); - } - } - - buffer_args = false; - for (i = 0, il = args.length, arg; i < il; i += 1) { - if (Buffer.isBuffer(args[i])) { - buffer_args = true; - } - } - - command_obj = new Command(command, args, false, buffer_args, callback); - - if ((!this.ready && !this.send_anyway) || !stream.writable) { - if (exports.debug_mode) { - if (!stream.writable) { - console.log("send command: stream is not writeable."); - } - } - - if (this.enable_offline_queue) { - if (exports.debug_mode) { - console.log("Queueing " + command + " for next server connection."); - } - this.offline_queue.push(command_obj); - this.should_buffer = true; - } else { - var not_writeable_error = new Error('send_command: stream not writeable. enable_offline_queue is false'); - if (command_obj.callback) { - command_obj.callback(not_writeable_error); - } else { - throw not_writeable_error; - } - } - - return false; - } - - if (command === "subscribe" || command === "psubscribe" || command === "unsubscribe" || command === "punsubscribe") { - this.pub_sub_command(command_obj); - } else if (command === "monitor") { - this.monitoring = true; - } else if (command === "quit") { - this.closing = true; - } else if (this.pub_sub_mode === true) { - throw new Error("Connection in pub/sub mode, only pub/sub commands may be used"); - } - this.command_queue.push(command_obj); - this.commands_sent += 1; - - elem_count = args.length + 1; - - // Always use "Multi bulk commands", but if passed any Buffer args, then do multiple writes, one for each arg. - // This means that using Buffers in commands is going to be slower, so use Strings if you don't already have a Buffer. - - command_str = "*" + elem_count + "\r\n$" + command.length + "\r\n" + command + "\r\n"; - - if (! buffer_args) { // Build up a string and send entire command in one write - for (i = 0, il = args.length, arg; i < il; i += 1) { - arg = args[i]; - if (typeof arg !== "string") { - arg = String(arg); - } - command_str += "$" + Buffer.byteLength(arg) + "\r\n" + arg + "\r\n"; - } - if (exports.debug_mode) { - console.log("send " + this.host + ":" + this.port + " id " + this.connection_id + ": " + command_str); - } - buffered_writes += !stream.write(command_str); - } else { - if (exports.debug_mode) { - console.log("send command (" + command_str + ") has Buffer arguments"); - } - buffered_writes += !stream.write(command_str); - - for (i = 0, il = args.length, arg; i < il; i += 1) { - arg = args[i]; - if (!(Buffer.isBuffer(arg) || arg instanceof String)) { - arg = String(arg); - } - - if (Buffer.isBuffer(arg)) { - if (arg.length === 0) { - if (exports.debug_mode) { - console.log("send_command: using empty string for 0 length buffer"); - } - buffered_writes += !stream.write("$0\r\n\r\n"); - } else { - buffered_writes += !stream.write("$" + arg.length + "\r\n"); - buffered_writes += !stream.write(arg); - buffered_writes += !stream.write("\r\n"); - if (exports.debug_mode) { - console.log("send_command: buffer send " + arg.length + " bytes"); - } - } - } else { - if (exports.debug_mode) { - console.log("send_command: string send " + Buffer.byteLength(arg) + " bytes: " + arg); - } - buffered_writes += !stream.write("$" + Buffer.byteLength(arg) + "\r\n" + arg + "\r\n"); - } - } - } - if (exports.debug_mode) { - console.log("send_command buffered_writes: " + buffered_writes, " should_buffer: " + this.should_buffer); - } - if (buffered_writes || this.command_queue.getLength() >= this.command_queue_high_water) { - this.should_buffer = true; - } - return !this.should_buffer; -}; - -RedisClient.prototype.pub_sub_command = function (command_obj) { - var i, key, command, args; - - if (this.pub_sub_mode === false && exports.debug_mode) { - console.log("Entering pub/sub mode from " + command_obj.command); - } - this.pub_sub_mode = true; - command_obj.sub_command = true; - - command = command_obj.command; - args = command_obj.args; - if (command === "subscribe" || command === "psubscribe") { - if (command === "subscribe") { - key = "sub"; - } else { - key = "psub"; - } - for (i = 0; i < args.length; i++) { - this.subscription_set[key + " " + args[i]] = true; - } - } else { - if (command === "unsubscribe") { - key = "sub"; - } else { - key = "psub"; - } - for (i = 0; i < args.length; i++) { - delete this.subscription_set[key + " " + args[i]]; - } - } -}; - -RedisClient.prototype.end = function () { - this.stream._events = {}; - this.connected = false; - this.ready = false; - this.closing = true; - return this.stream.end(); -}; - -function Multi(client, args) { - this._client = client; - this.queue = [["MULTI"]]; - if (Array.isArray(args)) { - this.queue = this.queue.concat(args); - } -} - -exports.Multi = Multi; - -// take 2 arrays and return the union of their elements -function set_union(seta, setb) { - var obj = {}; - - seta.forEach(function (val) { - obj[val] = true; - }); - setb.forEach(function (val) { - obj[val] = true; - }); - return Object.keys(obj); -} - -// This static list of commands is updated from time to time. ./lib/commands.js can be updated with generate_commands.js -commands = set_union(["get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", - "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", - "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", - "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", - "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", - "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", - "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", - "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", - "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", - "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); - -commands.forEach(function (fullCommand) { - var command = fullCommand.split(' ')[0]; - - RedisClient.prototype[command] = function (args, callback) { - if (Array.isArray(args) && typeof callback === "function") { - return this.send_command(command, args, callback); - } else { - return this.send_command(command, to_array(arguments)); - } - }; - RedisClient.prototype[command.toUpperCase()] = RedisClient.prototype[command]; - - Multi.prototype[command] = function () { - this.queue.push([command].concat(to_array(arguments))); - return this; - }; - Multi.prototype[command.toUpperCase()] = Multi.prototype[command]; -}); - -// store db in this.select_db to restore it on reconnect -RedisClient.prototype.select = function (db, callback) { - var self = this; - - this.send_command('select', [db], function (err, res) { - if (err === null) { - self.selected_db = db; - } - if (typeof(callback) === 'function') { - callback(err, res); - } - }); -}; -RedisClient.prototype.SELECT = RedisClient.prototype.select; - -// Stash auth for connect and reconnect. Send immediately if already connected. -RedisClient.prototype.auth = function () { - var args = to_array(arguments); - this.auth_pass = args[0]; - this.auth_callback = args[1]; - if (exports.debug_mode) { - console.log("Saving auth as " + this.auth_pass); - } - - if (this.connected) { - this.send_command("auth", args); - } -}; -RedisClient.prototype.AUTH = RedisClient.prototype.auth; - -RedisClient.prototype.hmget = function (arg1, arg2, arg3) { - if (Array.isArray(arg2) && typeof arg3 === "function") { - return this.send_command("hmget", [arg1].concat(arg2), arg3); - } else if (Array.isArray(arg1) && typeof arg2 === "function") { - return this.send_command("hmget", arg1, arg2); - } else { - return this.send_command("hmget", to_array(arguments)); - } -}; -RedisClient.prototype.HMGET = RedisClient.prototype.hmget; - -RedisClient.prototype.hmset = function (args, callback) { - var tmp_args, tmp_keys, i, il, key; - - if (Array.isArray(args) && typeof callback === "function") { - return this.send_command("hmset", args, callback); - } - - args = to_array(arguments); - if (typeof args[args.length - 1] === "function") { - callback = args[args.length - 1]; - args.length -= 1; - } else { - callback = null; - } - - if (args.length === 2 && typeof args[0] === "string" && typeof args[1] === "object") { - // User does: client.hmset(key, {key1: val1, key2: val2}) - tmp_args = [ args[0] ]; - tmp_keys = Object.keys(args[1]); - for (i = 0, il = tmp_keys.length; i < il ; i++) { - key = tmp_keys[i]; - tmp_args.push(key); - tmp_args.push(args[1][key]); - } - args = tmp_args; - } - - return this.send_command("hmset", args, callback); -}; -RedisClient.prototype.HMSET = RedisClient.prototype.hmset; - -Multi.prototype.hmset = function () { - var args = to_array(arguments), tmp_args; - if (args.length >= 2 && typeof args[0] === "string" && typeof args[1] === "object") { - tmp_args = [ "hmset", args[0] ]; - Object.keys(args[1]).map(function (key) { - tmp_args.push(key); - tmp_args.push(args[1][key]); - }); - if (args[2]) { - tmp_args.push(args[2]); - } - args = tmp_args; - } else { - args.unshift("hmset"); - } - - this.queue.push(args); - return this; -}; -Multi.prototype.HMSET = Multi.prototype.hmset; - -Multi.prototype.exec = function (callback) { - var self = this; - - // drain queue, callback will catch "QUEUED" or error - // TODO - get rid of all of these anonymous functions which are elegant but slow - this.queue.forEach(function (args, index) { - var command = args[0], obj; - if (typeof args[args.length - 1] === "function") { - args = args.slice(1, -1); - } else { - args = args.slice(1); - } - if (args.length === 1 && Array.isArray(args[0])) { - args = args[0]; - } - if (command.toLowerCase() === 'hmset' && typeof args[1] === 'object') { - obj = args.pop(); - Object.keys(obj).forEach(function (key) { - args.push(key); - args.push(obj[key]); - }); - } - this._client.send_command(command, args, function (err, reply) { - if (err) { - var cur = self.queue[index]; - if (typeof cur[cur.length - 1] === "function") { - cur[cur.length - 1](err); - } else { - throw new Error(err); - } - self.queue.splice(index, 1); - } - }); - }, this); - - // TODO - make this callback part of Multi.prototype instead of creating it each time - return this._client.send_command("EXEC", [], function (err, replies) { - if (err) { - if (callback) { - callback(new Error(err)); - return; - } else { - throw new Error(err); - } - } - - var i, il, reply, args; - - if (replies) { - for (i = 1, il = self.queue.length; i < il; i += 1) { - reply = replies[i - 1]; - args = self.queue[i]; - - // TODO - confusing and error-prone that hgetall is special cased in two places - if (reply && args[0].toLowerCase() === "hgetall") { - replies[i - 1] = reply = reply_to_object(reply); - } - - if (typeof args[args.length - 1] === "function") { - args[args.length - 1](null, reply); - } - } - } - - if (callback) { - callback(null, replies); - } - }); -}; -Multi.prototype.EXEC = Multi.prototype.exec; - -RedisClient.prototype.multi = function (args) { - return new Multi(this, args); -}; -RedisClient.prototype.MULTI = function (args) { - return new Multi(this, args); -}; - - -// stash original eval method -var eval_orig = RedisClient.prototype.eval; -// hook eval with an attempt to evalsha for cached scripts -RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () { - var self = this, - args = to_array(arguments), - callback; - - if (typeof args[args.length - 1] === "function") { - callback = args.pop(); - } - - if (Array.isArray(args[0])) { - args = args[0]; - } - - // replace script source with sha value - var source = args[0]; - args[0] = crypto.createHash("sha1").update(source).digest("hex"); - - self.evalsha(args, function (err, reply) { - if (err && /NOSCRIPT/.test(err.message)) { - args[0] = source; - eval_orig.call(self, args, callback); - - } else if (callback) { - callback(err, reply); - } - }); -}; - - -exports.createClient = function (port_arg, host_arg, options) { - var port = port_arg || default_port, - host = host_arg || default_host, - redis_client, net_client; - - net_client = net.createConnection(port, host); - - redis_client = new RedisClient(net_client, options); - - redis_client.port = port; - redis_client.host = host; - - return redis_client; -}; - -exports.print = function (err, reply) { - if (err) { - console.log("Error: " + err); - } else { - console.log("Reply: " + reply); - } -}; diff --git a/node_modules/redis/lib/commands.js b/node_modules/redis/lib/commands.js deleted file mode 100644 index 4abfe68668..0000000000 --- a/node_modules/redis/lib/commands.js +++ /dev/null @@ -1,149 +0,0 @@ -// This file was generated by ./generate_commands.js on Sun Feb 17 2013 19:04:47 GMT-0500 (EST) -module.exports = [ - "append", - "auth", - "bgrewriteaof", - "bgsave", - "bitcount", - "bitop", - "blpop", - "brpop", - "brpoplpush", - "client kill", - "client list", - "client getname", - "client setname", - "config get", - "config set", - "config resetstat", - "dbsize", - "debug object", - "debug segfault", - "decr", - "decrby", - "del", - "discard", - "dump", - "echo", - "eval", - "evalsha", - "exec", - "exists", - "expire", - "expireat", - "flushall", - "flushdb", - "get", - "getbit", - "getrange", - "getset", - "hdel", - "hexists", - "hget", - "hgetall", - "hincrby", - "hincrbyfloat", - "hkeys", - "hlen", - "hmget", - "hmset", - "hset", - "hsetnx", - "hvals", - "incr", - "incrby", - "incrbyfloat", - "info", - "keys", - "lastsave", - "lindex", - "linsert", - "llen", - "lpop", - "lpush", - "lpushx", - "lrange", - "lrem", - "lset", - "ltrim", - "mget", - "migrate", - "monitor", - "move", - "mset", - "msetnx", - "multi", - "object", - "persist", - "pexpire", - "pexpireat", - "ping", - "psetex", - "psubscribe", - "pttl", - "publish", - "punsubscribe", - "quit", - "randomkey", - "rename", - "renamenx", - "restore", - "rpop", - "rpoplpush", - "rpush", - "rpushx", - "sadd", - "save", - "scard", - "script exists", - "script flush", - "script kill", - "script load", - "sdiff", - "sdiffstore", - "select", - "set", - "setbit", - "setex", - "setnx", - "setrange", - "shutdown", - "sinter", - "sinterstore", - "sismember", - "slaveof", - "slowlog", - "smembers", - "smove", - "sort", - "spop", - "srandmember", - "srem", - "strlen", - "subscribe", - "sunion", - "sunionstore", - "sync", - "time", - "ttl", - "type", - "unsubscribe", - "unwatch", - "watch", - "zadd", - "zcard", - "zcount", - "zincrby", - "zinterstore", - "zrange", - "zrangebyscore", - "zrank", - "zrem", - "zremrangebyrank", - "zremrangebyscore", - "zrevrange", - "zrevrangebyscore", - "zrevrank", - "zscore", - "zunionstore" -]; diff --git a/node_modules/redis/lib/parser/hiredis.js b/node_modules/redis/lib/parser/hiredis.js deleted file mode 100644 index 940bfeeb76..0000000000 --- a/node_modules/redis/lib/parser/hiredis.js +++ /dev/null @@ -1,46 +0,0 @@ -var events = require("events"), - util = require("../util"), - hiredis = require("hiredis"); - -exports.debug_mode = false; -exports.name = "hiredis"; - -function HiredisReplyParser(options) { - this.name = exports.name; - this.options = options || {}; - this.reset(); - events.EventEmitter.call(this); -} - -util.inherits(HiredisReplyParser, events.EventEmitter); - -exports.Parser = HiredisReplyParser; - -HiredisReplyParser.prototype.reset = function () { - this.reader = new hiredis.Reader({ - return_buffers: this.options.return_buffers || false - }); -}; - -HiredisReplyParser.prototype.execute = function (data) { - var reply; - this.reader.feed(data); - while (true) { - try { - reply = this.reader.get(); - } catch (err) { - this.emit("error", err); - break; - } - - if (reply === undefined) { - break; - } - - if (reply && reply.constructor === Error) { - this.emit("reply error", reply); - } else { - this.emit("reply", reply); - } - } -}; diff --git a/node_modules/redis/lib/parser/javascript.js b/node_modules/redis/lib/parser/javascript.js deleted file mode 100644 index 0990cc098d..0000000000 --- a/node_modules/redis/lib/parser/javascript.js +++ /dev/null @@ -1,301 +0,0 @@ -var events = require("events"), - util = require("../util"); - -function Packet(type, size) { - this.type = type; - this.size = +size; -} - -exports.name = "javascript"; -exports.debug_mode = false; - -function ReplyParser(options) { - this.name = exports.name; - this.options = options || { }; - - this._buffer = null; - this._offset = 0; - this._encoding = "utf-8"; - this._debug_mode = options.debug_mode; - this._reply_type = null; -} - -util.inherits(ReplyParser, events.EventEmitter); - -exports.Parser = ReplyParser; - -function IncompleteReadBuffer(message) { - this.name = "IncompleteReadBuffer"; - this.message = message; -} -util.inherits(IncompleteReadBuffer, Error); - -// Buffer.toString() is quite slow for small strings -function small_toString(buf, start, end) { - var tmp = "", i; - - for (i = start; i < end; i++) { - tmp += String.fromCharCode(buf[i]); - } - - return tmp; -} - -ReplyParser.prototype._parseResult = function (type) { - var start, end, offset, packetHeader; - - if (type === 43 || type === 45) { // + or - - // up to the delimiter - end = this._packetEndOffset() - 1; - start = this._offset; - - // include the delimiter - this._offset = end + 2; - - if (end > this._buffer.length) { - this._offset = start; - throw new IncompleteReadBuffer("Wait for more data."); - } - - if (this.options.return_buffers) { - return this._buffer.slice(start, end); - } else { - if (end - start < 65536) { // completely arbitrary - return small_toString(this._buffer, start, end); - } else { - return this._buffer.toString(this._encoding, start, end); - } - } - } else if (type === 58) { // : - // up to the delimiter - end = this._packetEndOffset() - 1; - start = this._offset; - - // include the delimiter - this._offset = end + 2; - - if (end > this._buffer.length) { - this._offset = start; - throw new IncompleteReadBuffer("Wait for more data."); - } - - if (this.options.return_buffers) { - return this._buffer.slice(start, end); - } - - // return the coerced numeric value - return +small_toString(this._buffer, start, end); - } else if (type === 36) { // $ - // set a rewind point, as the packet could be larger than the - // buffer in memory - offset = this._offset - 1; - - packetHeader = new Packet(type, this.parseHeader()); - - // packets with a size of -1 are considered null - if (packetHeader.size === -1) { - return undefined; - } - - end = this._offset + packetHeader.size; - start = this._offset; - - // set the offset to after the delimiter - this._offset = end + 2; - - if (end > this._buffer.length) { - this._offset = offset; - throw new IncompleteReadBuffer("Wait for more data."); - } - - if (this.options.return_buffers) { - return this._buffer.slice(start, end); - } else { - return this._buffer.toString(this._encoding, start, end); - } - } else if (type === 42) { // * - offset = this._offset; - packetHeader = new Packet(type, this.parseHeader()); - - if (packetHeader.size < 0) { - return null; - } - - if (packetHeader.size > this._bytesRemaining()) { - this._offset = offset - 1; - throw new IncompleteReadBuffer("Wait for more data."); - } - - var reply = [ ]; - var ntype, i, res; - - offset = this._offset - 1; - - for (i = 0; i < packetHeader.size; i++) { - ntype = this._buffer[this._offset++]; - - if (this._offset > this._buffer.length) { - throw new IncompleteReadBuffer("Wait for more data."); - } - res = this._parseResult(ntype); - if (res === undefined) { - res = null; - } - reply.push(res); - } - - return reply; - } -}; - -ReplyParser.prototype.execute = function (buffer) { - this.append(buffer); - - var type, ret, offset; - - while (true) { - offset = this._offset; - try { - // at least 4 bytes: :1\r\n - if (this._bytesRemaining() < 4) { - break; - } - - type = this._buffer[this._offset++]; - - if (type === 43) { // + - ret = this._parseResult(type); - - if (ret === null) { - break; - } - - this.send_reply(ret); - } else if (type === 45) { // - - ret = this._parseResult(type); - - if (ret === null) { - break; - } - - this.send_error(ret); - } else if (type === 58) { // : - ret = this._parseResult(type); - - if (ret === null) { - break; - } - - this.send_reply(ret); - } else if (type === 36) { // $ - ret = this._parseResult(type); - - if (ret === null) { - break; - } - - // check the state for what is the result of - // a -1, set it back up for a null reply - if (ret === undefined) { - ret = null; - } - - this.send_reply(ret); - } else if (type === 42) { // * - // set a rewind point. if a failure occurs, - // wait for the next execute()/append() and try again - offset = this._offset - 1; - - ret = this._parseResult(type); - - this.send_reply(ret); - } - } catch (err) { - // catch the error (not enough data), rewind, and wait - // for the next packet to appear - if (! (err instanceof IncompleteReadBuffer)) { - throw err; - } - this._offset = offset; - break; - } - } -}; - -ReplyParser.prototype.append = function (newBuffer) { - if (!newBuffer) { - return; - } - - // first run - if (this._buffer === null) { - this._buffer = newBuffer; - - return; - } - - // out of data - if (this._offset >= this._buffer.length) { - this._buffer = newBuffer; - this._offset = 0; - - return; - } - - // very large packet - // check for concat, if we have it, use it - if (Buffer.concat !== undefined) { - this._buffer = Buffer.concat([this._buffer.slice(this._offset), newBuffer]); - } else { - var remaining = this._bytesRemaining(), - newLength = remaining + newBuffer.length, - tmpBuffer = new Buffer(newLength); - - this._buffer.copy(tmpBuffer, 0, this._offset); - newBuffer.copy(tmpBuffer, remaining, 0); - - this._buffer = tmpBuffer; - } - - this._offset = 0; -}; - -ReplyParser.prototype.parseHeader = function () { - var end = this._packetEndOffset(), - value = small_toString(this._buffer, this._offset, end - 1); - - this._offset = end + 1; - - return value; -}; - -ReplyParser.prototype._packetEndOffset = function () { - var offset = this._offset; - - while (this._buffer[offset] !== 0x0d && this._buffer[offset + 1] !== 0x0a) { - offset++; - - if (offset >= this._buffer.length) { - throw new IncompleteReadBuffer("didn't see LF after NL reading multi bulk count (" + offset + " => " + this._buffer.length + ", " + this._offset + ")"); - } - } - - offset++; - return offset; -}; - -ReplyParser.prototype._bytesRemaining = function () { - return (this._buffer.length - this._offset) < 0 ? 0 : (this._buffer.length - this._offset); -}; - -ReplyParser.prototype.parser_error = function (message) { - this.emit("error", message); -}; - -ReplyParser.prototype.send_error = function (reply) { - this.emit("reply error", reply); -}; - -ReplyParser.prototype.send_reply = function (reply) { - this.emit("reply", reply); -}; diff --git a/node_modules/redis/lib/queue.js b/node_modules/redis/lib/queue.js deleted file mode 100644 index 3fc87ab102..0000000000 --- a/node_modules/redis/lib/queue.js +++ /dev/null @@ -1,59 +0,0 @@ -// Queue class adapted from Tim Caswell's pattern library -// http://github.com/creationix/pattern/blob/master/lib/pattern/queue.js - -function Queue() { - this.tail = []; - this.head = []; - this.offset = 0; -} - -Queue.prototype.shift = function () { - if (this.offset === this.head.length) { - var tmp = this.head; - tmp.length = 0; - this.head = this.tail; - this.tail = tmp; - this.offset = 0; - if (this.head.length === 0) { - return; - } - } - return this.head[this.offset++]; // sorry, JSLint -}; - -Queue.prototype.push = function (item) { - return this.tail.push(item); -}; - -Queue.prototype.forEach = function (fn, thisv) { - var array = this.head.slice(this.offset), i, il; - - array.push.apply(array, this.tail); - - if (thisv) { - for (i = 0, il = array.length; i < il; i += 1) { - fn.call(thisv, array[i], i, array); - } - } else { - for (i = 0, il = array.length; i < il; i += 1) { - fn(array[i], i, array); - } - } - - return array; -}; - -Queue.prototype.getLength = function () { - return this.head.length - this.offset + this.tail.length; -}; - -Object.defineProperty(Queue.prototype, "length", { - get: function () { - return this.getLength(); - } -}); - - -if (typeof module !== "undefined" && module.exports) { - module.exports = Queue; -} diff --git a/node_modules/redis/lib/to_array.js b/node_modules/redis/lib/to_array.js deleted file mode 100644 index 88a57e18a4..0000000000 --- a/node_modules/redis/lib/to_array.js +++ /dev/null @@ -1,12 +0,0 @@ -function to_array(args) { - var len = args.length, - arr = new Array(len), i; - - for (i = 0; i < len; i += 1) { - arr[i] = args[i]; - } - - return arr; -} - -module.exports = to_array; diff --git a/node_modules/redis/lib/util.js b/node_modules/redis/lib/util.js deleted file mode 100644 index fc255ae953..0000000000 --- a/node_modules/redis/lib/util.js +++ /dev/null @@ -1,11 +0,0 @@ -// Support for very old versions of node where the module was called "sys". At some point, we should abandon this. - -var util; - -try { - util = require("util"); -} catch (err) { - util = require("sys"); -} - -module.exports = util; diff --git a/node_modules/redis/multi_bench.js b/node_modules/redis/multi_bench.js deleted file mode 100644 index 3a0d92da14..0000000000 --- a/node_modules/redis/multi_bench.js +++ /dev/null @@ -1,222 +0,0 @@ -var redis = require("./index"), - metrics = require("metrics"), - num_clients = parseInt(process.argv[2], 10) || 5, - num_requests = 20000, - tests = [], - versions_logged = false, - client_options = { - return_buffers: false - }, - small_str, large_str, small_buf, large_buf; - -redis.debug_mode = false; - -function lpad(input, len, chr) { - var str = input.toString(); - chr = chr || " "; - - while (str.length < len) { - str = chr + str; - } - return str; -} - -metrics.Histogram.prototype.print_line = function () { - var obj = this.printObj(); - - return lpad(obj.min, 4) + "/" + lpad(obj.max, 4) + "/" + lpad(obj.mean.toFixed(2), 7) + "/" + lpad(obj.p95.toFixed(2), 7); -}; - -function Test(args) { - this.args = args; - - this.callback = null; - this.clients = []; - this.clients_ready = 0; - this.commands_sent = 0; - this.commands_completed = 0; - this.max_pipeline = this.args.pipeline || num_requests; - this.client_options = args.client_options || client_options; - - this.connect_latency = new metrics.Histogram(); - this.ready_latency = new metrics.Histogram(); - this.command_latency = new metrics.Histogram(); -} - -Test.prototype.run = function (callback) { - var i; - - this.callback = callback; - - for (i = 0; i < num_clients ; i++) { - this.new_client(i); - } -}; - -Test.prototype.new_client = function (id) { - var self = this, new_client; - - new_client = redis.createClient(6379, "127.0.0.1", this.client_options); - new_client.create_time = Date.now(); - - new_client.on("connect", function () { - self.connect_latency.update(Date.now() - new_client.create_time); - }); - - new_client.on("ready", function () { - if (! versions_logged) { - console.log("Client count: " + num_clients + ", node version: " + process.versions.node + ", server version: " + - new_client.server_info.redis_version + ", parser: " + new_client.reply_parser.name); - versions_logged = true; - } - self.ready_latency.update(Date.now() - new_client.create_time); - self.clients_ready++; - if (self.clients_ready === self.clients.length) { - self.on_clients_ready(); - } - }); - - self.clients[id] = new_client; -}; - -Test.prototype.on_clients_ready = function () { - process.stdout.write(lpad(this.args.descr, 13) + ", " + lpad(this.args.pipeline, 5) + "/" + this.clients_ready + " "); - this.test_start = Date.now(); - - this.fill_pipeline(); -}; - -Test.prototype.fill_pipeline = function () { - var pipeline = this.commands_sent - this.commands_completed; - - while (this.commands_sent < num_requests && pipeline < this.max_pipeline) { - this.commands_sent++; - pipeline++; - this.send_next(); - } - - if (this.commands_completed === num_requests) { - this.print_stats(); - this.stop_clients(); - } -}; - -Test.prototype.stop_clients = function () { - var self = this; - - this.clients.forEach(function (client, pos) { - if (pos === self.clients.length - 1) { - client.quit(function (err, res) { - self.callback(); - }); - } else { - client.quit(); - } - }); -}; - -Test.prototype.send_next = function () { - var self = this, - cur_client = this.commands_sent % this.clients.length, - start = Date.now(); - - this.clients[cur_client][this.args.command](this.args.args, function (err, res) { - if (err) { - throw err; - } - self.commands_completed++; - self.command_latency.update(Date.now() - start); - self.fill_pipeline(); - }); -}; - -Test.prototype.print_stats = function () { - var duration = Date.now() - this.test_start; - - console.log("min/max/avg/p95: " + this.command_latency.print_line() + " " + lpad(duration, 6) + "ms total, " + - lpad((num_requests / (duration / 1000)).toFixed(2), 8) + " ops/sec"); -}; - -small_str = "1234"; -small_buf = new Buffer(small_str); -large_str = (new Array(4097).join("-")); -large_buf = new Buffer(large_str); - -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 1})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 50})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 200})); -tests.push(new Test({descr: "PING", command: "ping", args: [], pipeline: 20000})); - -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 1})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 50})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 200})); -tests.push(new Test({descr: "SET small str", command: "set", args: ["foo_rand000000000000", small_str], pipeline: 20000})); - -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 1})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 50})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 200})); -tests.push(new Test({descr: "SET small buf", command: "set", args: ["foo_rand000000000000", small_buf], pipeline: 20000})); - -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 1})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 50})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 200})); -tests.push(new Test({descr: "GET small str", command: "get", args: ["foo_rand000000000000"], pipeline: 20000})); - -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 1, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 50, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 200, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET small buf", command: "get", args: ["foo_rand000000000000"], pipeline: 20000, client_opts: { return_buffers: true} })); - -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 1})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 50})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 200})); -tests.push(new Test({descr: "SET large str", command: "set", args: ["foo_rand000000000001", large_str], pipeline: 20000})); - -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 1})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 50})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 200})); -tests.push(new Test({descr: "SET large buf", command: "set", args: ["foo_rand000000000001", large_buf], pipeline: 20000})); - -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 1})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 50})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 200})); -tests.push(new Test({descr: "GET large str", command: "get", args: ["foo_rand000000000001"], pipeline: 20000})); - -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 1, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 50, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 200, client_opts: { return_buffers: true} })); -tests.push(new Test({descr: "GET large buf", command: "get", args: ["foo_rand000000000001"], pipeline: 20000, client_opts: { return_buffers: true} })); - -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 1})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 50})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 200})); -tests.push(new Test({descr: "INCR", command: "incr", args: ["counter_rand000000000000"], pipeline: 20000})); - -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 1})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 50})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 200})); -tests.push(new Test({descr: "LPUSH", command: "lpush", args: ["mylist", small_str], pipeline: 20000})); - -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 1})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 50})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 200})); -tests.push(new Test({descr: "LRANGE 10", command: "lrange", args: ["mylist", "0", "9"], pipeline: 20000})); - -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 1})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 50})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 200})); -tests.push(new Test({descr: "LRANGE 100", command: "lrange", args: ["mylist", "0", "99"], pipeline: 20000})); - -function next() { - var test = tests.shift(); - if (test) { - test.run(function () { - next(); - }); - } else { - console.log("End of tests."); - process.exit(0); - } -} - -next(); diff --git a/node_modules/redis/package.json b/node_modules/redis/package.json deleted file mode 100644 index 489f477030..0000000000 --- a/node_modules/redis/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "redis", - "version": "0.8.3", - "description": "Redis client library", - "keywords": [ - "redis", - "database" - ], - "author": { - "name": "Matt Ranney", - "email": "mjr@ranney.com" - }, - "main": "./index.js", - "scripts": { - "test": "node ./test.js" - }, - "devDependencies": { - "metrics": ">=0.1.5", - "colors": "~0.6.0-1", - "underscore": "~1.4.4" - }, - "repository": { - "type": "git", - "url": "git://github.com/mranney/node_redis.git" - }, - "_id": "redis@0.8.3", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.4", - "_nodeVersion": "v0.6.12", - "_defaultsLoaded": true, - "dist": { - "shasum": "bda57a05e1f0d9a69996dbcdcd6010c8ca1de0c9" - }, - "_from": "redis@0.8.3" -} diff --git a/node_modules/redis/test.js b/node_modules/redis/test.js deleted file mode 100644 index 1d8d6343af..0000000000 --- a/node_modules/redis/test.js +++ /dev/null @@ -1,1955 +0,0 @@ -/*global require console setTimeout process Buffer */ -var PORT = 6379; -var HOST = '127.0.0.1'; - -var redis = require("./index"), - client = redis.createClient(PORT, HOST), - client2 = redis.createClient(PORT, HOST), - client3 = redis.createClient(PORT, HOST), - bclient = redis.createClient(PORT, HOST, { return_buffers: true }), - assert = require("assert"), - crypto = require("crypto"), - util = require("./lib/util"), - test_db_num = 15, // this DB will be flushed and used for testing - tests = {}, - connected = false, - ended = false, - next, cur_start, run_next_test, all_tests, all_start, test_count; - - -// Set this to truthy to see the wire protocol and other debugging info -redis.debug_mode = process.argv[2]; - -function server_version_at_least(connection, desired_version) { - // Return true if the server version >= desired_version - var version = connection.server_info.versions; - for (var i = 0; i < 3; i++) { - if (version[i] > desired_version[i]) return true; - if (version[i] < desired_version[i]) return false; - } - return true; -} - -function buffers_to_strings(arr) { - return arr.map(function (val) { - return val.toString(); - }); -} - -function require_number(expected, label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected " + expected + ", got error: " + err); - assert.strictEqual(expected, results, label + " " + expected + " !== " + results); - assert.strictEqual(typeof results, "number", label); - return true; - }; -} - -function require_number_any(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected any number, got error: " + err); - assert.strictEqual(typeof results, "number", label + " " + results + " is not a number"); - return true; - }; -} - -function require_number_pos(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected positive number, got error: " + err); - assert.strictEqual(true, (results > 0), label + " " + results + " is not a positive number"); - return true; - }; -} - -function require_string(str, label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected string '" + str + "', got error: " + err); - assert.equal(str, results, label + " " + str + " does not match " + results); - return true; - }; -} - -function require_null(label) { - return function (err, results) { - assert.strictEqual(null, err, label + " expected null, got error: " + err); - assert.strictEqual(null, results, label + ": " + results + " is not null"); - return true; - }; -} - -function require_error(label) { - return function (err, results) { - assert.notEqual(err, null, label + " err is null, but an error is expected here."); - return true; - }; -} - -function is_empty_array(obj) { - return Array.isArray(obj) && obj.length === 0; -} - -function last(name, fn) { - return function (err, results) { - fn(err, results); - next(name); - }; -} - -// Wraps the given callback in a timeout. If the returned function -// is not called within the timeout period, we fail the named test. -function with_timeout(name, cb, millis) { - var timeoutId = setTimeout(function() { - assert.fail("Callback timed out!", name); - }, millis); - return function() { - clearTimeout(timeoutId); - cb.apply(this, arguments); - }; -} - -next = function next(name) { - console.log(" \x1b[33m" + (Date.now() - cur_start) + "\x1b[0m ms"); - run_next_test(); -}; - -// Tests are run in the order they are defined, so FLUSHDB should always be first. - -tests.FLUSHDB = function () { - var name = "FLUSHDB"; - client.select(test_db_num, require_string("OK", name)); - client2.select(test_db_num, require_string("OK", name)); - client3.select(test_db_num, require_string("OK", name)); - client.mset("flush keys 1", "flush val 1", "flush keys 2", "flush val 2", require_string("OK", name)); - client.FLUSHDB(require_string("OK", name)); - client.dbsize(last(name, require_number(0, name))); -}; - -tests.INCR = function () { - var name = "INCR"; - - if (bclient.reply_parser.name == "hiredis") { - console.log("Skipping INCR buffer test with hiredis"); - return next(name); - } - - // Test incr with the maximum JavaScript number value. Since we are - // returning buffers we should get back one more as a Buffer. - bclient.set("seq", "9007199254740992", function (err, result) { - assert.strictEqual(result.toString(), "OK"); - bclient.incr("seq", function (err, result) { - assert.strictEqual("9007199254740993", result.toString()); - next(name); - }); - }); -}; - -tests.MULTI_1 = function () { - var name = "MULTI_1", multi1, multi2; - - // Provoke an error at queue time - multi1 = client.multi(); - multi1.mset("multifoo", "10", "multibar", "20", require_string("OK", name)); - multi1.set("foo2", require_error(name)); - multi1.incr("multifoo", require_number(11, name)); - multi1.incr("multibar", require_number(21, name)); - multi1.exec(function () { - require_error(name); - - // Redis 2.6.5+ will abort transactions with errors - // see: http://redis.io/topics/transactions - var multibar_expected = 22; - var multifoo_expected = 12; - if (server_version_at_least(client, [2, 6, 5])) { - multibar_expected = 1; - multifoo_expected = 1; - } - - // Confirm that the previous command, while containing an error, still worked. - multi2 = client.multi(); - multi2.incr("multibar", require_number(multibar_expected, name)); - multi2.incr("multifoo", require_number(multifoo_expected, name)); - multi2.exec(function (err, replies) { - assert.strictEqual(multibar_expected, replies[0]); - assert.strictEqual(multifoo_expected, replies[1]); - next(name); - }); - }); -}; - -tests.MULTI_2 = function () { - var name = "MULTI_2"; - - // test nested multi-bulk replies - client.multi([ - ["mget", "multifoo", "multibar", function (err, res) { - assert.strictEqual(2, res.length, name); - assert.strictEqual("12", res[0].toString(), name); - assert.strictEqual("22", res[1].toString(), name); - }], - ["set", "foo2", require_error(name)], - ["incr", "multifoo", require_number(13, name)], - ["incr", "multibar", require_number(23, name)] - - ]).exec(function (err, replies) { - - if (server_version_at_least(client, [2, 6, 5])) { - assert.notEqual(err, null, name); - assert.equal(replies, undefined, name); - } else { - assert.strictEqual(2, replies[0].length, name); - assert.strictEqual("12", replies[0][0].toString(), name); - assert.strictEqual("22", replies[0][1].toString(), name); - - assert.strictEqual("13", replies[1].toString()); - assert.strictEqual("23", replies[2].toString()); - } - next(name); - }); -}; - -tests.MULTI_3 = function () { - var name = "MULTI_3"; - - client.sadd("some set", "mem 1"); - client.sadd("some set", "mem 2"); - client.sadd("some set", "mem 3"); - client.sadd("some set", "mem 4"); - - // make sure empty mb reply works - client.del("some missing set"); - client.smembers("some missing set", function (err, reply) { - // make sure empty mb reply works - assert.strictEqual(true, is_empty_array(reply), name); - }); - - // test nested multi-bulk replies with empty mb elements. - client.multi([ - ["smembers", "some set"], - ["del", "some set"], - ["smembers", "some set"] - ]) - .scard("some set") - .exec(function (err, replies) { - assert.strictEqual(true, is_empty_array(replies[2]), name); - next(name); - }); -}; - -tests.MULTI_4 = function () { - var name = "MULTI_4"; - - client.multi() - .mset('some', '10', 'keys', '20') - .incr('some') - .incr('keys') - .mget('some', 'keys') - .exec(function (err, replies) { - assert.strictEqual(null, err); - assert.equal('OK', replies[0]); - assert.equal(11, replies[1]); - assert.equal(21, replies[2]); - assert.equal(11, replies[3][0].toString()); - assert.equal(21, replies[3][1].toString()); - next(name); - }); -}; - -tests.MULTI_5 = function () { - var name = "MULTI_5"; - - // test nested multi-bulk replies with nulls. - client.multi([ - ["mget", ["multifoo", "some", "random value", "keys"]], - ["incr", "multifoo"] - ]) - .exec(function (err, replies) { - assert.strictEqual(replies.length, 2, name); - assert.strictEqual(replies[0].length, 4, name); - next(name); - }); -}; - -tests.MULTI_6 = function () { - var name = "MULTI_6"; - - client.multi() - .hmset("multihash", "a", "foo", "b", 1) - .hmset("multihash", { - extra: "fancy", - things: "here" - }) - .hgetall("multihash") - .exec(function (err, replies) { - assert.strictEqual(null, err); - assert.equal("OK", replies[0]); - assert.equal(Object.keys(replies[2]).length, 4); - assert.equal("foo", replies[2].a); - assert.equal("1", replies[2].b); - assert.equal("fancy", replies[2].extra); - assert.equal("here", replies[2].things); - next(name); - }); -}; - -tests.MULTI_7 = function () { - var name = "MULTI_7"; - - if (bclient.reply_parser.name != "javascript") { - console.log("Skipping wire-protocol test for 3rd-party parser"); - return next(name); - } - - var p = require("./lib/parser/javascript"); - var parser = new p.Parser(false); - var reply_count = 0; - function check_reply(reply) { - assert.deepEqual(reply, [['a']], "Expecting multi-bulk reply of [['a']]"); - reply_count++; - assert.notEqual(reply_count, 4, "Should only parse 3 replies"); - } - parser.on("reply", check_reply); - - parser.execute(new Buffer('*1\r\n*1\r\n$1\r\na\r\n')); - - parser.execute(new Buffer('*1\r\n*1\r')); - parser.execute(new Buffer('\n$1\r\na\r\n')); - - parser.execute(new Buffer('*1\r\n*1\r\n')); - parser.execute(new Buffer('$1\r\na\r\n')); - - next(name); -}; - -tests.FWD_ERRORS_1 = function () { - var name = "FWD_ERRORS_1"; - - var toThrow = new Error("Forced exception"); - var recordedError = null; - - var originalHandlers = client3.listeners("error"); - client3.removeAllListeners("error"); - client3.once("error", function (err) { - recordedError = err; - }); - - client3.on("message", function (channel, data) { - console.log("incoming"); - if (channel == name) { - assert.equal(data, "Some message"); - throw toThrow; - } - }); - client3.subscribe(name); - - client.publish(name, "Some message"); - setTimeout(function () { - client3.listeners("error").push(originalHandlers); - assert.equal(recordedError, toThrow, "Should have caught our forced exception"); - next(name); - }, 150); -}; - -tests.EVAL_1 = function () { - var name = "EVAL_1"; - - if (!server_version_at_least(client, [2, 5, 0])) { - console.log("Skipping " + name + " for old Redis server version < 2.5.x"); - return next(name); - } - - // test {EVAL - Lua integer -> Redis protocol type conversion} - client.eval("return 100.5", 0, require_number(100, name)); - // test {EVAL - Lua string -> Redis protocol type conversion} - client.eval("return 'hello world'", 0, require_string("hello world", name)); - // test {EVAL - Lua true boolean -> Redis protocol type conversion} - client.eval("return true", 0, require_number(1, name)); - // test {EVAL - Lua false boolean -> Redis protocol type conversion} - client.eval("return false", 0, require_null(name)); - // test {EVAL - Lua status code reply -> Redis protocol type conversion} - client.eval("return {ok='fine'}", 0, require_string("fine", name)); - // test {EVAL - Lua error reply -> Redis protocol type conversion} - client.eval("return {err='this is an error'}", 0, require_error(name)); - // test {EVAL - Lua table -> Redis protocol type conversion} - client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) { - assert.strictEqual(5, res.length, name); - assert.strictEqual(1, res[0], name); - assert.strictEqual(2, res[1], name); - assert.strictEqual(3, res[2], name); - assert.strictEqual("ciao", res[3], name); - assert.strictEqual(2, res[4].length, name); - assert.strictEqual(1, res[4][0], name); - assert.strictEqual(2, res[4][1], name); - }); - // test {EVAL - Are the KEYS and ARGS arrays populated correctly?} - client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) { - assert.strictEqual(4, res.length, name); - assert.strictEqual("a", res[0], name); - assert.strictEqual("b", res[1], name); - assert.strictEqual("c", res[2], name); - assert.strictEqual("d", res[3], name); - }); - - // test {EVAL - parameters in array format gives same result} - client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) { - assert.strictEqual(4, res.length, name); - assert.strictEqual("a", res[0], name); - assert.strictEqual("b", res[1], name); - assert.strictEqual("c", res[2], name); - assert.strictEqual("d", res[3], name); - }); - - // prepare sha sum for evalsha cache test - var source = "return redis.call('get', 'sha test')", - sha = crypto.createHash('sha1').update(source).digest('hex'); - - client.set("sha test", "eval get sha test", function (err, res) { - if (err) throw err; - // test {EVAL - is Lua able to call Redis API?} - client.eval(source, 0, function (err, res) { - require_string("eval get sha test", name)(err, res); - // test {EVALSHA - Can we call a SHA1 if already defined?} - client.evalsha(sha, 0, require_string("eval get sha test", name)); - // test {EVALSHA - Do we get an error on non defined SHA1?} - client.evalsha("ffffffffffffffffffffffffffffffffffffffff", 0, require_error(name)); - }); - }); - - // test {EVAL - Redis integer -> Lua type conversion} - client.set("incr key", 0, function (err, reply) { - if (err) throw err; - client.eval("local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("number", res[0], name); - assert.strictEqual(1, res[1], name); - }); - }); - - client.set("bulk reply key", "bulk reply value", function (err, res) { - // test {EVAL - Redis bulk -> Lua type conversion} - client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("string", res[0], name); - assert.strictEqual("bulk reply value", res[1], name); - }); - }); - - // test {EVAL - Redis multi bulk -> Lua type conversion} - client.multi() - .del("mylist") - .rpush("mylist", "a") - .rpush("mylist", "b") - .rpush("mylist", "c") - .exec(function (err, replies) { - if (err) throw err; - client.eval("local foo = redis.call('lrange','mylist',0,-1); return {type(foo),foo[1],foo[2],foo[3],# foo}", 0, function (err, res) { - assert.strictEqual(5, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("a", res[1], name); - assert.strictEqual("b", res[2], name); - assert.strictEqual("c", res[3], name); - assert.strictEqual(3, res[4], name); - }); - }); - // test {EVAL - Redis status reply -> Lua type conversion} - client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("OK", res[1], name); - }); - // test {EVAL - Redis error reply -> Lua type conversion} - client.set("error reply key", "error reply value", function (err, res) { - if (err) throw err; - client.eval("local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("table", res[0], name); - assert.strictEqual("ERR value is not an integer or out of range", res[1], name); - }); - }); - // test {EVAL - Redis nil bulk reply -> Lua type conversion} - client.del("nil reply key", function (err, res) { - if (err) throw err; - client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) { - if (err) throw err; - assert.strictEqual(2, res.length, name); - assert.strictEqual("boolean", res[0], name); - assert.strictEqual(1, res[1], name); - next(name); - }); - }); -}; - -tests.SCRIPT_LOAD = function() { - var name = "SCRIPT_LOAD", - command = "return 1", - commandSha = crypto.createHash('sha1').update(command).digest('hex'); - - if (!server_version_at_least(client, [2, 6, 0])) { - console.log("Skipping " + name + " for old Redis server version < 2.6.x"); - return next(name); - } - - bclient.script("load", command, function(err, result) { - assert.strictEqual(result.toString(), commandSha); - client.multi().script("load", command).exec(function(err, result) { - assert.strictEqual(result[0].toString(), commandSha); - client.multi([['script', 'load', command]]).exec(function(err, result) { - assert.strictEqual(result[0].toString(), commandSha); - next(name); - }); - }); - }); -}; - -tests.CLIENT_LIST = function() { - var name = "CLIENT_LIST"; - - if (!server_version_at_least(client, [2, 4, 0])) { - console.log("Skipping " + name + " for old Redis server version < 2.4.x"); - return next(name); - } - - function checkResult(result) { - var lines = result.toString().split('\n').slice(0, -1); - assert.strictEqual(lines.length, 4); - assert(lines.every(function(line) { - return line.match(/^addr=/); - })); - } - - bclient.client("list", function(err, result) { - console.log(result.toString()); - checkResult(result); - client.multi().client("list").exec(function(err, result) { - console.log(result.toString()); - checkResult(result); - client.multi([['client', 'list']]).exec(function(err, result) { - console.log(result.toString()); - checkResult(result); - next(name); - }); - }); - }); -}; - -tests.WATCH_MULTI = function () { - var name = 'WATCH_MULTI', multi; - if (!server_version_at_least(client, [2, 2, 0])) { - console.log("Skipping " + name + " for old Redis server version < 2.2.x"); - return next(name); - } - - client.watch(name); - client.incr(name); - multi = client.multi(); - multi.incr(name); - multi.exec(last(name, require_null(name))); -}; - -tests.WATCH_TRANSACTION = function () { - var name = "WATCH_TRANSACTION"; - - if (!server_version_at_least(client, [2, 1, 0])) { - console.log("Skipping " + name + " because server version isn't new enough."); - return next(name); - } - - // Test WATCH command aborting transactions, look for parser offset errors. - - client.set("unwatched", 200); - - client.set(name, 0); - client.watch(name); - client.incr(name); - var multi = client.multi() - .incr(name) - .exec(function (err, replies) { - // Failure expected because of pre-multi incr - assert.strictEqual(replies, null, "Aborted transaction multi-bulk reply should be null."); - - client.get("unwatched", function (err, reply) { - assert.equal(err, null, name); - assert.equal(reply, 200, "Expected 200, got " + reply); - next(name); - }); - }); - - client.set("unrelated", 100, function (err, reply) { - assert.equal(err, null, name); - assert.equal(reply, "OK", "Expected 'OK', got " + reply); - }); -}; - - -tests.detect_buffers = function () { - var name = "detect_buffers", detect_client = redis.createClient(null, null, {detect_buffers: true}); - - detect_client.on("ready", function () { - // single Buffer or String - detect_client.set("string key 1", "string value"); - detect_client.get("string key 1", require_string("string value", name)); - detect_client.get(new Buffer("string key 1"), function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Buffer.isBuffer(reply), name); - assert.strictEqual("", reply.inspect(), name); - }); - - detect_client.hmset("hash key 2", "key 1", "val 1", "key 2", "val 2"); - // array of Buffers or Strings - detect_client.hmget("hash key 2", "key 1", "key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Array.isArray(reply), name); - assert.strictEqual(2, reply.length, name); - assert.strictEqual("val 1", reply[0], name); - assert.strictEqual("val 2", reply[1], name); - }); - detect_client.hmget(new Buffer("hash key 2"), "key 1", "key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Array.isArray(reply)); - assert.strictEqual(2, reply.length, name); - assert.strictEqual(true, Buffer.isBuffer(reply[0])); - assert.strictEqual(true, Buffer.isBuffer(reply[1])); - assert.strictEqual("", reply[0].inspect(), name); - assert.strictEqual("", reply[1].inspect(), name); - }); - - // array of strings with undefined values (repro #344) - detect_client.hmget("hash key 2", "key 3", "key 4", function(err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual(true, Array.isArray(reply), name); - assert.strictEqual(2, reply.length, name); - assert.equal(null, reply[0], name); - assert.equal(null, reply[1], name); - }); - - // Object of Buffers or Strings - detect_client.hgetall("hash key 2", function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual("object", typeof reply, name); - assert.strictEqual(2, Object.keys(reply).length, name); - assert.strictEqual("val 1", reply["key 1"], name); - assert.strictEqual("val 2", reply["key 2"], name); - }); - detect_client.hgetall(new Buffer("hash key 2"), function (err, reply) { - assert.strictEqual(null, err, name); - assert.strictEqual("object", typeof reply, name); - assert.strictEqual(2, Object.keys(reply).length, name); - assert.strictEqual(true, Buffer.isBuffer(reply["key 1"])); - assert.strictEqual(true, Buffer.isBuffer(reply["key 2"])); - assert.strictEqual("", reply["key 1"].inspect(), name); - assert.strictEqual("", reply["key 2"].inspect(), name); - }); - - detect_client.quit(function (err, res) { - next(name); - }); - }); -}; - -tests.socket_nodelay = function () { - var name = "socket_nodelay", c1, c2, c3, ready_count = 0, quit_count = 0; - - c1 = redis.createClient(null, null, {socket_nodelay: true}); - c2 = redis.createClient(null, null, {socket_nodelay: false}); - c3 = redis.createClient(null, null); - - function quit_check() { - quit_count++; - - if (quit_count === 3) { - next(name); - } - } - - function run() { - assert.strictEqual(true, c1.options.socket_nodelay, name); - assert.strictEqual(false, c2.options.socket_nodelay, name); - assert.strictEqual(true, c3.options.socket_nodelay, name); - - c1.set(["set key 1", "set val"], require_string("OK", name)); - c1.set(["set key 2", "set val"], require_string("OK", name)); - c1.get(["set key 1"], require_string("set val", name)); - c1.get(["set key 2"], require_string("set val", name)); - - c2.set(["set key 3", "set val"], require_string("OK", name)); - c2.set(["set key 4", "set val"], require_string("OK", name)); - c2.get(["set key 3"], require_string("set val", name)); - c2.get(["set key 4"], require_string("set val", name)); - - c3.set(["set key 5", "set val"], require_string("OK", name)); - c3.set(["set key 6", "set val"], require_string("OK", name)); - c3.get(["set key 5"], require_string("set val", name)); - c3.get(["set key 6"], require_string("set val", name)); - - c1.quit(quit_check); - c2.quit(quit_check); - c3.quit(quit_check); - } - - function ready_check() { - ready_count++; - if (ready_count === 3) { - run(); - } - } - - c1.on("ready", ready_check); - c2.on("ready", ready_check); - c3.on("ready", ready_check); -}; - -tests.reconnect = function () { - var name = "reconnect"; - - client.set("recon 1", "one"); - client.set("recon 2", "two", function (err, res) { - // Do not do this in normal programs. This is to simulate the server closing on us. - // For orderly shutdown in normal programs, do client.quit() - client.stream.destroy(); - }); - - client.on("reconnecting", function on_recon(params) { - client.on("connect", function on_connect() { - client.select(test_db_num, require_string("OK", name)); - client.get("recon 1", require_string("one", name)); - client.get("recon 1", require_string("one", name)); - client.get("recon 2", require_string("two", name)); - client.get("recon 2", require_string("two", name)); - client.removeListener("connect", on_connect); - client.removeListener("reconnecting", on_recon); - next(name); - }); - }); -}; - -tests.reconnect_select_db_after_pubsub = function() { - var name = "reconnect_select_db_after_pubsub"; - - client.select(test_db_num); - client.set(name, "one"); - client.subscribe('ChannelV', function (err, res) { - client.stream.destroy(); - }); - - client.on("reconnecting", function on_recon(params) { - client.on("ready", function on_connect() { - client.unsubscribe('ChannelV', function (err, res) { - client.get(name, require_string("one", name)); - client.removeListener("connect", on_connect); - client.removeListener("reconnecting", on_recon); - next(name); - }); - }); - }); -}; - -tests.idle = function () { - var name = "idle"; - - client.on("idle", function on_idle() { - client.removeListener("idle", on_idle); - next(name); - }); - - client.set("idle", "test"); -}; - -tests.HSET = function () { - var key = "test hash", - field1 = new Buffer("0123456789"), - value1 = new Buffer("abcdefghij"), - field2 = new Buffer(0), - value2 = new Buffer(0), - name = "HSET"; - - client.HSET(key, field1, value1, require_number(1, name)); - client.HGET(key, field1, require_string(value1.toString(), name)); - - // Empty value - client.HSET(key, field1, value2, require_number(0, name)); - client.HGET([key, field1], require_string("", name)); - - // Empty key, empty value - client.HSET([key, field2, value1], require_number(1, name)); - client.HSET(key, field2, value2, last(name, require_number(0, name))); -}; - -tests.HLEN = function () { - var key = "test hash", - field1 = new Buffer("0123456789"), - value1 = new Buffer("abcdefghij"), - field2 = new Buffer(0), - value2 = new Buffer(0), - name = "HSET", - timeout = 1000; - - client.HSET(key, field1, value1, function (err, results) { - client.HLEN(key, function (err, len) { - assert.ok(2 === +len); - next(name); - }); - }); -} - -tests.HMSET_BUFFER_AND_ARRAY = function () { - // Saving a buffer and an array to the same key should not error - var key = "test hash", - field1 = "buffer", - value1 = new Buffer("abcdefghij"), - field2 = "array", - value2 = ["array contents"], - name = "HSET"; - - client.HMSET(key, field1, value1, field2, value2, last(name, require_string("OK", name))); -}; - -// TODO - add test for HMSET with optional callbacks - -tests.HMGET = function () { - var key1 = "test hash 1", key2 = "test hash 2", name = "HMGET"; - - // redis-like hmset syntax - client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value", require_string("OK", name)); - - // fancy hmset syntax - client.HMSET(key2, { - "0123456789": "abcdefghij", - "some manner of key": "a type of value" - }, require_string("OK", name)); - - client.HMGET(key1, "0123456789", "some manner of key", function (err, reply) { - assert.strictEqual("abcdefghij", reply[0].toString(), name); - assert.strictEqual("a type of value", reply[1].toString(), name); - }); - - client.HMGET(key2, "0123456789", "some manner of key", function (err, reply) { - assert.strictEqual("abcdefghij", reply[0].toString(), name); - assert.strictEqual("a type of value", reply[1].toString(), name); - }); - - client.HMGET(key1, ["0123456789"], function (err, reply) { - assert.strictEqual("abcdefghij", reply[0], name); - }); - - client.HMGET(key1, ["0123456789", "some manner of key"], function (err, reply) { - assert.strictEqual("abcdefghij", reply[0], name); - assert.strictEqual("a type of value", reply[1], name); - }); - - client.HMGET(key1, "missing thing", "another missing thing", function (err, reply) { - assert.strictEqual(null, reply[0], name); - assert.strictEqual(null, reply[1], name); - next(name); - }); -}; - -tests.HINCRBY = function () { - var name = "HINCRBY"; - client.hset("hash incr", "value", 10, require_number(1, name)); - client.HINCRBY("hash incr", "value", 1, require_number(11, name)); - client.HINCRBY("hash incr", "value 2", 1, last(name, require_number(1, name))); -}; - -tests.SUBSCRIBE = function () { - var client1 = client, msg_count = 0, name = "SUBSCRIBE"; - - client1.on("subscribe", function (channel, count) { - if (channel === "chan1") { - client2.publish("chan1", "message 1", require_number(1, name)); - client2.publish("chan2", "message 2", require_number(1, name)); - client2.publish("chan1", "message 3", require_number(1, name)); - } - }); - - client1.on("unsubscribe", function (channel, count) { - if (count === 0) { - // make sure this connection can go into and out of pub/sub mode - client1.incr("did a thing", last(name, require_number(2, name))); - } - }); - - client1.on("message", function (channel, message) { - msg_count += 1; - assert.strictEqual("message " + msg_count, message.toString()); - if (msg_count === 3) { - client1.unsubscribe("chan1", "chan2"); - } - }); - - client1.set("did a thing", 1, require_string("OK", name)); - client1.subscribe("chan1", "chan2", function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual("chan1", results.toString(), name); - }); -}; - -tests.SUB_UNSUB_SUB = function () { - var name = "SUB_UNSUB_SUB"; - client3.subscribe('chan3'); - client3.unsubscribe('chan3'); - client3.subscribe('chan3', function (err, results) { - assert.strictEqual(null, err, "unexpected error: " + err); - client2.publish('chan3', 'foo'); - }); - client3.on('message', function (channel, message) { - assert.strictEqual(channel, 'chan3'); - assert.strictEqual(message, 'foo'); - client3.removeAllListeners(); - next(name); - }); -}; - -tests.SUB_UNSUB_MSG_SUB = function () { - var name = "SUB_UNSUB_MSG_SUB"; - client3.subscribe('chan8'); - client3.subscribe('chan9'); - client3.unsubscribe('chan9'); - client2.publish('chan8', 'something'); - client3.subscribe('chan9', with_timeout(name, function (err, results) { - next(name); - }, 2000)); -}; - -tests.PSUB_UNSUB_PMSG_SUB = function () { - var name = "PSUB_UNSUB_PMSG_SUB"; - client3.psubscribe('abc*'); - client3.subscribe('xyz'); - client3.unsubscribe('xyz'); - client2.publish('abcd', 'something'); - client3.subscribe('xyz', with_timeout(name, function (err, results) { - next(name); - }, 2000)); -}; - -tests.SUBSCRIBE_QUIT = function () { - var name = "SUBSCRIBE_QUIT"; - client3.on("end", function () { - next(name); - }); - client3.on("subscribe", function (channel, count) { - client3.quit(); - }); - client3.subscribe("chan3"); -}; - -tests.SUBSCRIBE_CLOSE_RESUBSCRIBE = function () { - var name = "SUBSCRIBE_CLOSE_RESUBSCRIBE"; - var c1 = redis.createClient(); - var c2 = redis.createClient(); - var count = 0; - - /* Create two clients. c1 subscribes to two channels, c2 will publish to them. - c2 publishes the first message. - c1 gets the message and drops its connection. It must resubscribe itself. - When it resubscribes, c2 publishes the second message, on the same channel - c1 gets the message and drops its connection. It must resubscribe itself, again. - When it resubscribes, c2 publishes the third message, on the second channel - c1 gets the message and drops its connection. When it reconnects, the test ends. - */ - - c1.on("message", function(channel, message) { - if (channel === "chan1") { - assert.strictEqual(message, "hi on channel 1"); - c1.stream.end(); - - } else if (channel === "chan2") { - assert.strictEqual(message, "hi on channel 2"); - c1.stream.end(); - - } else { - c1.quit(); - c2.quit(); - assert.fail("test failed"); - } - }); - - c1.subscribe("chan1", "chan2"); - - c2.once("ready", function() { - console.log("c2 is ready"); - c1.on("ready", function(err, results) { - console.log("c1 is ready", count); - - count++; - if (count == 1) { - c2.publish("chan1", "hi on channel 1"); - return; - - } else if (count == 2) { - c2.publish("chan2", "hi on channel 2"); - - } else { - c1.quit(function() { - c2.quit(function() { - next(name); - }); - }); - } - }); - - c2.publish("chan1", "hi on channel 1"); - - }); -}; - -tests.EXISTS = function () { - var name = "EXISTS"; - client.del("foo", "foo2", require_number_any(name)); - client.set("foo", "bar", require_string("OK", name)); - client.EXISTS("foo", require_number(1, name)); - client.EXISTS("foo2", last(name, require_number(0, name))); -}; - -tests.DEL = function () { - var name = "DEL"; - client.DEL("delkey", require_number_any(name)); - client.set("delkey", "delvalue", require_string("OK", name)); - client.DEL("delkey", require_number(1, name)); - client.exists("delkey", require_number(0, name)); - client.DEL("delkey", require_number(0, name)); - client.mset("delkey", "delvalue", "delkey2", "delvalue2", require_string("OK", name)); - client.DEL("delkey", "delkey2", last(name, require_number(2, name))); -}; - -tests.TYPE = function () { - var name = "TYPE"; - client.set(["string key", "should be a string"], require_string("OK", name)); - client.rpush(["list key", "should be a list"], require_number_pos(name)); - client.sadd(["set key", "should be a set"], require_number_any(name)); - client.zadd(["zset key", "10.0", "should be a zset"], require_number_any(name)); - client.hset(["hash key", "hashtest", "should be a hash"], require_number_any(0, name)); - - client.TYPE(["string key"], require_string("string", name)); - client.TYPE(["list key"], require_string("list", name)); - client.TYPE(["set key"], require_string("set", name)); - client.TYPE(["zset key"], require_string("zset", name)); - client.TYPE("not here yet", require_string("none", name)); - client.TYPE(["hash key"], last(name, require_string("hash", name))); -}; - -tests.KEYS = function () { - var name = "KEYS"; - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name)); - client.KEYS(["test keys*"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(2, results.length, name); - assert.ok(~results.indexOf("test keys 1")); - assert.ok(~results.indexOf("test keys 2")); - next(name); - }); -}; - -tests.MULTIBULK = function() { - var name = "MULTIBULK", - keys_values = []; - - for (var i = 0; i < 200; i++) { - var key_value = [ - "multibulk:" + crypto.randomBytes(256).toString("hex"), // use long strings as keys to ensure generation of large packet - "test val " + i - ]; - keys_values.push(key_value); - } - - client.mset(keys_values.reduce(function(a, b) { - return a.concat(b); - }), require_string("OK", name)); - - client.KEYS("multibulk:*", function(err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.deepEqual(keys_values.map(function(val) { - return val[0]; - }).sort(), results.sort(), name); - }); - - next(name); -}; - -tests.MULTIBULK_ZERO_LENGTH = function () { - var name = "MULTIBULK_ZERO_LENGTH"; - client.KEYS(['users:*'], function (err, results) { - assert.strictEqual(null, err, 'error on empty multibulk reply'); - assert.strictEqual(true, is_empty_array(results), "not an empty array"); - next(name); - }); -}; - -tests.RANDOMKEY = function () { - var name = "RANDOMKEY"; - client.mset(["test keys 1", "test val 1", "test keys 2", "test val 2"], require_string("OK", name)); - client.RANDOMKEY([], function (err, results) { - assert.strictEqual(null, err, name + " result sent back unexpected error: " + err); - assert.strictEqual(true, /\w+/.test(results), name); - next(name); - }); -}; - -tests.RENAME = function () { - var name = "RENAME"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.RENAME(["foo", "new foo"], require_string("OK", name)); - client.exists(["foo"], require_number(0, name)); - client.exists(["new foo"], last(name, require_number(1, name))); -}; - -tests.RENAMENX = function () { - var name = "RENAMENX"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.set(['foo2', 'bar2'], require_string("OK", name)); - client.RENAMENX(["foo", "foo2"], require_number(0, name)); - client.exists(["foo"], require_number(1, name)); - client.exists(["foo2"], require_number(1, name)); - client.del(["foo2"], require_number(1, name)); - client.RENAMENX(["foo", "foo2"], require_number(1, name)); - client.exists(["foo"], require_number(0, name)); - client.exists(["foo2"], last(name, require_number(1, name))); -}; - -tests.DBSIZE = function () { - var name = "DBSIZE"; - client.set(['foo', 'bar'], require_string("OK", name)); - client.DBSIZE([], last(name, require_number_pos("DBSIZE"))); -}; - -tests.GET_1 = function () { - var name = "GET_1"; - client.set(["get key", "get val"], require_string("OK", name)); - client.GET(["get key"], last(name, require_string("get val", name))); -}; - -tests.GET_2 = function() { - var name = "GET_2"; - - // tests handling of non-existent keys - client.GET('this_key_shouldnt_exist', last(name, require_null(name))); -}; - -tests.SET = function () { - var name = "SET"; - client.SET(["set key", "set val"], require_string("OK", name)); - client.get(["set key"], last(name, require_string("set val", name))); - client.SET(["set key", undefined], require_error(name)); -}; - -tests.GETSET = function () { - var name = "GETSET"; - client.set(["getset key", "getset val"], require_string("OK", name)); - client.GETSET(["getset key", "new getset val"], require_string("getset val", name)); - client.get(["getset key"], last(name, require_string("new getset val", name))); -}; - -tests.MGET = function () { - var name = "MGET"; - client.mset(["mget keys 1", "mget val 1", "mget keys 2", "mget val 2", "mget keys 3", "mget val 3"], require_string("OK", name)); - client.MGET("mget keys 1", "mget keys 2", "mget keys 3", function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(3, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual("mget val 2", results[1].toString(), name); - assert.strictEqual("mget val 3", results[2].toString(), name); - }); - client.MGET(["mget keys 1", "mget keys 2", "mget keys 3"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(3, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual("mget val 2", results[1].toString(), name); - assert.strictEqual("mget val 3", results[2].toString(), name); - }); - client.MGET(["mget keys 1", "some random shit", "mget keys 2", "mget keys 3"], function (err, results) { - assert.strictEqual(null, err, "result sent back unexpected error: " + err); - assert.strictEqual(4, results.length, name); - assert.strictEqual("mget val 1", results[0].toString(), name); - assert.strictEqual(null, results[1], name); - assert.strictEqual("mget val 2", results[2].toString(), name); - assert.strictEqual("mget val 3", results[3].toString(), name); - next(name); - }); -}; - -tests.SETNX = function () { - var name = "SETNX"; - client.set(["setnx key", "setnx value"], require_string("OK", name)); - client.SETNX(["setnx key", "new setnx value"], require_number(0, name)); - client.del(["setnx key"], require_number(1, name)); - client.exists(["setnx key"], require_number(0, name)); - client.SETNX(["setnx key", "new setnx value"], require_number(1, name)); - client.exists(["setnx key"], last(name, require_number(1, name))); -}; - -tests.SETEX = function () { - var name = "SETEX"; - client.SETEX(["setex key", "100", "setex val"], require_string("OK", name)); - client.exists(["setex key"], require_number(1, name)); - client.ttl(["setex key"], last(name, require_number_pos(name))); - client.SETEX(["setex key", "100", undefined], require_error(name)); -}; - -tests.MSETNX = function () { - var name = "MSETNX"; - client.mset(["mset1", "val1", "mset2", "val2", "mset3", "val3"], require_string("OK", name)); - client.MSETNX(["mset3", "val3", "mset4", "val4"], require_number(0, name)); - client.del(["mset3"], require_number(1, name)); - client.MSETNX(["mset3", "val3", "mset4", "val4"], require_number(1, name)); - client.exists(["mset3"], require_number(1, name)); - client.exists(["mset4"], last(name, require_number(1, name))); -}; - -tests.HGETALL = function () { - var name = "HGETALL"; - client.hmset(["hosts", "mjr", "1", "another", "23", "home", "1234"], require_string("OK", name)); - client.HGETALL(["hosts"], function (err, obj) { - assert.strictEqual(null, err, name + " result sent back unexpected error: " + err); - assert.strictEqual(3, Object.keys(obj).length, name); - assert.strictEqual("1", obj.mjr.toString(), name); - assert.strictEqual("23", obj.another.toString(), name); - assert.strictEqual("1234", obj.home.toString(), name); - next(name); - }); -}; - -tests.HGETALL_NULL = function () { - var name = "HGETALL_NULL"; - - client.hgetall("missing", function (err, obj) { - assert.strictEqual(null, err); - assert.strictEqual(null, obj); - next(name); - }); -}; - -tests.UTF8 = function () { - var name = "UTF8", - utf8_sample = "ಠ_ಠ"; - - client.set(["utf8test", utf8_sample], require_string("OK", name)); - client.get(["utf8test"], function (err, obj) { - assert.strictEqual(null, err); - assert.strictEqual(utf8_sample, obj); - next(name); - }); -}; - -// Set tests were adapted from Brian Hammond's redis-node-client.js, which has a comprehensive test suite - -tests.SADD = function () { - var name = "SADD"; - - client.del('set0'); - client.SADD('set0', 'member0', require_number(1, name)); - client.sadd('set0', 'member0', last(name, require_number(0, name))); -}; - -tests.SADD2 = function () { - var name = "SADD2"; - - client.del("set0"); - client.sadd("set0", ["member0", "member1", "member2"], require_number(3, name)); - client.smembers("set0", function (err, res) { - assert.strictEqual(res.length, 3); - assert.ok(~res.indexOf("member0")); - assert.ok(~res.indexOf("member1")); - assert.ok(~res.indexOf("member2")); - }); - client.SADD("set1", ["member0", "member1", "member2"], require_number(3, name)); - client.smembers("set1", function (err, res) { - assert.strictEqual(res.length, 3); - assert.ok(~res.indexOf("member0")); - assert.ok(~res.indexOf("member1")); - assert.ok(~res.indexOf("member2")); - next(name); - }); -}; - -tests.SISMEMBER = function () { - var name = "SISMEMBER"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.sismember('set0', 'member0', require_number(1, name)); - client.sismember('set0', 'member1', last(name, require_number(0, name))); -}; - -tests.SCARD = function () { - var name = "SCARD"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.scard('set0', require_number(1, name)); - client.sadd('set0', 'member1', require_number(1, name)); - client.scard('set0', last(name, require_number(2, name))); -}; - -tests.SREM = function () { - var name = "SREM"; - - client.del('set0'); - client.sadd('set0', 'member0', require_number(1, name)); - client.srem('set0', 'foobar', require_number(0, name)); - client.srem('set0', 'member0', require_number(1, name)); - client.scard('set0', last(name, require_number(0, name))); -}; - -tests.SPOP = function () { - var name = "SPOP"; - - client.del('zzz'); - client.sadd('zzz', 'member0', require_number(1, name)); - client.scard('zzz', require_number(1, name)); - - client.spop('zzz', function (err, value) { - if (err) { - assert.fail(err); - } - assert.equal(value, 'member0', name); - }); - - client.scard('zzz', last(name, require_number(0, name))); -}; - -tests.SDIFF = function () { - var name = "SDIFF"; - - client.del('foo'); - client.sadd('foo', 'x', require_number(1, name)); - client.sadd('foo', 'a', require_number(1, name)); - client.sadd('foo', 'b', require_number(1, name)); - client.sadd('foo', 'c', require_number(1, name)); - - client.sadd('bar', 'c', require_number(1, name)); - - client.sadd('baz', 'a', require_number(1, name)); - client.sadd('baz', 'd', require_number(1, name)); - - client.sdiff('foo', 'bar', 'baz', function (err, values) { - if (err) { - assert.fail(err, name); - } - values.sort(); - assert.equal(values.length, 2, name); - assert.equal(values[0], 'b', name); - assert.equal(values[1], 'x', name); - next(name); - }); -}; - -tests.SDIFFSTORE = function () { - var name = "SDIFFSTORE"; - - client.del('foo'); - client.del('bar'); - client.del('baz'); - client.del('quux'); - - client.sadd('foo', 'x', require_number(1, name)); - client.sadd('foo', 'a', require_number(1, name)); - client.sadd('foo', 'b', require_number(1, name)); - client.sadd('foo', 'c', require_number(1, name)); - - client.sadd('bar', 'c', require_number(1, name)); - - client.sadd('baz', 'a', require_number(1, name)); - client.sadd('baz', 'd', require_number(1, name)); - - // NB: SDIFFSTORE returns the number of elements in the dstkey - - client.sdiffstore('quux', 'foo', 'bar', 'baz', require_number(2, name)); - - client.smembers('quux', function (err, values) { - if (err) { - assert.fail(err, name); - } - var members = buffers_to_strings(values).sort(); - - assert.deepEqual(members, [ 'b', 'x' ], name); - next(name); - }); -}; - -tests.SMEMBERS = function () { - var name = "SMEMBERS"; - - client.del('foo'); - client.sadd('foo', 'x', require_number(1, name)); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(members), [ 'x' ], name); - }); - - client.sadd('foo', 'y', require_number(1, name)); - - client.smembers('foo', function (err, values) { - if (err) { - assert.fail(err, name); - } - assert.equal(values.length, 2, name); - var members = buffers_to_strings(values).sort(); - - assert.deepEqual(members, [ 'x', 'y' ], name); - next(name); - }); -}; - -tests.SMOVE = function () { - var name = "SMOVE"; - - client.del('foo'); - client.del('bar'); - - client.sadd('foo', 'x', require_number(1, name)); - client.smove('foo', 'bar', 'x', require_number(1, name)); - client.sismember('foo', 'x', require_number(0, name)); - client.sismember('bar', 'x', require_number(1, name)); - client.smove('foo', 'bar', 'x', last(name, require_number(0, name))); -}; - -tests.SINTER = function () { - var name = "SINTER"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sinter('sa', 'sb', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 2, name); - assert.deepEqual(buffers_to_strings(intersection).sort(), [ 'b', 'c' ], name); - }); - - client.sinter('sb', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 2, name); - assert.deepEqual(buffers_to_strings(intersection).sort(), [ 'c', 'd' ], name); - }); - - client.sinter('sa', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 1, name); - assert.equal(intersection[0], 'c', name); - }); - - // 3-way - - client.sinter('sa', 'sb', 'sc', function (err, intersection) { - if (err) { - assert.fail(err, name); - } - assert.equal(intersection.length, 1, name); - assert.equal(intersection[0], 'c', name); - next(name); - }); -}; - -tests.SINTERSTORE = function () { - var name = "SINTERSTORE"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - client.del('foo'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sinterstore('foo', 'sa', 'sb', 'sc', require_number(1, name)); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(members), [ 'c' ], name); - next(name); - }); -}; - -tests.SUNION = function () { - var name = "SUNION"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sunion('sa', 'sb', 'sc', function (err, union) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(union).sort(), ['a', 'b', 'c', 'd', 'e'], name); - next(name); - }); -}; - -tests.SUNIONSTORE = function () { - var name = "SUNIONSTORE"; - - client.del('sa'); - client.del('sb'); - client.del('sc'); - client.del('foo'); - - client.sadd('sa', 'a', require_number(1, name)); - client.sadd('sa', 'b', require_number(1, name)); - client.sadd('sa', 'c', require_number(1, name)); - - client.sadd('sb', 'b', require_number(1, name)); - client.sadd('sb', 'c', require_number(1, name)); - client.sadd('sb', 'd', require_number(1, name)); - - client.sadd('sc', 'c', require_number(1, name)); - client.sadd('sc', 'd', require_number(1, name)); - client.sadd('sc', 'e', require_number(1, name)); - - client.sunionstore('foo', 'sa', 'sb', 'sc', function (err, cardinality) { - if (err) { - assert.fail(err, name); - } - assert.equal(cardinality, 5, name); - }); - - client.smembers('foo', function (err, members) { - if (err) { - assert.fail(err, name); - } - assert.equal(members.length, 5, name); - assert.deepEqual(buffers_to_strings(members).sort(), ['a', 'b', 'c', 'd', 'e'], name); - next(name); - }); -}; - -// SORT test adapted from Brian Hammond's redis-node-client.js, which has a comprehensive test suite - -tests.SORT = function () { - var name = "SORT"; - - client.del('y'); - client.del('x'); - - client.rpush('y', 'd', require_number(1, name)); - client.rpush('y', 'b', require_number(2, name)); - client.rpush('y', 'a', require_number(3, name)); - client.rpush('y', 'c', require_number(4, name)); - - client.rpush('x', '3', require_number(1, name)); - client.rpush('x', '9', require_number(2, name)); - client.rpush('x', '2', require_number(3, name)); - client.rpush('x', '4', require_number(4, name)); - - client.set('w3', '4', require_string("OK", name)); - client.set('w9', '5', require_string("OK", name)); - client.set('w2', '12', require_string("OK", name)); - client.set('w4', '6', require_string("OK", name)); - - client.set('o2', 'buz', require_string("OK", name)); - client.set('o3', 'foo', require_string("OK", name)); - client.set('o4', 'baz', require_string("OK", name)); - client.set('o9', 'bar', require_string("OK", name)); - - client.set('p2', 'qux', require_string("OK", name)); - client.set('p3', 'bux', require_string("OK", name)); - client.set('p4', 'lux', require_string("OK", name)); - client.set('p9', 'tux', require_string("OK", name)); - - // Now the data has been setup, we can test. - - // But first, test basic sorting. - - // y = [ d b a c ] - // sort y ascending = [ a b c d ] - // sort y descending = [ d c b a ] - - client.sort('y', 'asc', 'alpha', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['a', 'b', 'c', 'd'], name); - }); - - client.sort('y', 'desc', 'alpha', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['d', 'c', 'b', 'a'], name); - }); - - // Now try sorting numbers in a list. - // x = [ 3, 9, 2, 4 ] - - client.sort('x', 'asc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [2, 3, 4, 9], name); - }); - - client.sort('x', 'desc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [9, 4, 3, 2], name); - }); - - // Try sorting with a 'by' pattern. - - client.sort('x', 'by', 'w*', 'asc', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), [3, 9, 4, 2], name); - }); - - // Try sorting with a 'by' pattern and 1 'get' pattern. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['foo', 'bar', 'baz', 'buz'], name); - }); - - // Try sorting with a 'by' pattern and 2 'get' patterns. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', 'get', 'p*', function (err, sorted) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(sorted), ['foo', 'bux', 'bar', 'tux', 'baz', 'lux', 'buz', 'qux'], name); - }); - - // Try sorting with a 'by' pattern and 2 'get' patterns. - // Instead of getting back the sorted set/list, store the values to a list. - // Then check that the values are there in the expected order. - - client.sort('x', 'by', 'w*', 'asc', 'get', 'o*', 'get', 'p*', 'store', 'bacon', function (err) { - if (err) { - assert.fail(err, name); - } - }); - - client.lrange('bacon', 0, -1, function (err, values) { - if (err) { - assert.fail(err, name); - } - assert.deepEqual(buffers_to_strings(values), ['foo', 'bux', 'bar', 'tux', 'baz', 'lux', 'buz', 'qux'], name); - next(name); - }); - - // TODO - sort by hash value -}; - -tests.MONITOR = function () { - var name = "MONITOR", responses = [], monitor_client; - - if (!server_version_at_least(client, [2, 6, 0])) { - console.log("Skipping " + name + " for old Redis server version < 2.6.x"); - return next(name); - } - - monitor_client = redis.createClient(); - monitor_client.monitor(function (err, res) { - client.mget("some", "keys", "foo", "bar"); - client.set("json", JSON.stringify({ - foo: "123", - bar: "sdflkdfsjk", - another: false - })); - }); - monitor_client.on("monitor", function (time, args) { - // skip monitor command for Redis <= 2.4.16 - if (args[0] === "monitor") return; - - responses.push(args); - if (responses.length === 2) { - assert.strictEqual(5, responses[0].length); - assert.strictEqual("mget", responses[0][0]); - assert.strictEqual("some", responses[0][1]); - assert.strictEqual("keys", responses[0][2]); - assert.strictEqual("foo", responses[0][3]); - assert.strictEqual("bar", responses[0][4]); - assert.strictEqual(3, responses[1].length); - assert.strictEqual("set", responses[1][0]); - assert.strictEqual("json", responses[1][1]); - assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]); - monitor_client.quit(function (err, res) { - next(name); - }); - } - }); -}; - -tests.BLPOP = function () { - var name = "BLPOP"; - - client.rpush("blocking list", "initial value", function (err, res) { - client2.BLPOP("blocking list", 0, function (err, res) { - assert.strictEqual("blocking list", res[0].toString()); - assert.strictEqual("initial value", res[1].toString()); - - client.rpush("blocking list", "wait for this value"); - }); - client2.BLPOP("blocking list", 0, function (err, res) { - assert.strictEqual("blocking list", res[0].toString()); - assert.strictEqual("wait for this value", res[1].toString()); - next(name); - }); - }); -}; - -tests.BLPOP_TIMEOUT = function () { - var name = "BLPOP_TIMEOUT"; - - // try to BLPOP the list again, which should be empty. This should timeout and return null. - client2.BLPOP("blocking list", 1, function (err, res) { - if (err) { - throw err; - } - - assert.strictEqual(res, null); - next(name); - }); -}; - -tests.EXPIRE = function () { - var name = "EXPIRE"; - client.set(['expiry key', 'bar'], require_string("OK", name)); - client.EXPIRE(["expiry key", "1"], require_number_pos(name)); - setTimeout(function () { - client.exists(["expiry key"], last(name, require_number(0, name))); - }, 2000); -}; - -tests.TTL = function () { - var name = "TTL"; - client.set(["ttl key", "ttl val"], require_string("OK", name)); - client.expire(["ttl key", "100"], require_number_pos(name)); - setTimeout(function () { - client.TTL(["ttl key"], last(name, require_number_pos(0, name))); - }, 500); -}; - -tests.OPTIONAL_CALLBACK = function () { - var name = "OPTIONAL_CALLBACK"; - client.del("op_cb1"); - client.set("op_cb1", "x"); - client.get("op_cb1", last(name, require_string("x", name))); -}; - -tests.OPTIONAL_CALLBACK_UNDEFINED = function () { - var name = "OPTIONAL_CALLBACK_UNDEFINED"; - client.del("op_cb2"); - client.set("op_cb2", "y", undefined); - client.get("op_cb2", last(name, require_string("y", name))); -}; - -tests.ENABLE_OFFLINE_QUEUE_TRUE = function () { - var name = "ENABLE_OFFLINE_QUEUE_TRUE"; - var cli = redis.createClient(9999, null, { - max_attempts: 1 - // default :) - // enable_offline_queue: true - }); - cli.on('error', function(e) { - // ignore, b/c expecting a "can't connect" error - }); - return setTimeout(function() { - cli.set(name, name, function(err, result) { - assert.ifError(err); - }); - - return setTimeout(function(){ - assert.strictEqual(cli.offline_queue.length, 1); - return next(name); - }, 25); - }, 50); -}; - -tests.ENABLE_OFFLINE_QUEUE_FALSE = function () { - var name = "ENABLE_OFFLINE_QUEUE_FALSE"; - var cli = redis.createClient(9999, null, { - max_attempts: 1, - enable_offline_queue: false - }); - cli.on('error', function() { - // ignore, see above - }); - assert.throws(function () { - cli.set(name, name) - }) - assert.doesNotThrow(function () { - cli.set(name, name, function (err) { - // should callback with an error - assert.ok(err); - setTimeout(function () { - next(name); - }, 50); - }); - }); -}; - -tests.SLOWLOG = function () { - var name = "SLOWLOG"; - client.config("set", "slowlog-log-slower-than", 0, require_string("OK", name)); - client.slowlog("reset", require_string("OK", name)); - client.set("foo", "bar", require_string("OK", name)); - client.get("foo", require_string("bar", name)); - client.slowlog("get", function (err, res) { - assert.equal(res.length, 3, name); - assert.equal(res[0][3].length, 2, name); - assert.deepEqual(res[1][3], ["set", "foo", "bar"], name); - assert.deepEqual(res[2][3], ["slowlog", "reset"], name); - client.config("set", "slowlog-log-slower-than", 10000, require_string("OK", name)); - next(name); - }); -} - -// TODO - need a better way to test auth, maybe auto-config a local Redis server or something. -// Yes, this is the real password. Please be nice, thanks. -tests.auth = function () { - var name = "AUTH", client4, ready_count = 0; - - client4 = redis.createClient(9006, "filefish.redistogo.com"); - client4.auth("664b1b6aaf134e1ec281945a8de702a9", function (err, res) { - assert.strictEqual(null, err, name); - assert.strictEqual("OK", res.toString(), name); - }); - - // test auth, then kill the connection so it'll auto-reconnect and auto-re-auth - client4.on("ready", function () { - ready_count++; - if (ready_count === 1) { - client4.stream.destroy(); - } else { - client4.quit(function (err, res) { - next(name); - }); - } - }); -}; - -tests.reconnectRetryMaxDelay = function() { - var time = new Date().getTime(), - name = 'reconnectRetryMaxDelay', - reconnecting = false; - var client = redis.createClient(PORT, HOST, { - retry_max_delay: 1 - }); - client.on('ready', function() { - if (!reconnecting) { - reconnecting = true; - client.retry_delay = 1000; - client.retry_backoff = 1; - client.stream.end(); - } else { - client.end(); - var lasted = new Date().getTime() - time; - assert.ok(lasted < 1000); - next(name); - } - }); -}; - -all_tests = Object.keys(tests); -all_start = new Date(); -test_count = 0; - -run_next_test = function run_next_test() { - var test_name = all_tests.shift(); - if (typeof tests[test_name] === "function") { - util.print('- \x1b[1m' + test_name.toLowerCase() + '\x1b[0m:'); - cur_start = new Date(); - test_count += 1; - tests[test_name](); - } else { - console.log('\n completed \x1b[32m%d\x1b[0m tests in \x1b[33m%d\x1b[0m ms\n', test_count, new Date() - all_start); - client.quit(); - client2.quit(); - bclient.quit(); - } -}; - -client.once("ready", function start_tests() { - console.log("Connected to " + client.host + ":" + client.port + ", Redis server version " + client.server_info.redis_version + "\n"); - console.log("Using reply parser " + client.reply_parser.name); - - run_next_test(); - - connected = true; -}); - -client.on('end', function () { - ended = true; -}); - -// Exit immediately on connection failure, which triggers "exit", below, which fails the test -client.on("error", function (err) { - console.error("client: " + err.stack); - process.exit(); -}); -client2.on("error", function (err) { - console.error("client2: " + err.stack); - process.exit(); -}); -client3.on("error", function (err) { - console.error("client3: " + err.stack); - process.exit(); -}); -bclient.on("error", function (err) { - console.error("bclient: " + err.stack); - process.exit(); -}); - -client.on("reconnecting", function (params) { - console.log("reconnecting: " + util.inspect(params)); -}); - -process.on('uncaughtException', function (err) { - console.error("Uncaught exception: " + err.stack); - process.exit(1); -}); - -process.on('exit', function (code) { - assert.equal(true, connected); - assert.equal(true, ended); -}); diff --git a/node_modules/socket.io/.npmignore b/node_modules/socket.io/.npmignore deleted file mode 100644 index 39e9864f5a..0000000000 --- a/node_modules/socket.io/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -support -test -examples diff --git a/node_modules/socket.io/.travis.yml b/node_modules/socket.io/.travis.yml deleted file mode 100644 index 56eca033cd..0000000000 --- a/node_modules/socket.io/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - 0.6 - -notifications: - irc: "irc.freenode.org#socket.io" diff --git a/node_modules/socket.io/History.md b/node_modules/socket.io/History.md deleted file mode 100644 index 4f57fa3150..0000000000 --- a/node_modules/socket.io/History.md +++ /dev/null @@ -1,315 +0,0 @@ - -0.9.14 / 2013-03-29 -=================== - - * manager: fix memory leak with SSL [jpallen] - -0.9.13 / 2012-12-13 -=================== - - * package: fixed `base64id` requirement - -0.9.12 / 2012-12-13 -=================== - - * manager: fix for latest node which is returning a clone with `listeners` [viirya] - -0.9.11 / 2012-11-02 -=================== - - * package: move redis to optionalDependenices [3rd-Eden] - * bumped client - -0.9.10 / 2012-08-10 -=================== - - * Don't lowercase log messages - * Always set the HTTP response in case an error should be returned to the client - * Create or destroy the flash policy server on configuration change - * Honour configuration to disable flash policy server - * Add express 3.0 instructions on Readme.md - * Bump client - -0.9.9 / 2012-08-01 -================== - - * Fixed sync disconnect xhrs handling - * Put license text in its own file (#965) - * Add warning to .listen() to ease the migration to Express 3.x - * Restored compatibility with node 0.4.x - -0.9.8 / 2012-07-24 -================== - - * Bumped client. - -0.9.7 / 2012-07-24 -================== - - * Prevent crash when socket leaves a room twice. - * Corrects unsafe usage of for..in - * Fix for node 0.8 with `gzip compression` [vadimi] - * Update redis to support Node 0.8.x - * Made ID generation securely random - * Fix Redis Store race condition in manager onOpen unsubscribe callback - * Fix for EventEmitters always reusing the same Array instance for listeners - -0.9.6 / 2012-04-17 -================== - - * Fixed XSS in jsonp-polling. - -0.9.5 / 2012-04-05 -================== - - * Added test for polling and socket close. - * Ensure close upon request close. - * Fix disconnection reason being lost for polling transports. - * Ensure that polling transports work with Connection: close. - * Log disconnection reason. - -0.9.4 / 2012-04-01 -================== - - * Disconnecting from namespace improvement (#795) [DanielBaulig] - * Bumped client with polling reconnection loop (#438) - -0.9.3 / 2012-03-28 -================== - - * Fix "Syntax error" on FF Web Console with XHR Polling [mikito] - -0.9.2 / 2012-03-13 -================== - - * More sensible close `timeout default` (fixes disconnect issue) - -0.9.1-1 / 2012-03-02 -==================== - - * Bumped client with NPM dependency fix. - -0.9.1 / 2012-03-02 -================== - - * Changed heartbeat timeout and interval defaults (60 and 25 seconds) - * Make tests work both on 0.4 and 0.6 - * Updated client (improvements + bug fixes). - -0.9.0 / 2012-02-26 -================== - - * Make it possible to use a regexp to match the socket.io resource URL. - We need this because we have to prefix the socket.io URL with a variable ID. - * Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports - * Updated express dep for windows compatibility. - * Combine two substr calls into one in decodePayload to improve performance - * Minor documentation fix - * Minor. Conform to style of other files. - * Switching setting to 'match origin protocol' - * Revert "Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect()." - * Revert "Handle leaked dispatch:[id] subscription." - * Merge pull request #667 from dshaw/patch/redis-disconnect - * Handle leaked dispatch:[id] subscription. - * Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect(). - * Prevent memory leaking on uncompleted requests & add max post size limitation - * Fix for testcase - * Set Access-Control-Allow-Credentials true, regardless of cookie - * Remove assertvarnish from package as it breaks on 0.6 - * Correct irc channel - * Added proper return after reserved field error - * Fixes manager.js failure to close connection after transport error has happened - * Added implicit port 80 for origin checks. fixes #638 - * Fixed bug #432 in 0.8.7 - * Set Access-Control-Allow-Origin header to origin to enable withCredentials - * Adding configuration variable matchOriginProtocol - * Fixes location mismatch error in Safari. - * Use tty to detect if we should add colors or not by default. - * Updated the package location. - -0.8.7 / 2011-11-05 -================== - - * Fixed memory leaks in closed clients. - * Fixed memory leaks in namespaces. - * Fixed websocket handling for malformed requests from proxies. [einaros] - * Node 0.6 compatibility. [einaros] [3rd-Eden] - * Adapted tests and examples. - -0.8.6 / 2011-10-27 -================== - - * Added JSON decoding on jsonp-polling transport. - * Fixed README example. - * Major speed optimizations [3rd-Eden] [einaros] [visionmedia] - * Added decode/encode benchmarks [visionmedia] - * Added support for black-listing client sent events. - * Fixed logging options, closes #540 [3rd-Eden] - * Added vary header for gzip [3rd-Eden] - * Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client - * Patched to properly shut down when a finishClose call is made during connection establishment - * Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify] - * Began IE10 compatibility [einaros] [tbranyen] - * Misc WebSocket fixes [einaros] - * Added UTF8 to respone headers for htmlfile [3rd-Eden] - -0.8.5 / 2011-10-07 -================== - - * Added websocket draft HyBi-16 support. [einaros] - * Fixed websocket continuation bugs. [einaros] - * Fixed flashsocket transport name. - * Fixed websocket tests. - * Ensured `parser#decodePayload` doesn't choke. - * Added http referrer verification to manager verifyOrigin. - * Added access control for cross domain xhr handshakes [3rd-Eden] - * Added support for automatic generation of socket.io files [3rd-Eden] - * Added websocket binary support [einaros] - * Added gzip support for socket.io.js [3rd-Eden] - * Expose socket.transport [3rd-Eden] - * Updated client. - -0.8.4 / 2011-09-06 -================== - - * Client build - -0.8.3 / 2011-09-03 -================== - - * Fixed `\n` parsing for non-JSON packets (fixes #479). - * Fixed parsing of certain unicode characters (fixes #451). - * Fixed transport message packet logging. - * Fixed emission of `error` event resulting in an uncaught exception if unhandled (fixes #476). - * Fixed; allow for falsy values as the configuration value of `log level` (fixes #491). - * Fixed repository URI in `package.json`. Fixes #504. - * Added text/plain content-type to handshake responses [einaros] - * Improved single byte writes [einaros] - * Updated socket.io-flashsocket default port from 843 to 10843 [3rd-Eden] - * Updated client. - -0.8.2 / 2011-08-29 -================== - - * Updated client. - -0.8.1 / 2011-08-29 -================== - - * Fixed utf8 bug in send framing in websocket [einaros] - * Fixed typo in docs [Znarkus] - * Fixed bug in send framing for over 64kB of data in websocket [einaros] - * Corrected ping handling in websocket transport [einaros] - -0.8.0 / 2011-08-28 -================== - - * Updated to work with two-level websocket versioning. [einaros] - * Added hybi07 support. [einaros] - * Added hybi10 support. [einaros] - * Added http referrer verification to manager.js verifyOrigin. [einaors] - -0.7.11 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.10 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.9 / 2011-08-12 -================== - - * Updated socket.io-client. - * Make sure we only do garbage collection when the server we receive is actually run. - -0.7.8 / 2011-08-08 -================== - - * Changed; make sure sio#listen passes options to both HTTP server and socket.io manager. - * Added docs for sio#listen. - * Added options parameter support for Manager constructor. - * Added memory leaks tests and test-leaks Makefile task. - * Removed auto npm-linking from make test. - * Make sure that you can disable heartbeats. [3rd-Eden] - * Fixed rooms memory leak [3rd-Eden] - * Send response once we got all POST data, not immediately [Pita] - * Fixed onLeave behavior with missing clientsk [3rd-Eden] - * Prevent duplicate references in rooms. - * Added alias for `to` to `in` and `in` to `to`. - * Fixed roomClients definition. - * Removed dependency on redis for installation without npm [3rd-Eden] - * Expose path and querystring in handshakeData [3rd-Eden] - -0.7.7 / 2011-07-12 -================== - - * Fixed double dispatch handling with emit to closed clients. - * Added test for emitting to closed clients to prevent regression. - * Fixed race condition in redis test. - * Changed Transport#end instrumentation. - * Leveraged $emit instead of emit internally. - * Made tests faster. - * Fixed double disconnect events. - * Fixed disconnect logic - * Simplified remote events handling in Socket. - * Increased testcase timeout. - * Fixed unknown room emitting (GH-291). [3rd-Eden] - * Fixed `address` in handshakeData. [3rd-Eden] - * Removed transports definition in chat example. - * Fixed room cleanup - * Fixed; make sure the client is cleaned up after booting. - * Make sure to mark the client as non-open if the connection is closed. - * Removed unneeded `buffer` declarations. - * Fixed; make sure to clear socket handlers and subscriptions upon transport close. - -0.7.6 / 2011-06-30 -================== - - * Fixed general dispatching when a client has closed. - -0.7.5 / 2011-06-30 -================== - - * Fixed dispatching to clients that are disconnected. - -0.7.4 / 2011-06-30 -================== - - * Fixed; only clear handlers if they were set. [level09] - -0.7.3 / 2011-06-30 -================== - - * Exposed handshake data to clients. - * Refactored dispatcher interface. - * Changed; Moved id generation method into the manager. - * Added sub-namespace authorization. [3rd-Eden] - * Changed; normalized SocketNamespace local eventing [dvv] - * Changed; Use packet.reason or default to 'packet' [3rd-Eden] - * Changed console.error to console.log. - * Fixed; bind both servers at the same time do that the test never times out. - * Added 304 support. - * Removed `Transport#name` for abstract interface. - * Changed; lazily require http and https module only when needed. [3rd-Eden] - -0.7.2 / 2011-06-22 -================== - - * Make sure to write a packet (of type `noop`) when closing a poll. - This solves a problem with cross-domain requests being flagged as aborted and - reconnection being triggered. - * Added `noop` message type. - -0.7.1 / 2011-06-21 -================== - - * Fixed cross-domain XHR. - * Added CORS test to xhr-polling suite. - -0.7.0 / 2010-06-21 -================== - - * http://socket.io/announcement.html diff --git a/node_modules/socket.io/LICENSE b/node_modules/socket.io/LICENSE deleted file mode 100644 index 0f4acd44d7..0000000000 --- a/node_modules/socket.io/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch - -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/socket.io/Makefile b/node_modules/socket.io/Makefile deleted file mode 100644 index 832cba8bdb..0000000000 --- a/node_modules/socket.io/Makefile +++ /dev/null @@ -1,31 +0,0 @@ - -ALL_TESTS = $(shell find test/ -name '*.test.js') -ALL_BENCH = $(shell find benchmarks -name '*.bench.js') - -run-tests: - @./node_modules/.bin/expresso \ - -t 3000 \ - -I support \ - --serial \ - $(TESTFLAGS) \ - $(TESTS) - -test: - @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests - -test-cov: - @TESTFLAGS=--cov $(MAKE) test - -test-leaks: - @ls test/leaks/* | xargs node --expose_debug_as=debug --expose_gc - -run-bench: - @node $(PROFILEFLAGS) benchmarks/runner.js - -bench: - @$(MAKE) BENCHMARKS="$(ALL_BENCH)" run-bench - -profile: - @PROFILEFLAGS='--prof --trace-opt --trace-bailout --trace-deopt' $(MAKE) bench - -.PHONY: test bench profile diff --git a/node_modules/socket.io/Readme.md b/node_modules/socket.io/Readme.md deleted file mode 100644 index 41f21f6814..0000000000 --- a/node_modules/socket.io/Readme.md +++ /dev/null @@ -1,364 +0,0 @@ -# Socket.IO - -Socket.IO is a Node.JS project that makes WebSockets and realtime possible in -all browsers. It also enhances WebSockets by providing built-in multiplexing, -horizontal scalability, automatic JSON encoding/decoding, and more. - -## How to Install - -```bash -npm install socket.io -``` - -## How to use - -First, require `socket.io`: - -```js -var io = require('socket.io'); -``` - -Next, attach it to a HTTP/HTTPS server. If you're using the fantastic `express` -web framework: - -#### Express 3.x - -```js -var app = express() - , server = require('http').createServer(app) - , io = io.listen(server); - -server.listen(80); - -io.sockets.on('connection', function (socket) { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', function (data) { - console.log(data); - }); -}); -``` - -#### Express 2.x - -```js -var app = express.createServer() - , io = io.listen(app); - -app.listen(80); - -io.sockets.on('connection', function (socket) { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', function (data) { - console.log(data); - }); -}); -``` - -Finally, load it from the client side code: - -```html - - -``` - -For more thorough examples, look at the `examples/` directory. - -## Short recipes - -### Sending and receiving events. - -Socket.IO allows you to emit and receive custom events. -Besides `connect`, `message` and `disconnect`, you can emit custom events: - -```js -// note, io.listen() will create a http server for you -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - io.sockets.emit('this', { will: 'be received by everyone' }); - - socket.on('private message', function (from, msg) { - console.log('I received a private message by ', from, ' saying ', msg); - }); - - socket.on('disconnect', function () { - io.sockets.emit('user disconnected'); - }); -}); -``` - -### Storing data associated to a client - -Sometimes it's necessary to store data associated with a client that's -necessary for the duration of the session. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('set nickname', function (name) { - socket.set('nickname', name, function () { socket.emit('ready'); }); - }); - - socket.on('msg', function () { - socket.get('nickname', function (err, name) { - console.log('Chat message by ', name); - }); - }); -}); -``` - -#### Client side - -```html - -``` - -### Restricting yourself to a namespace - -If you have control over all the messages and events emitted for a particular -application, using the default `/` namespace works. - -If you want to leverage 3rd-party code, or produce code to share with others, -socket.io provides a way of namespacing a `socket`. - -This has the benefit of `multiplexing` a single connection. Instead of -socket.io using two `WebSocket` connections, it'll use one. - -The following example defines a socket that listens on '/chat' and one for -'/news': - -#### Server side - -```js -var io = require('socket.io').listen(80); - -var chat = io - .of('/chat') - .on('connection', function (socket) { - socket.emit('a message', { that: 'only', '/chat': 'will get' }); - chat.emit('a message', { everyone: 'in', '/chat': 'will get' }); - }); - -var news = io - .of('/news'); - .on('connection', function (socket) { - socket.emit('item', { news: 'item' }); - }); -``` - -#### Client side: - -```html - -``` - -### Sending volatile messages. - -Sometimes certain messages can be dropped. Let's say you have an app that -shows realtime tweets for the keyword `bieber`. - -If a certain client is not ready to receive messages (because of network slowness -or other issues, or because he's connected through long polling and is in the -middle of a request-response cycle), if he doesn't receive ALL the tweets related -to bieber your application won't suffer. - -In that case, you might want to send those messages as volatile messages. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - var tweets = setInterval(function () { - getBieberTweet(function (tweet) { - socket.volatile.emit('bieber tweet', tweet); - }); - }, 100); - - socket.on('disconnect', function () { - clearInterval(tweets); - }); -}); -``` - -#### Client side - -In the client side, messages are received the same way whether they're volatile -or not. - -### Getting acknowledgements - -Sometimes, you might want to get a callback when the client confirmed the message -reception. - -To do this, simply pass a function as the last parameter of `.send` or `.emit`. -What's more, when you use `.emit`, the acknowledgement is done by you, which -means you can also pass data along: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('ferret', function (name, fn) { - fn('woot'); - }); -}); -``` - -#### Client side - -```html - -``` - -### Broadcasting messages - -To broadcast, simply add a `broadcast` flag to `emit` and `send` method calls. -Broadcasting means sending a message to everyone else except for the socket -that starts it. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.broadcast.emit('user connected'); - socket.broadcast.json.send({ a: 'message' }); -}); -``` - -### Rooms - -Sometimes you want to put certain sockets in the same room, so that it's easy -to broadcast to all of them together. - -Think of this as built-in channels for sockets. Sockets `join` and `leave` -rooms in each socket. - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.join('justin bieber fans'); - socket.broadcast.to('justin bieber fans').emit('new fan'); - io.sockets.in('rammstein fans').emit('new non-fan'); -}); -``` - -### Using it just as a cross-browser WebSocket - -If you just want the WebSocket semantics, you can do that too. -Simply leverage `send` and listen on the `message` event: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.sockets.on('connection', function (socket) { - socket.on('message', function () { }); - socket.on('disconnect', function () { }); -}); -``` - -#### Client side - -```html - -``` - -### Changing configuration - -Configuration in socket.io is TJ-style: - -#### Server side - -```js -var io = require('socket.io').listen(80); - -io.configure(function () { - io.set('transports', ['websocket', 'flashsocket', 'xhr-polling']); -}); - -io.configure('development', function () { - io.set('transports', ['websocket', 'xhr-polling']); - io.enable('log'); -}); -``` - -## License - -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.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/socket.io/TODO b/node_modules/socket.io/TODO deleted file mode 100644 index cc74adcead..0000000000 --- a/node_modules/socket.io/TODO +++ /dev/null @@ -1 +0,0 @@ -- Serve .swf client for engine.io diff --git a/node_modules/socket.io/benchmarks/decode.bench.js b/node_modules/socket.io/benchmarks/decode.bench.js deleted file mode 100644 index 4855d805ef..0000000000 --- a/node_modules/socket.io/benchmarks/decode.bench.js +++ /dev/null @@ -1,64 +0,0 @@ - -/** - * Module dependencies. - */ - -var benchmark = require('benchmark') - , colors = require('colors') - , io = require('../') - , parser = io.parser - , suite = new benchmark.Suite('Decode packet'); - -suite.add('string', function () { - parser.decodePacket('4:::"2"'); -}); - -suite.add('event', function () { - parser.decodePacket('5:::{"name":"woot"}'); -}); - -suite.add('event+ack', function () { - parser.decodePacket('5:1+::{"name":"tobi"}'); -}); - -suite.add('event+data', function () { - parser.decodePacket('5:::{"name":"edwald","args":[{"a": "b"},2,"3"]}'); -}); - -suite.add('heartbeat', function () { - parser.decodePacket('2:::'); -}); - -suite.add('error', function () { - parser.decodePacket('7:::2+0'); -}); - -var payload = parser.encodePayload([ - parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) -]); - -suite.add('payload', function () { - parser.decodePayload(payload); -}); - -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)); -}); - -if (!module.parent) { - suite.run(); -} else { - module.exports = suite; -} diff --git a/node_modules/socket.io/benchmarks/encode.bench.js b/node_modules/socket.io/benchmarks/encode.bench.js deleted file mode 100644 index 5037702d31..0000000000 --- a/node_modules/socket.io/benchmarks/encode.bench.js +++ /dev/null @@ -1,90 +0,0 @@ - -/** - * Module dependencies. - */ - -var benchmark = require('benchmark') - , colors = require('colors') - , io = require('../') - , parser = io.parser - , suite = new benchmark.Suite('Encode packet'); - -suite.add('string', function () { - parser.encodePacket({ - type: 'json' - , endpoint: '' - , data: '2' - }); -}); - -suite.add('event', function () { - parser.encodePacket({ - type: 'event' - , name: 'woot' - , endpoint: '' - , args: [] - }); -}); - -suite.add('event+ack', function () { - parser.encodePacket({ - type: 'json' - , id: 1 - , ack: 'data' - , endpoint: '' - , data: { a: 'b' } - }); -}); - -suite.add('event+data', function () { - parser.encodePacket({ - type: 'event' - , name: 'edwald' - , endpoint: '' - , args: [{a: 'b'}, 2, '3'] - }); -}); - -suite.add('heartbeat', function () { - parser.encodePacket({ - type: 'heartbeat' - , endpoint: '' - }) -}); - -suite.add('error', function () { - parser.encodePacket({ - type: 'error' - , reason: 'unauthorized' - , advice: 'reconnect' - , endpoint: '' - }) -}) - -suite.add('payload', function () { - parser.encodePayload([ - parser.encodePacket({ type: 'message', data: '5', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: '53d', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbazfoobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobarbaz', endpoint: '' }) - , parser.encodePacket({ type: 'message', data: 'foobar', endpoint: '' }) - ]); -}); - -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)); -}); - -if (!module.parent) { - suite.run(); -} else { - module.exports = suite; -} diff --git a/node_modules/socket.io/benchmarks/runner.js b/node_modules/socket.io/benchmarks/runner.js deleted file mode 100644 index 81e55cae43..0000000000 --- a/node_modules/socket.io/benchmarks/runner.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Benchmark runner dependencies - */ - -var colors = require('colors') - , path = require('path'); - -/** - * Find all the benchmarks - */ - -var benchmarks_files = process.env.BENCHMARKS.split(' ') - , all = [].concat(benchmarks_files) - , first = all.shift() - , benchmarks = {}; - -// find the benchmarks and load them all in our obj -benchmarks_files.forEach(function (file) { - benchmarks[file] = require(path.join(__dirname, '..', file)); -}); - -// setup the complete listeners -benchmarks_files.forEach(function (file) { - var benchmark = benchmarks[file] - , next_file = all.shift() - , next = benchmarks[next_file]; - - /** - * Generate a oncomplete function for the tests, either we are done or we - * have more benchmarks to process. - */ - - function complete () { - if (!next) { - console.log( - '\n\nBenchmark completed in'.grey - , (Date.now() - start).toString().green + ' ms'.grey - ); - } else { - console.log('\nStarting benchmark '.grey + next_file.yellow); - next.run(); - } - } - - // attach the listener - benchmark.on('complete', complete); -}); - -/** - * Start the benchmark - */ - -var start = Date.now(); -console.log('Starting benchmark '.grey + first.yellow); -benchmarks[first].run(); diff --git a/node_modules/socket.io/index.js b/node_modules/socket.io/index.js deleted file mode 100644 index cc00c103e2..0000000000 --- a/node_modules/socket.io/index.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -module.exports = require('./lib/socket.io'); diff --git a/node_modules/socket.io/lib/logger.js b/node_modules/socket.io/lib/logger.js deleted file mode 100644 index 49d02c98df..0000000000 --- a/node_modules/socket.io/lib/logger.js +++ /dev/null @@ -1,97 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var util = require('./util') - , toArray = util.toArray; - -/** - * Log levels. - */ - -var levels = [ - 'error' - , 'warn' - , 'info' - , 'debug' -]; - -/** - * Colors for log levels. - */ - -var colors = [ - 31 - , 33 - , 36 - , 90 -]; - -/** - * Pads the nice output to the longest log level. - */ - -function pad (str) { - var max = 0; - - for (var i = 0, l = levels.length; i < l; i++) - max = Math.max(max, levels[i].length); - - if (str.length < max) - return str + new Array(max - str.length + 1).join(' '); - - return str; -}; - -/** - * Logger (console). - * - * @api public - */ - -var Logger = module.exports = function (opts) { - opts = opts || {} - this.colors = false !== opts.colors; - this.level = 3; - this.enabled = true; -}; - -/** - * Log method. - * - * @api public - */ - -Logger.prototype.log = function (type) { - var index = levels.indexOf(type); - - if (index > this.level || !this.enabled) - return this; - - console.log.apply( - console - , [this.colors - ? ' \033[' + colors[index] + 'm' + pad(type) + ' -\033[39m' - : type + ':' - ].concat(toArray(arguments).slice(1)) - ); - - return this; -}; - -/** - * Generate methods. - */ - -levels.forEach(function (name) { - Logger.prototype[name] = function () { - this.log.apply(this, [name].concat(toArray(arguments))); - }; -}); diff --git a/node_modules/socket.io/lib/manager.js b/node_modules/socket.io/lib/manager.js deleted file mode 100644 index 83937853f5..0000000000 --- a/node_modules/socket.io/lib/manager.js +++ /dev/null @@ -1,1027 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , url = require('url') - , tty = require('tty') - , crypto = require('crypto') - , util = require('./util') - , store = require('./store') - , client = require('socket.io-client') - , transports = require('./transports') - , Logger = require('./logger') - , Socket = require('./socket') - , MemoryStore = require('./stores/memory') - , SocketNamespace = require('./namespace') - , Static = require('./static') - , EventEmitter = process.EventEmitter; - -/** - * Export the constructor. - */ - -exports = module.exports = Manager; - -/** - * Default transports. - */ - -var defaultTransports = exports.defaultTransports = [ - 'websocket' - , 'htmlfile' - , 'xhr-polling' - , 'jsonp-polling' -]; - -/** - * Inherited defaults. - */ - -var parent = module.parent.exports - , protocol = parent.protocol - , jsonpolling_re = /^\d+$/; - -/** - * Manager constructor. - * - * @param {HTTPServer} server - * @param {Object} options, optional - * @api public - */ - -function Manager (server, options) { - this.server = server; - this.namespaces = {}; - this.sockets = this.of(''); - this.settings = { - origins: '*:*' - , log: true - , store: new MemoryStore - , logger: new Logger - , static: new Static(this) - , heartbeats: true - , resource: '/socket.io' - , transports: defaultTransports - , authorization: false - , blacklist: ['disconnect'] - , 'log level': 3 - , 'log colors': tty.isatty(process.stdout.fd) - , 'close timeout': 60 - , 'heartbeat interval': 25 - , 'heartbeat timeout': 60 - , 'polling duration': 20 - , 'flash policy server': true - , 'flash policy port': 10843 - , 'destroy upgrade': true - , 'destroy buffer size': 10E7 - , 'browser client': true - , 'browser client cache': true - , 'browser client minification': false - , 'browser client etag': false - , 'browser client expires': 315360000 - , 'browser client gzip': false - , 'browser client handler': false - , 'client store expiration': 15 - , 'match origin protocol': false - }; - - for (var i in options) { - if (options.hasOwnProperty(i)) { - this.settings[i] = options[i]; - } - } - - var self = this; - - // default error handler - server.on('error', function(err) { - self.log.warn('error raised: ' + err); - }); - - this.initStore(); - - this.on('set:store', function() { - self.initStore(); - }); - - // reset listeners - this.oldListeners = server.listeners('request').splice(0); - server.removeAllListeners('request'); - - server.on('request', function (req, res) { - self.handleRequest(req, res); - }); - - server.on('upgrade', function (req, socket, head) { - self.handleUpgrade(req, socket, head); - }); - - server.on('close', function () { - clearInterval(self.gc); - }); - - server.once('listening', function () { - self.gc = setInterval(self.garbageCollection.bind(self), 10000); - }); - - for (var i in transports) { - if (transports.hasOwnProperty(i)) { - if (transports[i].init) { - transports[i].init(this); - } - } - } - - // forward-compatibility with 1.0 - var self = this; - this.sockets.on('connection', function (conn) { - self.emit('connection', conn); - }); - - this.sequenceNumber = Date.now() | 0; - - this.log.info('socket.io started'); -}; - -Manager.prototype.__proto__ = EventEmitter.prototype - -/** - * Store accessor shortcut. - * - * @api public - */ - -Manager.prototype.__defineGetter__('store', function () { - var store = this.get('store'); - store.manager = this; - return store; -}); - -/** - * Logger accessor. - * - * @api public - */ - -Manager.prototype.__defineGetter__('log', function () { - var logger = this.get('logger'); - - logger.level = this.get('log level') || -1; - logger.colors = this.get('log colors'); - logger.enabled = this.enabled('log'); - - return logger; -}); - -/** - * Static accessor. - * - * @api public - */ - -Manager.prototype.__defineGetter__('static', function () { - return this.get('static'); -}); - -/** - * Get settings. - * - * @api public - */ - -Manager.prototype.get = function (key) { - return this.settings[key]; -}; - -/** - * Set settings - * - * @api public - */ - -Manager.prototype.set = function (key, value) { - if (arguments.length == 1) return this.get(key); - this.settings[key] = value; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Enable a setting - * - * @api public - */ - -Manager.prototype.enable = function (key) { - this.settings[key] = true; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Disable a setting - * - * @api public - */ - -Manager.prototype.disable = function (key) { - this.settings[key] = false; - this.emit('set:' + key, this.settings[key], key); - return this; -}; - -/** - * Checks if a setting is enabled - * - * @api public - */ - -Manager.prototype.enabled = function (key) { - return !!this.settings[key]; -}; - -/** - * Checks if a setting is disabled - * - * @api public - */ - -Manager.prototype.disabled = function (key) { - return !this.settings[key]; -}; - -/** - * Configure callbacks. - * - * @api public - */ - -Manager.prototype.configure = function (env, fn) { - if ('function' == typeof env) { - env.call(this); - } else if (env == (process.env.NODE_ENV || 'development')) { - fn.call(this); - } - - return this; -}; - -/** - * Initializes everything related to the message dispatcher. - * - * @api private - */ - -Manager.prototype.initStore = function () { - this.handshaken = {}; - this.connected = {}; - this.open = {}; - this.closed = {}; - this.rooms = {}; - this.roomClients = {}; - - var self = this; - - this.store.subscribe('handshake', function (id, data) { - self.onHandshake(id, data); - }); - - this.store.subscribe('connect', function (id) { - self.onConnect(id); - }); - - this.store.subscribe('open', function (id) { - self.onOpen(id); - }); - - this.store.subscribe('join', function (id, room) { - self.onJoin(id, room); - }); - - this.store.subscribe('leave', function (id, room) { - self.onLeave(id, room); - }); - - this.store.subscribe('close', function (id) { - self.onClose(id); - }); - - this.store.subscribe('dispatch', function (room, packet, volatile, exceptions) { - self.onDispatch(room, packet, volatile, exceptions); - }); - - this.store.subscribe('disconnect', function (id) { - self.onDisconnect(id); - }); -}; - -/** - * Called when a client handshakes. - * - * @param text - */ - -Manager.prototype.onHandshake = function (id, data) { - this.handshaken[id] = data; -}; - -/** - * Called when a client connects (ie: transport first opens) - * - * @api private - */ - -Manager.prototype.onConnect = function (id) { - this.connected[id] = true; -}; - -/** - * Called when a client opens a request in a different node. - * - * @api private - */ - -Manager.prototype.onOpen = function (id) { - this.open[id] = true; - - if (this.closed[id]) { - var self = this; - - this.store.unsubscribe('dispatch:' + id, function () { - var transport = self.transports[id]; - if (self.closed[id] && self.closed[id].length && transport) { - - // if we have buffered messages that accumulate between calling - // onOpen an this async callback, send them if the transport is - // still open, otherwise leave them buffered - if (transport.open) { - transport.payload(self.closed[id]); - self.closed[id] = []; - } - } - }); - } - - // clear the current transport - if (this.transports[id]) { - this.transports[id].discard(); - this.transports[id] = null; - } -}; - -/** - * Called when a message is sent to a namespace and/or room. - * - * @api private - */ - -Manager.prototype.onDispatch = function (room, packet, volatile, exceptions) { - if (this.rooms[room]) { - for (var i = 0, l = this.rooms[room].length; i < l; i++) { - var id = this.rooms[room][i]; - - if (!~exceptions.indexOf(id)) { - if (this.transports[id] && this.transports[id].open) { - this.transports[id].onDispatch(packet, volatile); - } else if (!volatile) { - this.onClientDispatch(id, packet); - } - } - } - } -}; - -/** - * Called when a client joins a nsp / room. - * - * @api private - */ - -Manager.prototype.onJoin = function (id, name) { - if (!this.roomClients[id]) { - this.roomClients[id] = {}; - } - - if (!this.rooms[name]) { - this.rooms[name] = []; - } - - if (!~this.rooms[name].indexOf(id)) { - this.rooms[name].push(id); - this.roomClients[id][name] = true; - } -}; - -/** - * Called when a client leaves a nsp / room. - * - * @param private - */ - -Manager.prototype.onLeave = function (id, room) { - if (this.rooms[room]) { - var index = this.rooms[room].indexOf(id); - - if (index >= 0) { - this.rooms[room].splice(index, 1); - } - - if (!this.rooms[room].length) { - delete this.rooms[room]; - } - - if (this.roomClients[id]) { - delete this.roomClients[id][room]; - } - } -}; - -/** - * Called when a client closes a request in different node. - * - * @api private - */ - -Manager.prototype.onClose = function (id) { - if (this.open[id]) { - delete this.open[id]; - } - - this.closed[id] = []; - - var self = this; - - this.store.subscribe('dispatch:' + id, function (packet, volatile) { - if (!volatile) { - self.onClientDispatch(id, packet); - } - }); -}; - -/** - * Dispatches a message for a closed client. - * - * @api private - */ - -Manager.prototype.onClientDispatch = function (id, packet) { - if (this.closed[id]) { - this.closed[id].push(packet); - } -}; - -/** - * Receives a message for a client. - * - * @api private - */ - -Manager.prototype.onClientMessage = function (id, packet) { - if (this.namespaces[packet.endpoint]) { - this.namespaces[packet.endpoint].handlePacket(id, packet); - } -}; - -/** - * Fired when a client disconnects (not triggered). - * - * @api private - */ - -Manager.prototype.onClientDisconnect = function (id, reason) { - for (var name in this.namespaces) { - if (this.namespaces.hasOwnProperty(name)) { - this.namespaces[name].handleDisconnect(id, reason, typeof this.roomClients[id] !== 'undefined' && - typeof this.roomClients[id][name] !== 'undefined'); - } - } - - this.onDisconnect(id); -}; - -/** - * Called when a client disconnects. - * - * @param text - */ - -Manager.prototype.onDisconnect = function (id, local) { - delete this.handshaken[id]; - - if (this.open[id]) { - delete this.open[id]; - } - - if (this.connected[id]) { - delete this.connected[id]; - } - - if (this.transports[id]) { - this.transports[id].discard(); - delete this.transports[id]; - } - - if (this.closed[id]) { - delete this.closed[id]; - } - - if (this.roomClients[id]) { - for (var room in this.roomClients[id]) { - if (this.roomClients[id].hasOwnProperty(room)) { - this.onLeave(id, room); - } - } - delete this.roomClients[id] - } - - this.store.destroyClient(id, this.get('client store expiration')); - - this.store.unsubscribe('dispatch:' + id); - - if (local) { - this.store.unsubscribe('message:' + id); - this.store.unsubscribe('disconnect:' + id); - } -}; - -/** - * Handles an HTTP request. - * - * @api private - */ - -Manager.prototype.handleRequest = function (req, res) { - var data = this.checkRequest(req); - - if (!data) { - for (var i = 0, l = this.oldListeners.length; i < l; i++) { - this.oldListeners[i].call(this.server, req, res); - } - - return; - } - - if (data.static || !data.transport && !data.protocol) { - if (data.static && this.enabled('browser client')) { - this.static.write(data.path, req, res); - } else { - res.writeHead(200); - res.end('Welcome to socket.io.'); - - this.log.info('unhandled socket.io url'); - } - - return; - } - - if (data.protocol != protocol) { - res.writeHead(500); - res.end('Protocol version not supported.'); - - this.log.info('client protocol version unsupported'); - } else { - if (data.id) { - this.handleHTTPRequest(data, req, res); - } else { - this.handleHandshake(data, req, res); - } - } -}; - -/** - * Handles an HTTP Upgrade. - * - * @api private - */ - -Manager.prototype.handleUpgrade = function (req, socket, head) { - var data = this.checkRequest(req) - , self = this; - - if (!data) { - if (this.enabled('destroy upgrade')) { - socket.end(); - this.log.debug('destroying non-socket.io upgrade'); - } - - return; - } - - req.head = head; - this.handleClient(data, req); - req.head = null; -}; - -/** - * Handles a normal handshaken HTTP request (eg: long-polling) - * - * @api private - */ - -Manager.prototype.handleHTTPRequest = function (data, req, res) { - req.res = res; - this.handleClient(data, req); -}; - -/** - * Intantiantes a new client. - * - * @api private - */ - -Manager.prototype.handleClient = function (data, req) { - var socket = req.socket - , store = this.store - , self = this; - - // handle sync disconnect xhrs - if (undefined != data.query.disconnect) { - if (this.transports[data.id] && this.transports[data.id].open) { - this.transports[data.id].onForcedDisconnect(); - } else { - this.store.publish('disconnect-force:' + data.id); - } - req.res.writeHead(200); - req.res.end(); - return; - } - - if (!~this.get('transports').indexOf(data.transport)) { - this.log.warn('unknown transport: "' + data.transport + '"'); - req.connection.end(); - return; - } - - var transport = new transports[data.transport](this, data, req) - , handshaken = this.handshaken[data.id]; - - if (transport.disconnected) { - // failed during transport setup - req.connection.end(); - return; - } - if (handshaken) { - if (transport.open) { - if (this.closed[data.id] && this.closed[data.id].length) { - transport.payload(this.closed[data.id]); - this.closed[data.id] = []; - } - - this.onOpen(data.id); - this.store.publish('open', data.id); - this.transports[data.id] = transport; - } - - if (!this.connected[data.id]) { - this.onConnect(data.id); - this.store.publish('connect', data.id); - - // flag as used - delete handshaken.issued; - this.onHandshake(data.id, handshaken); - this.store.publish('handshake', data.id, handshaken); - - // initialize the socket for all namespaces - for (var i in this.namespaces) { - if (this.namespaces.hasOwnProperty(i)) { - var socket = this.namespaces[i].socket(data.id, true); - - // echo back connect packet and fire connection event - if (i === '') { - this.namespaces[i].handlePacket(data.id, { type: 'connect' }); - } - } - } - - this.store.subscribe('message:' + data.id, function (packet) { - self.onClientMessage(data.id, packet); - }); - - this.store.subscribe('disconnect:' + data.id, function (reason) { - self.onClientDisconnect(data.id, reason); - }); - } - } else { - if (transport.open) { - transport.error('client not handshaken', 'reconnect'); - } - - transport.discard(); - } -}; - -/** - * Generates a session id. - * - * @api private - */ - -Manager.prototype.generateId = function () { - var rand = new Buffer(15); // multiple of 3 for base64 - if (!rand.writeInt32BE) { - return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString() - + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString(); - } - this.sequenceNumber = (this.sequenceNumber + 1) | 0; - rand.writeInt32BE(this.sequenceNumber, 11); - if (crypto.randomBytes) { - crypto.randomBytes(12).copy(rand); - } else { - // not secure for node 0.4 - [0, 4, 8].forEach(function(i) { - rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i); - }); - } - return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-'); -}; - -/** - * Handles a handshake request. - * - * @api private - */ - -Manager.prototype.handleHandshake = function (data, req, res) { - var self = this - , origin = req.headers.origin - , headers = { - 'Content-Type': 'text/plain' - }; - - function writeErr (status, message) { - if (data.query.jsonp && jsonpolling_re.test(data.query.jsonp)) { - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - res.end('io.j[' + data.query.jsonp + '](new Error("' + message + '"));'); - } else { - res.writeHead(status, headers); - res.end(message); - } - }; - - function error (err) { - writeErr(500, 'handshake error'); - self.log.warn('handshake error ' + err); - }; - - if (!this.verifyOrigin(req)) { - writeErr(403, 'handshake bad origin'); - return; - } - - var handshakeData = this.handshakeData(data); - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - - this.authorize(handshakeData, function (err, authorized, newData) { - if (err) return error(err); - - if (authorized) { - var id = self.generateId() - , hs = [ - id - , self.enabled('heartbeats') ? self.get('heartbeat timeout') || '' : '' - , self.get('close timeout') || '' - , self.transports(data).join(',') - ].join(':'); - - if (data.query.jsonp && jsonpolling_re.test(data.query.jsonp)) { - hs = 'io.j[' + data.query.jsonp + '](' + JSON.stringify(hs) + ');'; - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - } else { - res.writeHead(200, headers); - } - - res.end(hs); - - self.onHandshake(id, newData || handshakeData); - self.store.publish('handshake', id, newData || handshakeData); - - self.log.info('handshake authorized', id); - } else { - writeErr(403, 'handshake unauthorized'); - self.log.info('handshake unauthorized'); - } - }) -}; - -/** - * Gets normalized handshake data - * - * @api private - */ - -Manager.prototype.handshakeData = function (data) { - var connection = data.request.connection - , connectionAddress - , date = new Date; - - if (connection.remoteAddress) { - connectionAddress = { - address: connection.remoteAddress - , port: connection.remotePort - }; - } else if (connection.socket && connection.socket.remoteAddress) { - connectionAddress = { - address: connection.socket.remoteAddress - , port: connection.socket.remotePort - }; - } - - return { - headers: data.headers - , address: connectionAddress - , time: date.toString() - , query: data.query - , url: data.request.url - , xdomain: !!data.request.headers.origin - , secure: data.request.connection.secure - , issued: +date - }; -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -Manager.prototype.verifyOrigin = function (request) { - var origin = request.headers.origin || request.headers.referer - , origins = this.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from handshake, yet required by config'); - } - return false; -}; - -/** - * Handles an incoming packet. - * - * @api private - */ - -Manager.prototype.handlePacket = function (sessid, packet) { - this.of(packet.endpoint || '').handlePacket(sessid, packet); -}; - -/** - * Performs authentication. - * - * @param Object client request data - * @api private - */ - -Manager.prototype.authorize = function (data, fn) { - if (this.get('authorization')) { - var self = this; - - this.get('authorization').call(this, data, function (err, authorized) { - self.log.debug('client ' + authorized ? 'authorized' : 'unauthorized'); - fn(err, authorized); - }); - } else { - this.log.debug('client authorized'); - fn(null, true); - } - - return this; -}; - -/** - * Retrieves the transports adviced to the user. - * - * @api private - */ - -Manager.prototype.transports = function (data) { - var transp = this.get('transports') - , ret = []; - - for (var i = 0, l = transp.length; i < l; i++) { - var transport = transp[i]; - - if (transport) { - if (!transport.checkClient || transport.checkClient(data)) { - ret.push(transport); - } - } - } - - return ret; -}; - -/** - * Checks whether a request is a socket.io one. - * - * @return {Object} a client request data object or `false` - * @api private - */ - -var regexp = /^\/([^\/]+)\/?([^\/]+)?\/?([^\/]+)?\/?$/ - -Manager.prototype.checkRequest = function (req) { - var resource = this.get('resource'); - - var match; - if (typeof resource === 'string') { - match = req.url.substr(0, resource.length); - if (match !== resource) match = null; - } else { - match = resource.exec(req.url); - if (match) match = match[0]; - } - - if (match) { - var uri = url.parse(req.url.substr(match.length), true) - , path = uri.pathname || '' - , pieces = path.match(regexp); - - // client request data - var data = { - query: uri.query || {} - , headers: req.headers - , request: req - , path: path - }; - - if (pieces) { - data.protocol = Number(pieces[1]); - data.transport = pieces[2]; - data.id = pieces[3]; - data.static = !!this.static.has(path); - }; - - return data; - } - - return false; -}; - -/** - * Declares a socket namespace - * - * @api public - */ - -Manager.prototype.of = function (nsp) { - if (this.namespaces[nsp]) { - return this.namespaces[nsp]; - } - - return this.namespaces[nsp] = new SocketNamespace(this, nsp); -}; - -/** - * Perform garbage collection on long living objects and properties that cannot - * be removed automatically. - * - * @api private - */ - -Manager.prototype.garbageCollection = function () { - // clean up unused handshakes - var ids = Object.keys(this.handshaken) - , i = ids.length - , now = Date.now() - , handshake; - - while (i--) { - handshake = this.handshaken[ids[i]]; - - if ('issued' in handshake && (now - handshake.issued) >= 3E4) { - this.onDisconnect(ids[i]); - } - } -}; diff --git a/node_modules/socket.io/lib/namespace.js b/node_modules/socket.io/lib/namespace.js deleted file mode 100644 index 6e1e1c927b..0000000000 --- a/node_modules/socket.io/lib/namespace.js +++ /dev/null @@ -1,355 +0,0 @@ -/** - * Module dependencies. - */ - -var Socket = require('./socket') - , EventEmitter = process.EventEmitter - , parser = require('./parser') - , util = require('./util'); - -/** - * Exports the constructor. - */ - -exports = module.exports = SocketNamespace; - -/** - * Constructor. - * - * @api public. - */ - -function SocketNamespace (mgr, name) { - this.manager = mgr; - this.name = name || ''; - this.sockets = {}; - this.auth = false; - this.setFlags(); -}; - -/** - * Inherits from EventEmitter. - */ - -SocketNamespace.prototype.__proto__ = EventEmitter.prototype; - -/** - * Copies emit since we override it. - * - * @api private - */ - -SocketNamespace.prototype.$emit = EventEmitter.prototype.emit; - -/** - * Retrieves all clients as Socket instances as an array. - * - * @api public - */ - -SocketNamespace.prototype.clients = function (room) { - var room = this.name + (room !== undefined ? - '/' + room : ''); - - if (!this.manager.rooms[room]) { - return []; - } - - return this.manager.rooms[room].map(function (id) { - return this.socket(id); - }, this); -}; - -/** - * Access logger interface. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * Access store. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('store', function () { - return this.manager.store; -}); - -/** - * JSON message flag. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('json', function () { - this.flags.json = true; - return this; -}); - -/** - * Volatile message flag. - * - * @api public - */ - -SocketNamespace.prototype.__defineGetter__('volatile', function () { - this.flags.volatile = true; - return this; -}); - -/** - * Overrides the room to relay messages to (flag). - * - * @api public - */ - -SocketNamespace.prototype.in = SocketNamespace.prototype.to = function (room) { - this.flags.endpoint = this.name + (room ? '/' + room : ''); - return this; -}; - -/** - * Adds a session id we should prevent relaying messages to (flag). - * - * @api public - */ - -SocketNamespace.prototype.except = function (id) { - this.flags.exceptions.push(id); - return this; -}; - -/** - * Sets the default flags. - * - * @api private - */ - -SocketNamespace.prototype.setFlags = function () { - this.flags = { - endpoint: this.name - , exceptions: [] - }; - return this; -}; - -/** - * Sends out a packet. - * - * @api private - */ - -SocketNamespace.prototype.packet = function (packet) { - packet.endpoint = this.name; - - var store = this.store - , log = this.log - , volatile = this.flags.volatile - , exceptions = this.flags.exceptions - , packet = parser.encodePacket(packet); - - this.manager.onDispatch(this.flags.endpoint, packet, volatile, exceptions); - this.store.publish('dispatch', this.flags.endpoint, packet, volatile, exceptions); - - this.setFlags(); - - return this; -}; - -/** - * Sends to everyone. - * - * @api public - */ - -SocketNamespace.prototype.send = function (data) { - return this.packet({ - type: this.flags.json ? 'json' : 'message' - , data: data - }); -}; - -/** - * Emits to everyone (override). - * - * @api public - */ - -SocketNamespace.prototype.emit = function (name) { - if (name == 'newListener') { - return this.$emit.apply(this, arguments); - } - - return this.packet({ - type: 'event' - , name: name - , args: util.toArray(arguments).slice(1) - }); -}; - -/** - * Retrieves or creates a write-only socket for a client, unless specified. - * - * @param {Boolean} whether the socket will be readable when initialized - * @api public - */ - -SocketNamespace.prototype.socket = function (sid, readable) { - if (!this.sockets[sid]) { - this.sockets[sid] = new Socket(this.manager, sid, this, readable); - } - - return this.sockets[sid]; -}; - -/** - * Sets authorization for this namespace. - * - * @api public - */ - -SocketNamespace.prototype.authorization = function (fn) { - this.auth = fn; - return this; -}; - -/** - * Called when a socket disconnects entirely. - * - * @api private - */ - -SocketNamespace.prototype.handleDisconnect = function (sid, reason, raiseOnDisconnect) { - if (this.sockets[sid] && this.sockets[sid].readable) { - if (raiseOnDisconnect) this.sockets[sid].onDisconnect(reason); - delete this.sockets[sid]; - } -}; - -/** - * Performs authentication. - * - * @param Object client request data - * @api private - */ - -SocketNamespace.prototype.authorize = function (data, fn) { - if (this.auth) { - var self = this; - - this.auth.call(this, data, function (err, authorized) { - self.log.debug('client ' + - (authorized ? '' : 'un') + 'authorized for ' + self.name); - fn(err, authorized); - }); - } else { - this.log.debug('client authorized for ' + this.name); - fn(null, true); - } - - return this; -}; - -/** - * Handles a packet. - * - * @api private - */ - -SocketNamespace.prototype.handlePacket = function (sessid, packet) { - var socket = this.socket(sessid) - , dataAck = packet.ack == 'data' - , manager = this.manager - , self = this; - - function ack () { - self.log.debug('sending data ack packet'); - socket.packet({ - type: 'ack' - , args: util.toArray(arguments) - , ackId: packet.id - }); - }; - - function error (err) { - self.log.warn('handshake error ' + err + ' for ' + self.name); - socket.packet({ type: 'error', reason: err }); - }; - - function connect () { - self.manager.onJoin(sessid, self.name); - self.store.publish('join', sessid, self.name); - - // packet echo - socket.packet({ type: 'connect' }); - - // emit connection event - self.$emit('connection', socket); - }; - - switch (packet.type) { - case 'connect': - if (packet.endpoint == '') { - connect(); - } else { - var handshakeData = manager.handshaken[sessid]; - - this.authorize(handshakeData, function (err, authorized, newData) { - if (err) return error(err); - - if (authorized) { - manager.onHandshake(sessid, newData || handshakeData); - self.store.publish('handshake', sessid, newData || handshakeData); - connect(); - } else { - error('unauthorized'); - } - }); - } - break; - - case 'ack': - if (socket.acks[packet.ackId]) { - socket.acks[packet.ackId].apply(socket, packet.args); - } else { - this.log.info('unknown ack packet'); - } - break; - - case 'event': - // check if the emitted event is not blacklisted - if (-~manager.get('blacklist').indexOf(packet.name)) { - this.log.debug('ignoring blacklisted event `' + packet.name + '`'); - } else { - var params = [packet.name].concat(packet.args); - - if (dataAck) { - params.push(ack); - } - - socket.$emit.apply(socket, params); - } - break; - - case 'disconnect': - this.manager.onLeave(sessid, this.name); - this.store.publish('leave', sessid, this.name); - - socket.$emit('disconnect', packet.reason || 'packet'); - break; - - case 'json': - case 'message': - var params = ['message', packet.data]; - - if (dataAck) - params.push(ack); - - socket.$emit.apply(socket, params); - }; -}; diff --git a/node_modules/socket.io/lib/parser.js b/node_modules/socket.io/lib/parser.js deleted file mode 100644 index d56b550064..0000000000 --- a/node_modules/socket.io/lib/parser.js +++ /dev/null @@ -1,249 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -/** - * Packet types. - */ - -var packets = exports.packets = { - 'disconnect': 0 - , 'connect': 1 - , 'heartbeat': 2 - , 'message': 3 - , 'json': 4 - , 'event': 5 - , 'ack': 6 - , 'error': 7 - , 'noop': 8 - } - , packetslist = Object.keys(packets); - -/** - * Errors reasons. - */ - -var reasons = exports.reasons = { - 'transport not supported': 0 - , 'client not handshaken': 1 - , 'unauthorized': 2 - } - , reasonslist = Object.keys(reasons); - -/** - * Errors advice. - */ - -var advice = exports.advice = { - 'reconnect': 0 - } - , advicelist = Object.keys(advice); - -/** - * Encodes a packet. - * - * @api private - */ - -exports.encodePacket = function (packet) { - var type = packets[packet.type] - , id = packet.id || '' - , endpoint = packet.endpoint || '' - , ack = packet.ack - , data = null; - - switch (packet.type) { - case 'message': - if (packet.data !== '') - data = packet.data; - break; - - case 'event': - var ev = { name: packet.name }; - - if (packet.args && packet.args.length) { - ev.args = packet.args; - } - - data = JSON.stringify(ev); - break; - - case 'json': - data = JSON.stringify(packet.data); - break; - - case 'ack': - data = packet.ackId - + (packet.args && packet.args.length - ? '+' + JSON.stringify(packet.args) : ''); - break; - - case 'connect': - if (packet.qs) - data = packet.qs; - break; - - case 'error': - var reason = packet.reason ? reasons[packet.reason] : '' - , adv = packet.advice ? advice[packet.advice] : '' - - if (reason !== '' || adv !== '') - data = reason + (adv !== '' ? ('+' + adv) : '') - - break; - } - - // construct packet with required fragments - var encoded = type + ':' + id + (ack == 'data' ? '+' : '') + ':' + endpoint; - - // data fragment is optional - if (data !== null && data !== undefined) - encoded += ':' + data; - - return encoded; -}; - -/** - * Encodes multiple messages (payload). - * - * @param {Array} messages - * @api private - */ - -exports.encodePayload = function (packets) { - var decoded = ''; - - if (packets.length == 1) - return packets[0]; - - for (var i = 0, l = packets.length; i < l; i++) { - var packet = packets[i]; - decoded += '\ufffd' + packet.length + '\ufffd' + packets[i] - } - - return decoded; -}; - -/** - * Decodes a packet - * - * @api private - */ - -var regexp = /([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/; - -/** - * Wrap the JSON.parse in a seperate function the crankshaft optimizer will - * only punish this function for the usage for try catch - * - * @api private - */ - -function parse (data) { - try { return JSON.parse(data) } - catch (e) { return false } -} - -exports.decodePacket = function (data) { - var pieces = data.match(regexp); - - if (!pieces) return {}; - - var id = pieces[2] || '' - , data = pieces[5] || '' - , packet = { - type: packetslist[pieces[1]] - , endpoint: pieces[4] || '' - }; - - // whether we need to acknowledge the packet - if (id) { - packet.id = id; - if (pieces[3]) - packet.ack = 'data'; - else - packet.ack = true; - } - - // handle different packet types - switch (packet.type) { - case 'message': - packet.data = data || ''; - break; - - case 'event': - pieces = parse(data); - if (pieces) { - packet.name = pieces.name; - packet.args = pieces.args; - } - - packet.args = packet.args || []; - break; - - case 'json': - packet.data = parse(data); - break; - - case 'connect': - packet.qs = data || ''; - break; - - case 'ack': - pieces = data.match(/^([0-9]+)(\+)?(.*)/); - if (pieces) { - packet.ackId = pieces[1]; - packet.args = []; - - if (pieces[3]) { - packet.args = parse(pieces[3]) || []; - } - } - break; - - case 'error': - pieces = data.split('+'); - packet.reason = reasonslist[pieces[0]] || ''; - packet.advice = advicelist[pieces[1]] || ''; - } - - return packet; -}; - -/** - * Decodes data payload. Detects multiple messages - * - * @return {Array} messages - * @api public - */ - -exports.decodePayload = function (data) { - if (undefined == data || null == data) { - return []; - } - - if (data[0] == '\ufffd') { - var ret = []; - - for (var i = 1, length = ''; i < data.length; i++) { - if (data[i] == '\ufffd') { - ret.push(exports.decodePacket(data.substr(i + 1, length))); - i += Number(length) + 1; - length = ''; - } else { - length += data[i]; - } - } - - return ret; - } else { - return [exports.decodePacket(data)]; - } -}; diff --git a/node_modules/socket.io/lib/socket.io.js b/node_modules/socket.io/lib/socket.io.js deleted file mode 100644 index bf590364ae..0000000000 --- a/node_modules/socket.io/lib/socket.io.js +++ /dev/null @@ -1,143 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var client = require('socket.io-client'); - -/** - * Version. - */ - -exports.version = '0.9.11'; - -/** - * Supported protocol version. - */ - -exports.protocol = 1; - -/** - * Client that we serve. - */ - -exports.clientVersion = client.version; - -/** - * Attaches a manager - * - * @param {HTTPServer/Number} a HTTP/S server or a port number to listen on. - * @param {Object} opts to be passed to Manager and/or http server - * @param {Function} callback if a port is supplied - * @api public - */ - -exports.listen = function (server, options, fn) { - if ('function' == typeof server) { - console.warn('Socket.IO\'s `listen()` method expects an `http.Server` instance\n' - + 'as its first parameter. Are you migrating from Express 2.x to 3.x?\n' - + 'If so, check out the "Socket.IO compatibility" section at:\n' - + 'https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x'); - } - - if ('function' == typeof options) { - fn = options; - options = {}; - } - - if ('undefined' == typeof server) { - // create a server that listens on port 80 - server = 80; - } - - if ('number' == typeof server) { - // if a port number is passed - var port = server; - - if (options && options.key) - server = require('https').createServer(options); - else - server = require('http').createServer(); - - // default response - server.on('request', function (req, res) { - res.writeHead(200); - res.end('Welcome to socket.io.'); - }); - - server.listen(port, fn); - } - - // otherwise assume a http/s server - return new exports.Manager(server, options); -}; - -/** - * Manager constructor. - * - * @api public - */ - -exports.Manager = require('./manager'); - -/** - * Transport constructor. - * - * @api public - */ - -exports.Transport = require('./transport'); - -/** - * Socket constructor. - * - * @api public - */ - -exports.Socket = require('./socket'); - -/** - * Static constructor. - * - * @api public - */ - -exports.Static = require('./static'); - -/** - * Store constructor. - * - * @api public - */ - -exports.Store = require('./store'); - -/** - * Memory Store constructor. - * - * @api public - */ - -exports.MemoryStore = require('./stores/memory'); - -/** - * Redis Store constructor. - * - * @api public - */ - -exports.RedisStore = require('./stores/redis'); - -/** - * Parser. - * - * @api public - */ - -exports.parser = require('./parser'); diff --git a/node_modules/socket.io/lib/socket.js b/node_modules/socket.io/lib/socket.js deleted file mode 100644 index d9807f6dd2..0000000000 --- a/node_modules/socket.io/lib/socket.js +++ /dev/null @@ -1,369 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var parser = require('./parser') - , util = require('./util') - , EventEmitter = process.EventEmitter - -/** - * Export the constructor. - */ - -exports = module.exports = Socket; - -/** - * Default error event listener to prevent uncaught exceptions. - */ - -var defaultError = function () {}; - -/** - * Socket constructor. - * - * @param {Manager} manager instance - * @param {String} session id - * @param {Namespace} namespace the socket belongs to - * @param {Boolean} whether the - * @api public - */ - -function Socket (manager, id, nsp, readable) { - this.id = id; - this.namespace = nsp; - this.manager = manager; - this.disconnected = false; - this.ackPackets = 0; - this.acks = {}; - this.setFlags(); - this.readable = readable; - this.store = this.manager.store.client(this.id); - this.on('error', defaultError); -}; - -/** - * Inherits from EventEmitter. - */ - -Socket.prototype.__proto__ = EventEmitter.prototype; - -/** - * Accessor shortcut for the handshake data - * - * @api private - */ - -Socket.prototype.__defineGetter__('handshake', function () { - return this.manager.handshaken[this.id]; -}); - -/** - * Accessor shortcut for the transport type - * - * @api private - */ - -Socket.prototype.__defineGetter__('transport', function () { - return this.manager.transports[this.id].name; -}); - -/** - * Accessor shortcut for the logger. - * - * @api private - */ - -Socket.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * JSON message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('json', function () { - this.flags.json = true; - return this; -}); - -/** - * Volatile message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('volatile', function () { - this.flags.volatile = true; - return this; -}); - -/** - * Broadcast message flag. - * - * @api public - */ - -Socket.prototype.__defineGetter__('broadcast', function () { - this.flags.broadcast = true; - return this; -}); - -/** - * Overrides the room to broadcast messages to (flag) - * - * @api public - */ - -Socket.prototype.to = Socket.prototype.in = function (room) { - this.flags.room = room; - return this; -}; - -/** - * Resets flags - * - * @api private - */ - -Socket.prototype.setFlags = function () { - this.flags = { - endpoint: this.namespace.name - , room: '' - }; - return this; -}; - -/** - * Triggered on disconnect - * - * @api private - */ - -Socket.prototype.onDisconnect = function (reason) { - if (!this.disconnected) { - this.$emit('disconnect', reason); - this.disconnected = true; - } -}; - -/** - * Joins a user to a room. - * - * @api public - */ - -Socket.prototype.join = function (name, fn) { - var nsp = this.namespace.name - , name = (nsp + '/') + name; - - this.manager.onJoin(this.id, name); - this.manager.store.publish('join', this.id, name); - - if (fn) { - this.log.warn('Client#join callback is deprecated'); - fn(); - } - - return this; -}; - -/** - * Un-joins a user from a room. - * - * @api public - */ - -Socket.prototype.leave = function (name, fn) { - var nsp = this.namespace.name - , name = (nsp + '/') + name; - - this.manager.onLeave(this.id, name); - this.manager.store.publish('leave', this.id, name); - - if (fn) { - this.log.warn('Client#leave callback is deprecated'); - fn(); - } - - return this; -}; - -/** - * Transmits a packet. - * - * @api private - */ - -Socket.prototype.packet = function (packet) { - if (this.flags.broadcast) { - this.log.debug('broadcasting packet'); - this.namespace.in(this.flags.room).except(this.id).packet(packet); - } else { - packet.endpoint = this.flags.endpoint; - packet = parser.encodePacket(packet); - - this.dispatch(packet, this.flags.volatile); - } - - this.setFlags(); - - return this; -}; - -/** - * Dispatches a packet - * - * @api private - */ - -Socket.prototype.dispatch = function (packet, volatile) { - if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { - this.manager.transports[this.id].onDispatch(packet, volatile); - } else { - if (!volatile) { - this.manager.onClientDispatch(this.id, packet, volatile); - } - - this.manager.store.publish('dispatch:' + this.id, packet, volatile); - } -}; - -/** - * Stores data for the client. - * - * @api public - */ - -Socket.prototype.set = function (key, value, fn) { - this.store.set(key, value, fn); - return this; -}; - -/** - * Retrieves data for the client - * - * @api public - */ - -Socket.prototype.get = function (key, fn) { - this.store.get(key, fn); - return this; -}; - -/** - * Checks data for the client - * - * @api public - */ - -Socket.prototype.has = function (key, fn) { - this.store.has(key, fn); - return this; -}; - -/** - * Deletes data for the client - * - * @api public - */ - -Socket.prototype.del = function (key, fn) { - this.store.del(key, fn); - return this; -}; - -/** - * Kicks client - * - * @api public - */ - -Socket.prototype.disconnect = function () { - if (!this.disconnected) { - this.log.info('booting client'); - - if ('' === this.namespace.name) { - if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { - this.manager.transports[this.id].onForcedDisconnect(); - } else { - this.manager.onClientDisconnect(this.id); - this.manager.store.publish('disconnect:' + this.id); - } - } else { - this.packet({type: 'disconnect'}); - this.manager.onLeave(this.id, this.namespace.name); - this.$emit('disconnect', 'booted'); - } - - } - - return this; -}; - -/** - * Send a message. - * - * @api public - */ - -Socket.prototype.send = function (data, fn) { - var packet = { - type: this.flags.json ? 'json' : 'message' - , data: data - }; - - if (fn) { - packet.id = ++this.ackPackets; - packet.ack = true; - this.acks[packet.id] = fn; - } - - return this.packet(packet); -}; - -/** - * Original emit function. - * - * @api private - */ - -Socket.prototype.$emit = EventEmitter.prototype.emit; - -/** - * Emit override for custom events. - * - * @api public - */ - -Socket.prototype.emit = function (ev) { - if (ev == 'newListener') { - return this.$emit.apply(this, arguments); - } - - var args = util.toArray(arguments).slice(1) - , lastArg = args[args.length - 1] - , packet = { - type: 'event' - , name: ev - }; - - if ('function' == typeof lastArg) { - packet.id = ++this.ackPackets; - packet.ack = lastArg.length ? 'data' : true; - this.acks[packet.id] = lastArg; - args = args.slice(0, args.length - 1); - } - - packet.args = args; - - return this.packet(packet); -}; diff --git a/node_modules/socket.io/lib/static.js b/node_modules/socket.io/lib/static.js deleted file mode 100644 index fe50593757..0000000000 --- a/node_modules/socket.io/lib/static.js +++ /dev/null @@ -1,395 +0,0 @@ - -/*! -* socket.io-node -* Copyright(c) 2011 LearnBoost -* MIT Licensed -*/ - -/** - * Module dependencies. - */ - -var client = require('socket.io-client') - , cp = require('child_process') - , fs = require('fs') - , util = require('./util'); - -/** - * File type details. - * - * @api private - */ - -var mime = { - js: { - type: 'application/javascript' - , encoding: 'utf8' - , gzip: true - } - , swf: { - type: 'application/x-shockwave-flash' - , encoding: 'binary' - , gzip: false - } -}; - -/** - * Regexp for matching custom transport patterns. Users can configure their own - * socket.io bundle based on the url structure. Different transport names are - * concatinated using the `+` char. /socket.io/socket.io+websocket.js should - * create a bundle that only contains support for the websocket. - * - * @api private - */ - -var bundle = /\+((?:\+)?[\w\-]+)*(?:\.v\d+\.\d+\.\d+)?(?:\.js)$/ - , versioning = /\.v\d+\.\d+\.\d+(?:\.js)$/; - -/** - * Export the constructor - */ - -exports = module.exports = Static; - -/** - * Static constructor - * - * @api public - */ - -function Static (manager) { - this.manager = manager; - this.cache = {}; - this.paths = {}; - - this.init(); -} - -/** - * Initialize the Static by adding default file paths. - * - * @api public - */ - -Static.prototype.init = function () { - /** - * Generates a unique id based the supplied transports array - * - * @param {Array} transports The array with transport types - * @api private - */ - function id (transports) { - var id = transports.join('').split('').map(function (char) { - return ('' + char.charCodeAt(0)).split('').pop(); - }).reduce(function (char, id) { - return char +id; - }); - - return client.version + ':' + id; - } - - /** - * Generates a socket.io-client file based on the supplied transports. - * - * @param {Array} transports The array with transport types - * @param {Function} callback Callback for the static.write - * @api private - */ - - function build (transports, callback) { - client.builder(transports, { - minify: self.manager.enabled('browser client minification') - }, function (err, content) { - callback(err, content ? new Buffer(content) : null, id(transports)); - } - ); - } - - var self = this; - - // add our default static files - this.add('/static/flashsocket/WebSocketMain.swf', { - file: client.dist + '/WebSocketMain.swf' - }); - - this.add('/static/flashsocket/WebSocketMainInsecure.swf', { - file: client.dist + '/WebSocketMainInsecure.swf' - }); - - // generates dedicated build based on the available transports - this.add('/socket.io.js', function (path, callback) { - build(self.manager.get('transports'), callback); - }); - - this.add('/socket.io.v', { mime: mime.js }, function (path, callback) { - build(self.manager.get('transports'), callback); - }); - - // allow custom builds based on url paths - this.add('/socket.io+', { mime: mime.js }, function (path, callback) { - var available = self.manager.get('transports') - , matches = path.match(bundle) - , transports = []; - - if (!matches) return callback('No valid transports'); - - // make sure they valid transports - matches[0].split('.')[0].split('+').slice(1).forEach(function (transport) { - if (!!~available.indexOf(transport)) { - transports.push(transport); - } - }); - - if (!transports.length) return callback('No valid transports'); - build(transports, callback); - }); - - // clear cache when transports change - this.manager.on('set:transports', function (key, value) { - delete self.cache['/socket.io.js']; - Object.keys(self.cache).forEach(function (key) { - if (bundle.test(key)) { - delete self.cache[key]; - } - }); - }); -}; - -/** - * Gzip compress buffers. - * - * @param {Buffer} data The buffer that needs gzip compression - * @param {Function} callback - * @api public - */ - -Static.prototype.gzip = function (data, callback) { - var gzip = cp.spawn('gzip', ['-9', '-c', '-f', '-n']) - , encoding = Buffer.isBuffer(data) ? 'binary' : 'utf8' - , buffer = [] - , err; - - gzip.stdout.on('data', function (data) { - buffer.push(data); - }); - - gzip.stderr.on('data', function (data) { - err = data +''; - buffer.length = 0; - }); - - gzip.on('close', function () { - if (err) return callback(err); - - var size = 0 - , index = 0 - , i = buffer.length - , content; - - while (i--) { - size += buffer[i].length; - } - - content = new Buffer(size); - i = buffer.length; - - buffer.forEach(function (buffer) { - var length = buffer.length; - - buffer.copy(content, index, 0, length); - index += length; - }); - - buffer.length = 0; - callback(null, content); - }); - - gzip.stdin.end(data, encoding); -}; - -/** - * Is the path a static file? - * - * @param {String} path The path that needs to be checked - * @api public - */ - -Static.prototype.has = function (path) { - // fast case - if (this.paths[path]) return this.paths[path]; - - var keys = Object.keys(this.paths) - , i = keys.length; - - while (i--) { - if (-~path.indexOf(keys[i])) return this.paths[keys[i]]; - } - - return false; -}; - -/** - * Add new paths new paths that can be served using the static provider. - * - * @param {String} path The path to respond to - * @param {Options} options Options for writing out the response - * @param {Function} [callback] Optional callback if no options.file is - * supplied this would be called instead. - * @api public - */ - -Static.prototype.add = function (path, options, callback) { - var extension = /(?:\.(\w{1,4}))$/.exec(path); - - if (!callback && typeof options == 'function') { - callback = options; - options = {}; - } - - options.mime = options.mime || (extension ? mime[extension[1]] : false); - - if (callback) options.callback = callback; - if (!(options.file || options.callback) || !options.mime) return false; - - this.paths[path] = options; - - return true; -}; - -/** - * Writes a static response. - * - * @param {String} path The path for the static content - * @param {HTTPRequest} req The request object - * @param {HTTPResponse} res The response object - * @api public - */ - -Static.prototype.write = function (path, req, res) { - /** - * Write a response without throwing errors because can throw error if the - * response is no longer writable etc. - * - * @api private - */ - - function write (status, headers, content, encoding) { - try { - res.writeHead(status, headers || undefined); - - // only write content if it's not a HEAD request and we actually have - // some content to write (304's doesn't have content). - res.end( - req.method !== 'HEAD' && content ? content : '' - , encoding || undefined - ); - } catch (e) {} - } - - /** - * Answers requests depending on the request properties and the reply object. - * - * @param {Object} reply The details and content to reply the response with - * @api private - */ - - function answer (reply) { - var cached = req.headers['if-none-match'] === reply.etag; - if (cached && self.manager.enabled('browser client etag')) { - return write(304); - } - - var accept = req.headers['accept-encoding'] || '' - , gzip = !!~accept.toLowerCase().indexOf('gzip') - , mime = reply.mime - , versioned = reply.versioned - , headers = { - 'Content-Type': mime.type - }; - - // check if we can add a etag - if (self.manager.enabled('browser client etag') && reply.etag && !versioned) { - headers['Etag'] = reply.etag; - } - - // see if we need to set Expire headers because the path is versioned - if (versioned) { - var expires = self.manager.get('browser client expires'); - headers['Cache-Control'] = 'private, x-gzip-ok="", max-age=' + expires; - headers['Date'] = new Date().toUTCString(); - headers['Expires'] = new Date(Date.now() + (expires * 1000)).toUTCString(); - } - - if (gzip && reply.gzip) { - headers['Content-Length'] = reply.gzip.length; - headers['Content-Encoding'] = 'gzip'; - headers['Vary'] = 'Accept-Encoding'; - write(200, headers, reply.gzip.content, mime.encoding); - } else { - headers['Content-Length'] = reply.length; - write(200, headers, reply.content, mime.encoding); - } - - self.manager.log.debug('served static content ' + path); - } - - var self = this - , details; - - // most common case first - if (this.manager.enabled('browser client cache') && this.cache[path]) { - return answer(this.cache[path]); - } else if (this.manager.get('browser client handler')) { - return this.manager.get('browser client handler').call(this, req, res); - } else if ((details = this.has(path))) { - /** - * A small helper function that will let us deal with fs and dynamic files - * - * @param {Object} err Optional error - * @param {Buffer} content The data - * @api private - */ - - function ready (err, content, etag) { - if (err) { - self.manager.log.warn('Unable to serve file. ' + (err.message || err)); - return write(500, null, 'Error serving static ' + path); - } - - // store the result in the cache - var reply = self.cache[path] = { - content: content - , length: content.length - , mime: details.mime - , etag: etag || client.version - , versioned: versioning.test(path) - }; - - // check if gzip is enabled - if (details.mime.gzip && self.manager.enabled('browser client gzip')) { - self.gzip(content, function (err, content) { - if (!err) { - reply.gzip = { - content: content - , length: content.length - } - } - - answer(reply); - }); - } else { - answer(reply); - } - } - - if (details.file) { - fs.readFile(details.file, ready); - } else if(details.callback) { - details.callback.call(this, path, ready); - } else { - write(404, null, 'File handle not found'); - } - } else { - write(404, null, 'File not found'); - } -}; diff --git a/node_modules/socket.io/lib/store.js b/node_modules/socket.io/lib/store.js deleted file mode 100644 index 06c0389a62..0000000000 --- a/node_modules/socket.io/lib/store.js +++ /dev/null @@ -1,98 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Expose the constructor. - */ - -exports = module.exports = Store; - -/** - * Module dependencies. - */ - -var EventEmitter = process.EventEmitter; - -/** - * Store interface - * - * @api public - */ - -function Store (options) { - this.options = options; - this.clients = {}; -}; - -/** - * Inherit from EventEmitter. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Initializes a client store - * - * @param {String} id - * @api public - */ - -Store.prototype.client = function (id) { - if (!this.clients[id]) { - this.clients[id] = new (this.constructor.Client)(this, id); - } - - return this.clients[id]; -}; - -/** - * Destroys a client - * - * @api {String} sid - * @param {Number} number of seconds to expire client data - * @api private - */ - -Store.prototype.destroyClient = function (id, expiration) { - if (this.clients[id]) { - this.clients[id].destroy(expiration); - delete this.clients[id]; - } - - return this; -}; - -/** - * Destroys the store - * - * @param {Number} number of seconds to expire client data - * @api private - */ - -Store.prototype.destroy = function (clientExpiration) { - var keys = Object.keys(this.clients) - , count = keys.length; - - for (var i = 0, l = count; i < l; i++) { - this.destroyClient(keys[i], clientExpiration); - } - - this.clients = {}; - - return this; -}; - -/** - * Client. - * - * @api public - */ - -Store.Client = function (store, id) { - this.store = store; - this.id = id; -}; diff --git a/node_modules/socket.io/lib/stores/memory.js b/node_modules/socket.io/lib/stores/memory.js deleted file mode 100644 index 8b731a7904..0000000000 --- a/node_modules/socket.io/lib/stores/memory.js +++ /dev/null @@ -1,143 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , Store = require('../store'); - -/** - * Exports the constructor. - */ - -exports = module.exports = Memory; -Memory.Client = Client; - -/** - * Memory store - * - * @api public - */ - -function Memory (opts) { - Store.call(this, opts); -}; - -/** - * Inherits from Store. - */ - -Memory.prototype.__proto__ = Store.prototype; - -/** - * Publishes a message. - * - * @api private - */ - -Memory.prototype.publish = function () { }; - -/** - * Subscribes to a channel - * - * @api private - */ - -Memory.prototype.subscribe = function () { }; - -/** - * Unsubscribes - * - * @api private - */ - -Memory.prototype.unsubscribe = function () { }; - -/** - * Client constructor - * - * @api private - */ - -function Client () { - Store.Client.apply(this, arguments); - this.data = {}; -}; - -/** - * Inherits from Store.Client - */ - -Client.prototype.__proto__ = Store.Client; - -/** - * Gets a key - * - * @api public - */ - -Client.prototype.get = function (key, fn) { - fn(null, this.data[key] === undefined ? null : this.data[key]); - return this; -}; - -/** - * Sets a key - * - * @api public - */ - -Client.prototype.set = function (key, value, fn) { - this.data[key] = value; - fn && fn(null); - return this; -}; - -/** - * Has a key - * - * @api public - */ - -Client.prototype.has = function (key, fn) { - fn(null, key in this.data); -}; - -/** - * Deletes a key - * - * @api public - */ - -Client.prototype.del = function (key, fn) { - delete this.data[key]; - fn && fn(null); - return this; -}; - -/** - * Destroys the client. - * - * @param {Number} number of seconds to expire data - * @api private - */ - -Client.prototype.destroy = function (expiration) { - if ('number' != typeof expiration) { - this.data = {}; - } else { - var self = this; - - setTimeout(function () { - self.data = {}; - }, expiration * 1000); - } - - return this; -}; diff --git a/node_modules/socket.io/lib/stores/redis.js b/node_modules/socket.io/lib/stores/redis.js deleted file mode 100644 index 8fea235f0d..0000000000 --- a/node_modules/socket.io/lib/stores/redis.js +++ /dev/null @@ -1,269 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , Store = require('../store') - , assert = require('assert'); - -/** - * Exports the constructor. - */ - -exports = module.exports = Redis; -Redis.Client = Client; - -/** - * Redis store. - * Options: - * - nodeId (fn) gets an id that uniquely identifies this node - * - redis (fn) redis constructor, defaults to redis - * - redisPub (object) options to pass to the pub redis client - * - redisSub (object) options to pass to the sub redis client - * - redisClient (object) options to pass to the general redis client - * - pack (fn) custom packing, defaults to JSON or msgpack if installed - * - unpack (fn) custom packing, defaults to JSON or msgpack if installed - * - * @api public - */ - -function Redis (opts) { - opts = opts || {}; - - // node id to uniquely identify this node - var nodeId = opts.nodeId || function () { - // by default, we generate a random id - return Math.abs(Math.random() * Math.random() * Date.now() | 0); - }; - - this.nodeId = nodeId(); - - // packing / unpacking mechanism - if (opts.pack) { - this.pack = opts.pack; - this.unpack = opts.unpack; - } else { - try { - var msgpack = require('msgpack'); - this.pack = msgpack.pack; - this.unpack = msgpack.unpack; - } catch (e) { - this.pack = JSON.stringify; - this.unpack = JSON.parse; - } - } - - var redis = opts.redis || require('redis') - , RedisClient = redis.RedisClient; - - // initialize a pubsub client and a regular client - if (opts.redisPub instanceof RedisClient) { - this.pub = opts.redisPub; - } else { - opts.redisPub || (opts.redisPub = {}); - this.pub = redis.createClient(opts.redisPub.port, opts.redisPub.host, opts.redisPub); - } - if (opts.redisSub instanceof RedisClient) { - this.sub = opts.redisSub; - } else { - opts.redisSub || (opts.redisSub = {}); - this.sub = redis.createClient(opts.redisSub.port, opts.redisSub.host, opts.redisSub); - } - if (opts.redisClient instanceof RedisClient) { - this.cmd = opts.redisClient; - } else { - opts.redisClient || (opts.redisClient = {}); - this.cmd = redis.createClient(opts.redisClient.port, opts.redisClient.host, opts.redisClient); - } - - Store.call(this, opts); - - this.sub.setMaxListeners(0); - this.setMaxListeners(0); -}; - -/** - * Inherits from Store. - */ - -Redis.prototype.__proto__ = Store.prototype; - -/** - * Publishes a message. - * - * @api private - */ - -Redis.prototype.publish = function (name) { - var args = Array.prototype.slice.call(arguments, 1); - this.pub.publish(name, this.pack({ nodeId: this.nodeId, args: args })); - this.emit.apply(this, ['publish', name].concat(args)); -}; - -/** - * Subscribes to a channel - * - * @api private - */ - -Redis.prototype.subscribe = function (name, consumer, fn) { - this.sub.subscribe(name); - - if (consumer || fn) { - var self = this; - - self.sub.on('subscribe', function subscribe (ch) { - if (name == ch) { - function message (ch, msg) { - if (name == ch) { - msg = self.unpack(msg); - - // we check that the message consumed wasnt emitted by this node - if (self.nodeId != msg.nodeId) { - consumer.apply(null, msg.args); - } - } - }; - - self.sub.on('message', message); - - self.on('unsubscribe', function unsubscribe (ch) { - if (name == ch) { - self.sub.removeListener('message', message); - self.removeListener('unsubscribe', unsubscribe); - } - }); - - self.sub.removeListener('subscribe', subscribe); - - fn && fn(); - } - }); - } - - this.emit('subscribe', name, consumer, fn); -}; - -/** - * Unsubscribes - * - * @api private - */ - -Redis.prototype.unsubscribe = function (name, fn) { - this.sub.unsubscribe(name); - - if (fn) { - var client = this.sub; - - client.on('unsubscribe', function unsubscribe (ch) { - if (name == ch) { - fn(); - client.removeListener('unsubscribe', unsubscribe); - } - }); - } - - this.emit('unsubscribe', name, fn); -}; - -/** - * Destroys the store - * - * @api public - */ - -Redis.prototype.destroy = function () { - Store.prototype.destroy.call(this); - - this.pub.end(); - this.sub.end(); - this.cmd.end(); -}; - -/** - * Client constructor - * - * @api private - */ - -function Client (store, id) { - Store.Client.call(this, store, id); -}; - -/** - * Inherits from Store.Client - */ - -Client.prototype.__proto__ = Store.Client; - -/** - * Redis hash get - * - * @api private - */ - -Client.prototype.get = function (key, fn) { - this.store.cmd.hget(this.id, key, fn); - return this; -}; - -/** - * Redis hash set - * - * @api private - */ - -Client.prototype.set = function (key, value, fn) { - this.store.cmd.hset(this.id, key, value, fn); - return this; -}; - -/** - * Redis hash del - * - * @api private - */ - -Client.prototype.del = function (key, fn) { - this.store.cmd.hdel(this.id, key, fn); - return this; -}; - -/** - * Redis hash has - * - * @api private - */ - -Client.prototype.has = function (key, fn) { - this.store.cmd.hexists(this.id, key, function (err, has) { - if (err) return fn(err); - fn(null, !!has); - }); - return this; -}; - -/** - * Destroys client - * - * @param {Number} number of seconds to expire data - * @api private - */ - -Client.prototype.destroy = function (expiration) { - if ('number' != typeof expiration) { - this.store.cmd.del(this.id); - } else { - this.store.cmd.expire(this.id, expiration); - } - - return this; -}; diff --git a/node_modules/socket.io/lib/transport.js b/node_modules/socket.io/lib/transport.js deleted file mode 100644 index 2e4c08bd43..0000000000 --- a/node_modules/socket.io/lib/transport.js +++ /dev/null @@ -1,534 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var parser = require('./parser'); - -/** - * Expose the constructor. - */ - -exports = module.exports = Transport; - -/** - * Transport constructor. - * - * @api public - */ - -function Transport (mng, data, req) { - this.manager = mng; - this.id = data.id; - this.disconnected = false; - this.drained = true; - this.handleRequest(req); -}; - -/** - * Access the logger. - * - * @api public - */ - -Transport.prototype.__defineGetter__('log', function () { - return this.manager.log; -}); - -/** - * Access the store. - * - * @api public - */ - -Transport.prototype.__defineGetter__('store', function () { - return this.manager.store; -}); - -/** - * Handles a request when it's set. - * - * @api private - */ - -Transport.prototype.handleRequest = function (req) { - this.log.debug('setting request', req.method, req.url); - this.req = req; - - if (req.method == 'GET') { - this.socket = req.socket; - this.open = true; - this.drained = true; - this.setHeartbeatInterval(); - - this.setHandlers(); - this.onSocketConnect(); - } -}; - -/** - * Called when a connection is first set. - * - * @api private - */ - -Transport.prototype.onSocketConnect = function () { }; - -/** - * Sets transport handlers - * - * @api private - */ - -Transport.prototype.setHandlers = function () { - var self = this; - - // we need to do this in a pub/sub way since the client can POST the message - // over a different socket (ie: different Transport instance) - this.store.subscribe('heartbeat-clear:' + this.id, function () { - self.onHeartbeatClear(); - }); - - this.store.subscribe('disconnect-force:' + this.id, function () { - self.onForcedDisconnect(); - }); - - this.store.subscribe('dispatch:' + this.id, function (packet, volatile) { - self.onDispatch(packet, volatile); - }); - - this.bound = { - end: this.onSocketEnd.bind(this) - , close: this.onSocketClose.bind(this) - , error: this.onSocketError.bind(this) - , drain: this.onSocketDrain.bind(this) - }; - - this.socket.on('end', this.bound.end); - this.socket.on('close', this.bound.close); - this.socket.on('error', this.bound.error); - this.socket.on('drain', this.bound.drain); - - this.handlersSet = true; -}; - -/** - * Removes transport handlers - * - * @api private - */ - -Transport.prototype.clearHandlers = function () { - if (this.handlersSet) { - this.store.unsubscribe('disconnect-force:' + this.id); - this.store.unsubscribe('heartbeat-clear:' + this.id); - this.store.unsubscribe('dispatch:' + this.id); - - this.socket.removeListener('end', this.bound.end); - this.socket.removeListener('close', this.bound.close); - this.socket.removeListener('error', this.bound.error); - this.socket.removeListener('drain', this.bound.drain); - } -}; - -/** - * Called when the connection dies - * - * @api private - */ - -Transport.prototype.onSocketEnd = function () { - this.end('socket end'); -}; - -/** - * Called when the connection dies - * - * @api private - */ - -Transport.prototype.onSocketClose = function (error) { - this.end(error ? 'socket error' : 'socket close'); -}; - -/** - * Called when the connection has an error. - * - * @api private - */ - -Transport.prototype.onSocketError = function (err) { - if (this.open) { - this.socket.destroy(); - this.onClose(); - } - - this.log.info('socket error ' + err.stack); -}; - -/** - * Called when the connection is drained. - * - * @api private - */ - -Transport.prototype.onSocketDrain = function () { - this.drained = true; -}; - -/** - * Called upon receiving a heartbeat packet. - * - * @api private - */ - -Transport.prototype.onHeartbeatClear = function () { - this.clearHeartbeatTimeout(); - this.setHeartbeatInterval(); -}; - -/** - * Called upon a forced disconnection. - * - * @api private - */ - -Transport.prototype.onForcedDisconnect = function () { - if (!this.disconnected) { - this.log.info('transport end by forced client disconnection'); - if (this.open) { - this.packet({ type: 'disconnect' }); - } - this.end('booted'); - } -}; - -/** - * Dispatches a packet. - * - * @api private - */ - -Transport.prototype.onDispatch = function (packet, volatile) { - if (volatile) { - this.writeVolatile(packet); - } else { - this.write(packet); - } -}; - -/** - * Sets the close timeout. - */ - -Transport.prototype.setCloseTimeout = function () { - if (!this.closeTimeout) { - var self = this; - - this.closeTimeout = setTimeout(function () { - self.log.debug('fired close timeout for client', self.id); - self.closeTimeout = null; - self.end('close timeout'); - }, this.manager.get('close timeout') * 1000); - - this.log.debug('set close timeout for client', this.id); - } -}; - -/** - * Clears the close timeout. - */ - -Transport.prototype.clearCloseTimeout = function () { - if (this.closeTimeout) { - clearTimeout(this.closeTimeout); - this.closeTimeout = null; - - this.log.debug('cleared close timeout for client', this.id); - } -}; - -/** - * Sets the heartbeat timeout - */ - -Transport.prototype.setHeartbeatTimeout = function () { - if (!this.heartbeatTimeout && this.manager.enabled('heartbeats')) { - var self = this; - - this.heartbeatTimeout = setTimeout(function () { - self.log.debug('fired heartbeat timeout for client', self.id); - self.heartbeatTimeout = null; - self.end('heartbeat timeout'); - }, this.manager.get('heartbeat timeout') * 1000); - - this.log.debug('set heartbeat timeout for client', this.id); - } -}; - -/** - * Clears the heartbeat timeout - * - * @param text - */ - -Transport.prototype.clearHeartbeatTimeout = function () { - if (this.heartbeatTimeout && this.manager.enabled('heartbeats')) { - clearTimeout(this.heartbeatTimeout); - this.heartbeatTimeout = null; - this.log.debug('cleared heartbeat timeout for client', this.id); - } -}; - -/** - * Sets the heartbeat interval. To be called when a connection opens and when - * a heartbeat is received. - * - * @api private - */ - -Transport.prototype.setHeartbeatInterval = function () { - if (!this.heartbeatInterval && this.manager.enabled('heartbeats')) { - var self = this; - - this.heartbeatInterval = setTimeout(function () { - self.heartbeat(); - self.heartbeatInterval = null; - }, this.manager.get('heartbeat interval') * 1000); - - this.log.debug('set heartbeat interval for client', this.id); - } -}; - -/** - * Clears all timeouts. - * - * @api private - */ - -Transport.prototype.clearTimeouts = function () { - this.clearCloseTimeout(); - this.clearHeartbeatTimeout(); - this.clearHeartbeatInterval(); -}; - -/** - * Sends a heartbeat - * - * @api private - */ - -Transport.prototype.heartbeat = function () { - if (this.open) { - this.log.debug('emitting heartbeat for client', this.id); - this.packet({ type: 'heartbeat' }); - this.setHeartbeatTimeout(); - } - - return this; -}; - -/** - * Handles a message. - * - * @param {Object} packet object - * @api private - */ - -Transport.prototype.onMessage = function (packet) { - var current = this.manager.transports[this.id]; - - if ('heartbeat' == packet.type) { - this.log.debug('got heartbeat packet'); - - if (current && current.open) { - current.onHeartbeatClear(); - } else { - this.store.publish('heartbeat-clear:' + this.id); - } - } else { - if ('disconnect' == packet.type && packet.endpoint == '') { - this.log.debug('got disconnection packet'); - - if (current) { - current.onForcedDisconnect(); - } else { - this.store.publish('disconnect-force:' + this.id); - } - - return; - } - - if (packet.id && packet.ack != 'data') { - this.log.debug('acknowledging packet automatically'); - - var ack = parser.encodePacket({ - type: 'ack' - , ackId: packet.id - , endpoint: packet.endpoint || '' - }); - - if (current && current.open) { - current.onDispatch(ack); - } else { - this.manager.onClientDispatch(this.id, ack); - this.store.publish('dispatch:' + this.id, ack); - } - } - - // handle packet locally or publish it - if (current) { - this.manager.onClientMessage(this.id, packet); - } else { - this.store.publish('message:' + this.id, packet); - } - } -}; - -/** - * Clears the heartbeat interval - * - * @api private - */ - -Transport.prototype.clearHeartbeatInterval = function () { - if (this.heartbeatInterval && this.manager.enabled('heartbeats')) { - clearTimeout(this.heartbeatInterval); - this.heartbeatInterval = null; - this.log.debug('cleared heartbeat interval for client', this.id); - } -}; - -/** - * Finishes the connection and makes sure client doesn't reopen - * - * @api private - */ - -Transport.prototype.disconnect = function (reason) { - this.packet({ type: 'disconnect' }); - this.end(reason); - - return this; -}; - -/** - * Closes the connection. - * - * @api private - */ - -Transport.prototype.close = function () { - if (this.open) { - this.doClose(); - this.onClose(); - } -}; - -/** - * Called upon a connection close. - * - * @api private - */ - -Transport.prototype.onClose = function () { - if (this.open) { - this.setCloseTimeout(); - this.clearHandlers(); - this.open = false; - this.manager.onClose(this.id); - this.store.publish('close', this.id); - } -}; - -/** - * Cleans up the connection, considers the client disconnected. - * - * @api private - */ - -Transport.prototype.end = function (reason) { - if (!this.disconnected) { - this.log.info('transport end (' + reason + ')'); - - var local = this.manager.transports[this.id]; - - this.close(); - this.clearTimeouts(); - this.disconnected = true; - - if (local) { - this.manager.onClientDisconnect(this.id, reason, true); - } else { - this.store.publish('disconnect:' + this.id, reason); - } - } -}; - -/** - * Signals that the transport should pause and buffer data. - * - * @api public - */ - -Transport.prototype.discard = function () { - this.log.debug('discarding transport'); - this.discarded = true; - this.clearTimeouts(); - this.clearHandlers(); - - return this; -}; - -/** - * Writes an error packet with the specified reason and advice. - * - * @param {Number} advice - * @param {Number} reason - * @api public - */ - -Transport.prototype.error = function (reason, advice) { - this.packet({ - type: 'error' - , reason: reason - , advice: advice - }); - - this.log.warn(reason, advice ? ('client should ' + advice) : ''); - this.end('error'); -}; - -/** - * Write a packet. - * - * @api public - */ - -Transport.prototype.packet = function (obj) { - return this.write(parser.encodePacket(obj)); -}; - -/** - * Writes a volatile message. - * - * @api private - */ - -Transport.prototype.writeVolatile = function (msg) { - if (this.open) { - if (this.drained) { - this.write(msg); - } else { - this.log.debug('ignoring volatile packet, buffer not drained'); - } - } else { - this.log.debug('ignoring volatile packet, transport not open'); - } -}; diff --git a/node_modules/socket.io/lib/transports/flashsocket.js b/node_modules/socket.io/lib/transports/flashsocket.js deleted file mode 100644 index dc2d78b489..0000000000 --- a/node_modules/socket.io/lib/transports/flashsocket.js +++ /dev/null @@ -1,129 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ -var WebSocket = require('./websocket'); - -/** - * Export the constructor. - */ - -exports = module.exports = FlashSocket; - -/** - * The FlashSocket transport is just a proxy - * for WebSocket connections. - * - * @api public - */ - -function FlashSocket (mng, data, req) { - return WebSocket.call(this, mng, data, req); -} - -/** - * Inherits from WebSocket. - */ - -FlashSocket.prototype.__proto__ = WebSocket.prototype; - -/** - * Transport name - * - * @api public - */ - -FlashSocket.prototype.name = 'flashsocket'; - -/** - * Listens for new configuration changes of the Manager - * this way we can enable and disable the flash server. - * - * @param {Manager} Manager instance. - * @api private - */ - - -FlashSocket.init = function (manager) { - var server; - function create () { - - // Drop out immediately if the user has - // disabled the flash policy server - if (!manager.get('flash policy server')) { - return; - } - - server = require('policyfile').createServer({ - log: function(msg){ - manager.log.info(msg); - } - }, manager.get('origins')); - - server.on('close', function (e) { - server = null; - }); - - server.listen(manager.get('flash policy port'), manager.server); - - manager.flashPolicyServer = server; - } - - // listen for origin changes, so we can update the server - manager.on('set:origins', function (value, key) { - if (!server) return; - - // update the origins and compile a new response buffer - server.origins = Array.isArray(value) ? value : [value]; - server.compile(); - }); - - // destory the server and create a new server - manager.on('set:flash policy port', function (value, key) { - var transports = manager.get('transports'); - if (~transports.indexOf('flashsocket')) { - if (server) { - if (server.port === value) return; - // destroy the server and rebuild it on a new port - try { - server.close(); - } - catch (e) { /* ignore exception. could e.g. be that the server isn't started yet */ } - } - create(); - } - }); - - // create or destroy the server - manager.on('set:flash policy server', function (value, key) { - var transports = manager.get('transports'); - if (~transports.indexOf('flashsocket')) { - if (server && !value) { - // destroy the server - try { - server.close(); - } - catch (e) { /* ignore exception. could e.g. be that the server isn't started yet */ } - } - } else if (!server && value) { - // create the server - create(); - } - }); - - // only start the server - manager.on('set:transports', function (value, key){ - if (!server && ~manager.get('transports').indexOf('flashsocket')) { - create(); - } - }); - // check if we need to initialize at start - if (~manager.get('transports').indexOf('flashsocket')){ - create(); - } -}; diff --git a/node_modules/socket.io/lib/transports/htmlfile.js b/node_modules/socket.io/lib/transports/htmlfile.js deleted file mode 100644 index e8709a31ea..0000000000 --- a/node_modules/socket.io/lib/transports/htmlfile.js +++ /dev/null @@ -1,82 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPTransport = require('./http'); - -/** - * Export the constructor. - */ - -exports = module.exports = HTMLFile; - -/** - * HTMLFile transport constructor. - * - * @api public - */ - -function HTMLFile (mng, data, req) { - HTTPTransport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -HTMLFile.prototype.__proto__ = HTTPTransport.prototype; - -/** - * Transport name - * - * @api public - */ - -HTMLFile.prototype.name = 'htmlfile'; - -/** - * Handles the request. - * - * @api private - */ - -HTMLFile.prototype.handleRequest = function (req) { - HTTPTransport.prototype.handleRequest.call(this, req); - - if (req.method == 'GET') { - req.res.writeHead(200, { - 'Content-Type': 'text/html; charset=UTF-8' - , 'Connection': 'keep-alive' - , 'Transfer-Encoding': 'chunked' - }); - - req.res.write( - '' - + '' - + new Array(174).join(' ') - ); - } -}; - -/** - * Performs the write. - * - * @api private - */ - -HTMLFile.prototype.write = function (data) { - data = ''; - - if (this.response.write(data)) { - this.drained = true; - } - - this.log.debug(this.name + ' writing', data); -}; diff --git a/node_modules/socket.io/lib/transports/http-polling.js b/node_modules/socket.io/lib/transports/http-polling.js deleted file mode 100644 index 89b7e0428b..0000000000 --- a/node_modules/socket.io/lib/transports/http-polling.js +++ /dev/null @@ -1,147 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPTransport = require('./http'); - -/** - * Exports the constructor. - */ - -exports = module.exports = HTTPPolling; - -/** - * HTTP polling constructor. - * - * @api public. - */ - -function HTTPPolling (mng, data, req) { - HTTPTransport.call(this, mng, data, req); -}; - -/** - * Inherits from HTTPTransport. - * - * @api public. - */ - -HTTPPolling.prototype.__proto__ = HTTPTransport.prototype; - -/** - * Transport name - * - * @api public - */ - -HTTPPolling.prototype.name = 'httppolling'; - -/** - * Override setHandlers - * - * @api private - */ - -HTTPPolling.prototype.setHandlers = function () { - HTTPTransport.prototype.setHandlers.call(this); - this.socket.removeListener('end', this.bound.end); - this.socket.removeListener('close', this.bound.close); -}; - -/** - * Removes heartbeat timeouts for polling. - */ - -HTTPPolling.prototype.setHeartbeatInterval = function () { - return this; -}; - -/** - * Handles a request - * - * @api private - */ - -HTTPPolling.prototype.handleRequest = function (req) { - HTTPTransport.prototype.handleRequest.call(this, req); - - if (req.method == 'GET') { - var self = this; - - this.pollTimeout = setTimeout(function () { - self.packet({ type: 'noop' }); - self.log.debug(self.name + ' closed due to exceeded duration'); - }, this.manager.get('polling duration') * 1000); - - this.log.debug('setting poll timeout'); - } -}; - -/** - * Clears polling timeout - * - * @api private - */ - -HTTPPolling.prototype.clearPollTimeout = function () { - if (this.pollTimeout) { - clearTimeout(this.pollTimeout); - this.pollTimeout = null; - this.log.debug('clearing poll timeout'); - } - - return this; -}; - -/** - * Override clear timeouts to clear the poll timeout - * - * @api private - */ - -HTTPPolling.prototype.clearTimeouts = function () { - HTTPTransport.prototype.clearTimeouts.call(this); - - this.clearPollTimeout(); -}; - -/** - * doWrite to clear poll timeout - * - * @api private - */ - -HTTPPolling.prototype.doWrite = function () { - this.clearPollTimeout(); -}; - -/** - * Performs a write. - * - * @api private. - */ - -HTTPPolling.prototype.write = function (data, close) { - this.doWrite(data); - this.response.end(); - this.onClose(); -}; - -/** - * Override end. - * - * @api private - */ - -HTTPPolling.prototype.end = function (reason) { - this.clearPollTimeout(); - return HTTPTransport.prototype.end.call(this, reason); -}; - diff --git a/node_modules/socket.io/lib/transports/http.js b/node_modules/socket.io/lib/transports/http.js deleted file mode 100644 index 28db794dfb..0000000000 --- a/node_modules/socket.io/lib/transports/http.js +++ /dev/null @@ -1,121 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../transport') - , parser = require('../parser') - , qs = require('querystring'); - -/** - * Export the constructor. - */ - -exports = module.exports = HTTPTransport; - -/** - * HTTP interface constructor. For all non-websocket transports. - * - * @api public - */ - -function HTTPTransport (mng, data, req) { - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -HTTPTransport.prototype.__proto__ = Transport.prototype; - -/** - * Handles a request. - * - * @api private - */ - -HTTPTransport.prototype.handleRequest = function (req) { - - // Always set the response in case an error is returned to the client - this.response = req.res; - - if (req.method == 'POST') { - var buffer = '' - , res = req.res - , origin = req.headers.origin - , headers = { 'Content-Length': 1, 'Content-Type': 'text/plain; charset=UTF-8' } - , self = this; - - req.on('data', function (data) { - buffer += data; - - if (Buffer.byteLength(buffer) >= self.manager.get('destroy buffer size')) { - buffer = ''; - req.connection.destroy(); - } - }); - - req.on('end', function () { - res.writeHead(200, headers); - res.end('1'); - - self.onData(self.postEncoded ? qs.parse(buffer).d : buffer); - }); - - // prevent memory leaks for uncompleted requests - req.on('close', function () { - buffer = ''; - self.onClose(); - }); - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - } else { - Transport.prototype.handleRequest.call(this, req); - } -}; - -/** - * Handles data payload. - * - * @api private - */ - -HTTPTransport.prototype.onData = function (data) { - var messages = parser.decodePayload(data); - this.log.debug(this.name + ' received data packet', data); - - for (var i = 0, l = messages.length; i < l; i++) { - this.onMessage(messages[i]); - } -}; - -/** - * Closes the request-response cycle - * - * @api private - */ - -HTTPTransport.prototype.doClose = function () { - this.response.end(); -}; - -/** - * Writes a payload of messages - * - * @api private - */ - -HTTPTransport.prototype.payload = function (msgs) { - this.write(parser.encodePayload(msgs)); -}; diff --git a/node_modules/socket.io/lib/transports/index.js b/node_modules/socket.io/lib/transports/index.js deleted file mode 100644 index b86555940c..0000000000 --- a/node_modules/socket.io/lib/transports/index.js +++ /dev/null @@ -1,12 +0,0 @@ - -/** - * Export transports. - */ - -module.exports = { - websocket: require('./websocket') - , flashsocket: require('./flashsocket') - , htmlfile: require('./htmlfile') - , 'xhr-polling': require('./xhr-polling') - , 'jsonp-polling': require('./jsonp-polling') -}; diff --git a/node_modules/socket.io/lib/transports/jsonp-polling.js b/node_modules/socket.io/lib/transports/jsonp-polling.js deleted file mode 100644 index ad7d5aff3c..0000000000 --- a/node_modules/socket.io/lib/transports/jsonp-polling.js +++ /dev/null @@ -1,97 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPPolling = require('./http-polling'); -var jsonpolling_re = /^\d+$/ - -/** - * Export the constructor. - */ - -exports = module.exports = JSONPPolling; - -/** - * JSON-P polling transport. - * - * @api public - */ - -function JSONPPolling (mng, data, req) { - HTTPPolling.call(this, mng, data, req); - - this.head = 'io.j[0]('; - this.foot = ');'; - - if (data.query.i && jsonpolling_re.test(data.query.i)) { - this.head = 'io.j[' + data.query.i + ']('; - } -}; - -/** - * Inherits from Transport. - */ - -JSONPPolling.prototype.__proto__ = HTTPPolling.prototype; - -/** - * Transport name - * - * @api public - */ - -JSONPPolling.prototype.name = 'jsonppolling'; - -/** - * Make sure POST are decoded. - */ - -JSONPPolling.prototype.postEncoded = true; - -/** - * Handles incoming data. - * Due to a bug in \n handling by browsers, we expect a JSONified string. - * - * @api private - */ - -JSONPPolling.prototype.onData = function (data) { - try { - data = JSON.parse(data); - } catch (e) { - this.error('parse', 'reconnect'); - return; - } - - HTTPPolling.prototype.onData.call(this, data); -}; - -/** - * Performs the write. - * - * @api private - */ - -JSONPPolling.prototype.doWrite = function (data) { - HTTPPolling.prototype.doWrite.call(this); - - var data = data === undefined - ? '' : this.head + JSON.stringify(data) + this.foot; - - this.response.writeHead(200, { - 'Content-Type': 'text/javascript; charset=UTF-8' - , 'Content-Length': Buffer.byteLength(data) - , 'Connection': 'Keep-Alive' - , 'X-XSS-Protection': '0' - }); - - this.response.write(data); - this.log.debug(this.name + ' writing', data); -}; diff --git a/node_modules/socket.io/lib/transports/websocket.js b/node_modules/socket.io/lib/transports/websocket.js deleted file mode 100644 index 78a43043d5..0000000000 --- a/node_modules/socket.io/lib/transports/websocket.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var protocolVersions = require('./websocket/'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - var transport - , version = req.headers['sec-websocket-version']; - if (typeof version !== 'undefined' && typeof protocolVersions[version] !== 'undefined') { - transport = new protocolVersions[version](mng, data, req); - } - else transport = new protocolVersions['default'](mng, data, req); - if (typeof this.name !== 'undefined') transport.name = this.name; - return transport; -}; diff --git a/node_modules/socket.io/lib/transports/websocket/default.js b/node_modules/socket.io/lib/transports/websocket/default.js deleted file mode 100644 index 091fdd44fd..0000000000 --- a/node_modules/socket.io/lib/transports/websocket/default.js +++ /dev/null @@ -1,362 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , parser = require('../../parser'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.log.debug(self.name + ' received data packet', packet); - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function () { - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = 'hixie-76'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - this.socket.setNoDelay(true); - - this.buffer = true; - this.buffered = []; - - if (this.req.headers.upgrade !== 'WebSocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['origin'] - , waitingForNonce = false; - if(this.manager.settings['match origin protocol']){ - location = (origin.indexOf('https')>-1 ? 'wss' : 'ws') + '://' + this.req.headers.host + this.req.url; - }else if(this.socket.encrypted){ - location = 'wss://' + this.req.headers.host + this.req.url; - }else{ - location = 'ws://' + this.req.headers.host + this.req.url; - } - - if (this.req.headers['sec-websocket-key1']) { - // If we don't have the nonce yet, wait for it (HAProxy compatibility). - if (! (this.req.head && this.req.head.length >= 8)) { - waitingForNonce = true; - } - - var headers = [ - 'HTTP/1.1 101 WebSocket Protocol Handshake' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Origin: ' + origin - , 'Sec-WebSocket-Location: ' + location - ]; - - if (this.req.headers['sec-websocket-protocol']){ - headers.push('Sec-WebSocket-Protocol: ' - + this.req.headers['sec-websocket-protocol']); - } - } else { - var headers = [ - 'HTTP/1.1 101 Web Socket Protocol Handshake' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'WebSocket-Origin: ' + origin - , 'WebSocket-Location: ' + location - ]; - } - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - this.socket.setEncoding('utf8'); - } catch (e) { - this.end(); - return; - } - - if (waitingForNonce) { - this.socket.setEncoding('binary'); - } else if (this.proveReception(headers)) { - self.flush(); - } - - var headBuffer = ''; - - this.socket.on('data', function (data) { - if (waitingForNonce) { - headBuffer += data; - - if (headBuffer.length < 8) { - return; - } - - // Restore the connection to utf8 encoding after receiving the nonce - self.socket.setEncoding('utf8'); - waitingForNonce = false; - - // Stuff the nonce into the location where it's expected to be - self.req.head = headBuffer.substr(0, 8); - headBuffer = ''; - - if (self.proveReception(headers)) { - self.flush(); - } - - return; - } - - self.parser.add(data); - }); -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - this.drained = false; - - if (this.buffer) { - this.buffered.push(data); - return this; - } - - var length = Buffer.byteLength(data) - , buffer = new Buffer(2 + length); - - buffer.write('\x00', 'binary'); - buffer.write(data, 1, 'utf8'); - buffer.write('\xff', 1 + length, 'binary'); - - try { - if (this.socket.write(buffer)) { - this.drained = true; - } - } catch (e) { - this.end(); - } - - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Flushes the internal buffer - * - * @api private - */ - -WebSocket.prototype.flush = function () { - this.buffer = false; - - for (var i = 0, l = this.buffered.length; i < l; i++) { - this.write(this.buffered.splice(0, 1)[0]); - } -}; - -/** - * Finishes the handshake. - * - * @api private - */ - -WebSocket.prototype.proveReception = function (headers) { - var self = this - , k1 = this.req.headers['sec-websocket-key1'] - , k2 = this.req.headers['sec-websocket-key2']; - - if (k1 && k2){ - var 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){ - self.log.warn('Invalid ' + self.name + ' key: "' + k + '".'); - self.end(); - return false; - } - - n /= spaces; - - md5.update(String.fromCharCode( - n >> 24 & 0xFF, - n >> 16 & 0xFF, - n >> 8 & 0xFF, - n & 0xFF)); - }); - - md5.update(this.req.head.toString('binary')); - - try { - this.socket.write(md5.digest('binary'), 'binary'); - } catch (e) { - this.end(); - } - } - - return true; -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.buffer = ''; - this.i = 0; -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Adds data to the buffer. - * - * @api public - */ - -Parser.prototype.add = function (data) { - this.buffer += data; - this.parse(); -}; - -/** - * Parses the buffer. - * - * @api private - */ - -Parser.prototype.parse = function () { - for (var i = this.i, chr, l = this.buffer.length; i < l; i++){ - chr = this.buffer[i]; - - if (this.buffer.length == 2 && this.buffer[1] == '\u0000') { - this.emit('close'); - this.buffer = ''; - this.i = 0; - return; - } - - if (i === 0){ - if (chr != '\u0000') - this.error('Bad framing. Expected null byte as first frame'); - else - continue; - } - - if (chr == '\ufffd'){ - this.emit('data', this.buffer.substr(1, i - 1)); - this.buffer = this.buffer.substr(i + 1); - this.i = 0; - return this.parse(); - } - } -}; - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.buffer = ''; - this.i = 0; - this.emit('error', reason); - return this; -}; diff --git a/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js b/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js deleted file mode 100644 index 44f666a543..0000000000 --- a/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js +++ /dev/null @@ -1,622 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , url = require('url') - , parser = require('../../parser') - , util = require('../../util'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; -exports.Parser = Parser; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.manager = mng; - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('ping', function () { - // version 8 ping => pong - try { - self.socket.write('\u008a\u0000'); - } - catch (e) { - self.end(); - return; - } - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function (reason) { - self.log.warn(self.name + ' parser error: ' + reason); - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = '07-12'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - if (typeof this.req.headers.upgrade === 'undefined' || - this.req.headers.upgrade.toLowerCase() !== 'websocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['sec-websocket-origin'] - , location = ((this.manager.settings['match origin protocol'] ? - origin.match(/^https/) : this.socket.encrypted) ? - 'wss' : 'ws') - + '://' + this.req.headers.host + this.req.url; - - if (!this.verifyOrigin(origin)) { - this.log.warn(this.name + ' connection invalid: origin mismatch'); - this.end(); - return; - } - - if (!this.req.headers['sec-websocket-key']) { - this.log.warn(this.name + ' connection invalid: received no key'); - this.end(); - return; - } - - // calc key - var key = this.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 - ]; - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - } catch (e) { - this.end(); - return; - } - - this.socket.on('data', function (data) { - self.parser.add(data); - }); -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -WebSocket.prototype.verifyOrigin = function (origin) { - var origins = this.manager.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from websocket call, yet required by config'); - } - return false; -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - var buf = this.frame(0x81, data); - try { - this.socket.write(buf, 'binary'); - } - catch (e) { - this.end(); - return; - } - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Frame server-to-client output as a text packet. - * - * @api private - */ - -WebSocket.prototype.frame = function (opcode, str) { - var dataBuffer = new Buffer(str) - , dataLength = dataBuffer.length - , startOffset = 2 - , secondByte = dataLength; - if (dataLength > 65536) { - startOffset = 10; - secondByte = 127; - } - else if (dataLength > 125) { - startOffset = 4; - secondByte = 126; - } - var outputBuffer = new Buffer(dataLength + startOffset); - outputBuffer[0] = opcode; - outputBuffer[1] = secondByte; - dataBuffer.copy(outputBuffer, startOffset); - switch (secondByte) { - case 126: - outputBuffer[2] = dataLength >>> 8; - outputBuffer[3] = dataLength % 256; - break; - case 127: - var l = dataLength; - for (var i = 1; i <= 8; ++i) { - outputBuffer[startOffset - i] = l & 0xff; - l >>>= 8; - } - } - return outputBuffer; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.overflow = null; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = ''; - - var self = this; - this.opcodeHandlers = { - // text - '1': function(data) { - var finish = function(mask, data) { - self.currentMessage += self.unmask(mask, data); - if (self.state.lastFragment) { - self.emit('data', self.currentMessage); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // binary - '2': function(data) { - var finish = function(mask, data) { - if (typeof self.currentMessage == 'string') self.currentMessage = []; // build a buffer list - self.currentMessage.push(self.unmask(mask, data, true)); - if (self.state.lastFragment) { - self.emit('binary', self.concatBuffers(self.currentMessage)); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // close - '8': function(data) { - self.emit('close'); - self.reset(); - }, - // ping - '9': function(data) { - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported'); - return; - } - - var finish = function(mask, data) { - self.emit('ping', self.unmask(mask, data)); - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength == 0) { - finish(null, null); - } - else if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - expectData(util.unpack(data)); - }); - } - } - } - - this.expect('Opcode', 2, this.processPacket); -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add new data to the parser. - * - * @api public - */ - -Parser.prototype.add = function(data) { - if (this.expectBuffer == null) { - this.addToOverflow(data); - return; - } - var toRead = Math.min(data.length, this.expectBuffer.length - this.expectOffset); - data.copy(this.expectBuffer, this.expectOffset, 0, toRead); - this.expectOffset += toRead; - if (toRead < data.length) { - // at this point the overflow buffer shouldn't at all exist - this.overflow = new Buffer(data.length - toRead); - data.copy(this.overflow, 0, toRead, toRead + this.overflow.length); - } - if (this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -} - -/** - * Adds a piece of data to the overflow. - * - * @api private - */ - -Parser.prototype.addToOverflow = function(data) { - if (this.overflow == null) this.overflow = data; - else { - var prevOverflow = this.overflow; - this.overflow = new Buffer(this.overflow.length + data.length); - prevOverflow.copy(this.overflow, 0); - data.copy(this.overflow, prevOverflow.length); - } -} - -/** - * Waits for a certain amount of bytes to be available, then fires a callback. - * - * @api private - */ - -Parser.prototype.expect = function(what, length, handler) { - this.expectBuffer = new Buffer(length); - this.expectOffset = 0; - this.expectHandler = handler; - if (this.overflow != null) { - var toOverflow = this.overflow; - this.overflow = null; - this.add(toOverflow); - } -} - -/** - * Start processing a new packet. - * - * @api private - */ - -Parser.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty'); - } - 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.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode') - return; - } - } - else { - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.activeFragmentedOperation = opcode; - } - } - var handler = this.opcodeHandlers[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode); - else handler(data); -} - -/** - * Endprocessing a packet. - * - * @api private - */ - -Parser.prototype.endPacket = function() { - 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.expect('Opcode', 2, this.processPacket); -} - -/** - * Reset the parser state. - * - * @api private - */ - -Parser.prototype.reset = function() { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = null; - this.currentMessage = ''; -} - -/** - * Unmask received data. - * - * @api private - */ - -Parser.prototype.unmask = function (mask, buf, binary) { - if (mask != null) { - for (var i = 0, ll = buf.length; i < ll; i++) { - buf[i] ^= mask[i % 4]; - } - } - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -} - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Parser.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); - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - buffers[i].copy(mergedBuffer, offset); - offset += buffers[i].length; - } - return mergedBuffer; -} - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.reset(); - this.emit('error', reason); - return this; -}; diff --git a/node_modules/socket.io/lib/transports/websocket/hybi-16.js b/node_modules/socket.io/lib/transports/websocket/hybi-16.js deleted file mode 100644 index 69967dad28..0000000000 --- a/node_modules/socket.io/lib/transports/websocket/hybi-16.js +++ /dev/null @@ -1,622 +0,0 @@ -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var Transport = require('../../transport') - , EventEmitter = process.EventEmitter - , crypto = require('crypto') - , url = require('url') - , parser = require('../../parser') - , util = require('../../util'); - -/** - * Export the constructor. - */ - -exports = module.exports = WebSocket; -exports.Parser = Parser; - -/** - * HTTP interface constructor. Interface compatible with all transports that - * depend on request-response cycles. - * - * @api public - */ - -function WebSocket (mng, data, req) { - // parser - var self = this; - - this.manager = mng; - this.parser = new Parser(); - this.parser.on('data', function (packet) { - self.onMessage(parser.decodePacket(packet)); - }); - this.parser.on('ping', function () { - // version 8 ping => pong - try { - self.socket.write('\u008a\u0000'); - } - catch (e) { - self.end(); - return; - } - }); - this.parser.on('close', function () { - self.end(); - }); - this.parser.on('error', function (reason) { - self.log.warn(self.name + ' parser error: ' + reason); - self.end(); - }); - - Transport.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -WebSocket.prototype.__proto__ = Transport.prototype; - -/** - * Transport name - * - * @api public - */ - -WebSocket.prototype.name = 'websocket'; - -/** - * Websocket draft version - * - * @api public - */ - -WebSocket.prototype.protocolVersion = '16'; - -/** - * Called when the socket connects. - * - * @api private - */ - -WebSocket.prototype.onSocketConnect = function () { - var self = this; - - if (typeof this.req.headers.upgrade === 'undefined' || - this.req.headers.upgrade.toLowerCase() !== 'websocket') { - this.log.warn(this.name + ' connection invalid'); - this.end(); - return; - } - - var origin = this.req.headers['origin'] || '' - , location = ((this.manager.settings['match origin protocol'] ? - origin.match(/^https/) : this.socket.encrypted) ? - 'wss' : 'ws') - + '://' + this.req.headers.host + this.req.url; - - if (!this.verifyOrigin(origin)) { - this.log.warn(this.name + ' connection invalid: origin mismatch'); - this.end(); - return; - } - - if (!this.req.headers['sec-websocket-key']) { - this.log.warn(this.name + ' connection invalid: received no key'); - this.end(); - return; - } - - // calc key - var key = this.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 - ]; - - try { - this.socket.write(headers.concat('', '').join('\r\n')); - this.socket.setTimeout(0); - this.socket.setNoDelay(true); - } catch (e) { - this.end(); - return; - } - - this.socket.on('data', function (data) { - self.parser.add(data); - }); -}; - -/** - * Verifies the origin of a request. - * - * @api private - */ - -WebSocket.prototype.verifyOrigin = function (origin) { - var origins = this.manager.get('origins'); - - if (origin === 'null') origin = '*'; - - if (origins.indexOf('*:*') !== -1) { - return true; - } - - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~origins.indexOf(parts.hostname + ':' + parts.port) || - ~origins.indexOf(parts.hostname + ':*') || - ~origins.indexOf('*:' + parts.port); - if (!ok) this.log.warn('illegal origin: ' + origin); - return ok; - } catch (ex) { - this.log.warn('error parsing origin'); - } - } - else { - this.log.warn('origin missing from websocket call, yet required by config'); - } - return false; -}; - -/** - * Writes to the socket. - * - * @api private - */ - -WebSocket.prototype.write = function (data) { - if (this.open) { - var buf = this.frame(0x81, data); - try { - this.socket.write(buf, 'binary'); - } - catch (e) { - this.end(); - return; - } - this.log.debug(this.name + ' writing', data); - } -}; - -/** - * Writes a payload. - * - * @api private - */ - -WebSocket.prototype.payload = function (msgs) { - for (var i = 0, l = msgs.length; i < l; i++) { - this.write(msgs[i]); - } - - return this; -}; - -/** - * Frame server-to-client output as a text packet. - * - * @api private - */ - -WebSocket.prototype.frame = function (opcode, str) { - var dataBuffer = new Buffer(str) - , dataLength = dataBuffer.length - , startOffset = 2 - , secondByte = dataLength; - if (dataLength > 65536) { - startOffset = 10; - secondByte = 127; - } - else if (dataLength > 125) { - startOffset = 4; - secondByte = 126; - } - var outputBuffer = new Buffer(dataLength + startOffset); - outputBuffer[0] = opcode; - outputBuffer[1] = secondByte; - dataBuffer.copy(outputBuffer, startOffset); - switch (secondByte) { - case 126: - outputBuffer[2] = dataLength >>> 8; - outputBuffer[3] = dataLength % 256; - break; - case 127: - var l = dataLength; - for (var i = 1; i <= 8; ++i) { - outputBuffer[startOffset - i] = l & 0xff; - l >>>= 8; - } - } - return outputBuffer; -}; - -/** - * Closes the connection. - * - * @api private - */ - -WebSocket.prototype.doClose = function () { - this.socket.end(); -}; - -/** - * WebSocket parser - * - * @api public - */ - -function Parser () { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.overflow = null; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = ''; - - var self = this; - this.opcodeHandlers = { - // text - '1': function(data) { - var finish = function(mask, data) { - self.currentMessage += self.unmask(mask, data); - if (self.state.lastFragment) { - self.emit('data', self.currentMessage); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // binary - '2': function(data) { - var finish = function(mask, data) { - if (typeof self.currentMessage == 'string') self.currentMessage = []; // build a buffer list - self.currentMessage.push(self.unmask(mask, data, true)); - if (self.state.lastFragment) { - self.emit('binary', self.concatBuffers(self.currentMessage)); - self.currentMessage = ''; - } - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - if (util.unpack(data.slice(0, 4)) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported'); - return; - } - var lengthBytes = data.slice(4); // note: cap to 32 bit length - expectData(util.unpack(data)); - }); - } - }, - // close - '8': function(data) { - self.emit('close'); - self.reset(); - }, - // ping - '9': function(data) { - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported'); - return; - } - - var finish = function(mask, data) { - self.emit('ping', self.unmask(mask, data)); - self.endPacket(); - } - - var expectData = function(length) { - if (self.state.masked) { - self.expect('Mask', 4, function(data) { - var mask = data; - self.expect('Data', length, function(data) { - finish(mask, data); - }); - }); - } - else { - self.expect('Data', length, function(data) { - finish(null, data); - }); - } - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength == 0) { - finish(null, null); - } - else if (firstLength < 126) { - expectData(firstLength); - } - else if (firstLength == 126) { - self.expect('Length', 2, function(data) { - expectData(util.unpack(data)); - }); - } - else if (firstLength == 127) { - self.expect('Length', 8, function(data) { - expectData(util.unpack(data)); - }); - } - } - } - - this.expect('Opcode', 2, this.processPacket); -}; - -/** - * Inherits from EventEmitter. - */ - -Parser.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add new data to the parser. - * - * @api public - */ - -Parser.prototype.add = function(data) { - if (this.expectBuffer == null) { - this.addToOverflow(data); - return; - } - var toRead = Math.min(data.length, this.expectBuffer.length - this.expectOffset); - data.copy(this.expectBuffer, this.expectOffset, 0, toRead); - this.expectOffset += toRead; - if (toRead < data.length) { - // at this point the overflow buffer shouldn't at all exist - this.overflow = new Buffer(data.length - toRead); - data.copy(this.overflow, 0, toRead, toRead + this.overflow.length); - } - if (this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -} - -/** - * Adds a piece of data to the overflow. - * - * @api private - */ - -Parser.prototype.addToOverflow = function(data) { - if (this.overflow == null) this.overflow = data; - else { - var prevOverflow = this.overflow; - this.overflow = new Buffer(this.overflow.length + data.length); - prevOverflow.copy(this.overflow, 0); - data.copy(this.overflow, prevOverflow.length); - } -} - -/** - * Waits for a certain amount of bytes to be available, then fires a callback. - * - * @api private - */ - -Parser.prototype.expect = function(what, length, handler) { - this.expectBuffer = new Buffer(length); - this.expectOffset = 0; - this.expectHandler = handler; - if (this.overflow != null) { - var toOverflow = this.overflow; - this.overflow = null; - this.add(toOverflow); - } -} - -/** - * Start processing a new packet. - * - * @api private - */ - -Parser.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty'); - 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.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode') - return; - } - } - else { - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.activeFragmentedOperation = opcode; - } - } - var handler = this.opcodeHandlers[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode); - else handler(data); -} - -/** - * Endprocessing a packet. - * - * @api private - */ - -Parser.prototype.endPacket = function() { - 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.expect('Opcode', 2, this.processPacket); -} - -/** - * Reset the parser state. - * - * @api private - */ - -Parser.prototype.reset = function() { - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0 - }; - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = null; - this.currentMessage = ''; -} - -/** - * Unmask received data. - * - * @api private - */ - -Parser.prototype.unmask = function (mask, buf, binary) { - if (mask != null) { - for (var i = 0, ll = buf.length; i < ll; i++) { - buf[i] ^= mask[i % 4]; - } - } - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -} - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Parser.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); - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - buffers[i].copy(mergedBuffer, offset); - offset += buffers[i].length; - } - return mergedBuffer; -} - -/** - * Handles an error - * - * @api private - */ - -Parser.prototype.error = function (reason) { - this.reset(); - this.emit('error', reason); - return this; -}; diff --git a/node_modules/socket.io/lib/transports/websocket/index.js b/node_modules/socket.io/lib/transports/websocket/index.js deleted file mode 100644 index 3a952b7598..0000000000 --- a/node_modules/socket.io/lib/transports/websocket/index.js +++ /dev/null @@ -1,11 +0,0 @@ - -/** - * Export websocket versions. - */ - -module.exports = { - 7: require('./hybi-07-12'), - 8: require('./hybi-07-12'), - 13: require('./hybi-16'), - default: require('./default') -}; diff --git a/node_modules/socket.io/lib/transports/xhr-polling.js b/node_modules/socket.io/lib/transports/xhr-polling.js deleted file mode 100644 index 1db5aeee0f..0000000000 --- a/node_modules/socket.io/lib/transports/xhr-polling.js +++ /dev/null @@ -1,69 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module requirements. - */ - -var HTTPPolling = require('./http-polling'); - -/** - * Export the constructor. - */ - -exports = module.exports = XHRPolling; - -/** - * Ajax polling transport. - * - * @api public - */ - -function XHRPolling (mng, data, req) { - HTTPPolling.call(this, mng, data, req); -}; - -/** - * Inherits from Transport. - */ - -XHRPolling.prototype.__proto__ = HTTPPolling.prototype; - -/** - * Transport name - * - * @api public - */ - -XHRPolling.prototype.name = 'xhr-polling'; - -/** - * Frames data prior to write. - * - * @api private - */ - -XHRPolling.prototype.doWrite = function (data) { - HTTPPolling.prototype.doWrite.call(this); - - var origin = this.req.headers.origin - , headers = { - 'Content-Type': 'text/plain; charset=UTF-8' - , 'Content-Length': data === undefined ? 0 : Buffer.byteLength(data) - , 'Connection': 'Keep-Alive' - }; - - if (origin) { - // https://developer.mozilla.org/En/HTTP_Access_Control - headers['Access-Control-Allow-Origin'] = origin; - headers['Access-Control-Allow-Credentials'] = 'true'; - } - - this.response.writeHead(200, headers); - this.response.write(data); - this.log.debug(this.name + ' writing', data); -}; diff --git a/node_modules/socket.io/lib/util.js b/node_modules/socket.io/lib/util.js deleted file mode 100644 index f7d9f2b4b4..0000000000 --- a/node_modules/socket.io/lib/util.js +++ /dev/null @@ -1,50 +0,0 @@ - -/*! - * socket.io-node - * Copyright(c) 2011 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -/** - * Converts an enumerable to an array. - * - * @api public - */ - -exports.toArray = function (enu) { - var arr = []; - - for (var i = 0, l = enu.length; i < l; i++) - arr.push(enu[i]); - - return arr; -}; - -/** - * Unpacks a buffer to a number. - * - * @api public - */ - -exports.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; -} - -/** - * Left pads a string. - * - * @api public - */ - -exports.padl = function (s,n,c) { - return new Array(1 + n - s.length).join(c) + s; -} - diff --git a/node_modules/socket.io/package.json b/node_modules/socket.io/package.json deleted file mode 100644 index b474ba7784..0000000000 --- a/node_modules/socket.io/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "socket.io", - "version": "0.9.14", - "description": "Real-time apps made cross-browser & easy with a WebSocket-like API", - "homepage": "http://socket.io", - "keywords": [ - "websocket", - "socket", - "realtime", - "socket.io", - "comet", - "ajax" - ], - "author": { - "name": "Guillermo Rauch", - "email": "guillermo@learnboost.com" - }, - "contributors": [ - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - }, - { - "name": "Arnout Kazemier", - "email": "info@3rd-eden.com" - }, - { - "name": "Vladimir Dronnikov", - "email": "dronnikov@gmail.com" - }, - { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/LearnBoost/socket.io.git" - }, - "dependencies": { - "socket.io-client": "0.9.11", - "policyfile": "0.0.4", - "base64id": "0.1.0", - "redis": "0.7.3" - }, - "devDependencies": { - "expresso": "0.9.2", - "should": "*", - "benchmark": "0.2.2", - "microtime": "0.1.3-1", - "colors": "0.5.1" - }, - "optionalDependencies": { - "redis": "0.7.3" - }, - "main": "index", - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "test": "make test" - }, - "_id": "socket.io@0.9.14", - "_engineSupported": true, - "_npmVersion": "1.1.4", - "_nodeVersion": "v0.6.12", - "_defaultsLoaded": true, - "dist": { - "shasum": "b865c2da3ae43df4f9933dc6f37e01e84a2fd1c6" - }, - "_from": "socket.io@0.9.14" -}