summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorThomas Davis <thomasalwyndavis@gmail.com>2012-05-04 00:25:36 +1000
committerThomas Davis <thomasalwyndavis@gmail.com>2012-05-04 00:25:36 +1000
commit721ed8d1616a801d76e43d0e403e636f142e5f61 (patch)
treecda87021779d32ba5627afe9317b2a4ee43239d5 /examples
parent6450f6820bc27f94380f6ce2125dde79d523bf16 (diff)
downloadbackbonetutorials-721ed8d1616a801d76e43d0e403e636f142e5f61.zip
backbonetutorials-721ed8d1616a801d76e43d0e403e636f142e5f61.tar.gz
backbonetutorials-721ed8d1616a801d76e43d0e403e636f142e5f61.tar.bz2
New tutorial
Diffstat (limited to 'examples')
-rw-r--r--examples/cross-domain/csrf.js35
-rw-r--r--examples/cross-domain/js/models/session.js24
-rw-r--r--examples/cross-domain/js/views/app.js11
-rw-r--r--examples/cross-domain/node_modules/connect/.npmignore12
-rw-r--r--examples/cross-domain/node_modules/connect/LICENSE24
-rw-r--r--examples/cross-domain/node_modules/connect/index.js4
-rw-r--r--examples/cross-domain/node_modules/connect/lib/cache.js81
-rw-r--r--examples/cross-domain/node_modules/connect/lib/connect.js87
-rw-r--r--examples/cross-domain/node_modules/connect/lib/index.js55
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/basicAuth.js98
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/bodyParser.js61
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/compress.js145
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/cookieParser.js62
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/cookieSession.js96
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/csrf.js75
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/directory.js227
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/errorHandler.js87
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/favicon.js86
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/json.js61
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/limit.js77
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/logger.js331
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/methodOverride.js40
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/multipart.js99
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/query.js46
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/responseTime.js32
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/session.js325
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/session/cookie.js129
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/session/memory.js131
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/session/session.js117
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/session/store.js86
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/static.js247
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/staticCache.js188
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/urlencoded.js54
-rw-r--r--examples/cross-domain/node_modules/connect/lib/middleware/vhost.js40
-rw-r--r--examples/cross-domain/node_modules/connect/lib/patch.js79
-rw-r--r--examples/cross-domain/node_modules/connect/lib/proto.js230
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/directory.html75
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/error.html13
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/favicon.icobin1406 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page.pngbin635 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_add.pngbin739 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_attach.pngbin794 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_code.pngbin818 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_copy.pngbin663 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_delete.pngbin740 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_edit.pngbin807 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_error.pngbin793 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_excel.pngbin817 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_find.pngbin879 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_gear.pngbin833 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_go.pngbin779 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_green.pngbin621 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_key.pngbin801 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_lightning.pngbin839 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_link.pngbin830 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_paintbrush.pngbin813 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_paste.pngbin703 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_red.pngbin641 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_refresh.pngbin858 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_save.pngbin774 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white.pngbin294 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_acrobat.pngbin591 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_actionscript.pngbin664 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_add.pngbin512 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_c.pngbin587 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_camera.pngbin656 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cd.pngbin666 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code.pngbin603 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code_red.pngbin587 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_coldfusion.pngbin592 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_compressed.pngbin724 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_copy.pngbin309 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cplusplus.pngbin621 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_csharp.pngbin700 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cup.pngbin639 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_database.pngbin579 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_delete.pngbin536 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_dvd.pngbin638 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_edit.pngbin618 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_error.pngbin623 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_excel.pngbin663 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_find.pngbin676 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_flash.pngbin582 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_freehand.pngbin639 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_gear.pngbin402 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_get.pngbin516 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_go.pngbin612 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_h.pngbin603 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_horizontal.pngbin296 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_key.pngbin616 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_lightning.pngbin669 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_link.pngbin614 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_magnify.pngbin554 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_medal.pngbin706 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_office.pngbin779 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paint.pngbin688 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paintbrush.pngbin618 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paste.pngbin620 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_php.pngbin538 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_picture.pngbin650 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_powerpoint.pngbin588 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_put.pngbin523 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_ruby.pngbin626 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_stack.pngbin317 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_star.pngbin565 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_swoosh.pngbin634 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text.pngbin342 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text_width.pngbin315 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_tux.pngbin668 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_vector.pngbin644 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_visualstudio.pngbin702 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_width.pngbin309 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_word.pngbin651 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_world.pngbin734 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_wrench.pngbin613 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_white_zip.pngbin386 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_word.pngbin777 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/icons/page_world.pngbin903 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/lib/public/style.css141
-rw-r--r--examples/cross-domain/node_modules/connect/lib/utils.js508
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/.gitmodules3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/README.md27
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/lib/crc.js362
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/package.json32
-rwxr-xr-xexamples/cross-domain/node_modules/connect/node_modules/crc/tests/crc_tests.js64
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md56
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE19
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile126
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/README.md430
-rwxr-xr-xexamples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit108
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit.json10
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/async.js602
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js125
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js483
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md60
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js1757
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js12
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js13
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html16
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.pngbin38642 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.pngbin14133 -> 0 bytes
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/index.js3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js316
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js236
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/nodeunit.js80
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/browser.js119
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js110
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js112
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js9
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js183
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/minimal.js117
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/skip_passed.js110
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/types.js187
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/utils.js209
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/man1/nodeunit.195
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/package.json53
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs19
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js11
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css70
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js219
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js114
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js55
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js214
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js125
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js46
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js31
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js234
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html26
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/.npmignore4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/History.md41
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/Makefile5
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/Readme.md130
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/debug.js122
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/example/app.js19
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/example/browser.html24
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/example/wildcards.js10
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/example/worker.js22
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/index.js2
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/lib/debug.js147
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/debug/package.json29
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/.npmignore4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/.travis.yml4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/Makefile14
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/Readme.md303
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/TODO3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js70
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/example/post.js43
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/example/upload.js48
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/index.js1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/file.js61
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/incoming_form.js378
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/index.js3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/multipart_parser.js312
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/querystring_parser.js25
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/lib/util.js6
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/package.json32
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/common.js19
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js3
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js21
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/multipart.js72
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js89
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/common.js24
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js80
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js104
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js726
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js50
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js45
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js72
-rwxr-xr-xexamples/cross-domain/node_modules/connect/node_modules/formidable/test/run.js2
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js63
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/formidable/tool/record.js47
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/LICENSE19
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/README.md50
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/mime.js92
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/package.json43
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/test.js79
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/types/mime.types1479
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/mime/types/node.types43
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/.gitmodules6
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/.npmignore1
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/.travis.yml4
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/History.md73
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/Makefile5
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/Readme.md54
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/benchmark.js17
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/examples.js51
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/index.js2
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/lib/querystring.js264
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/package.json33
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/test/mocha.opts2
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/test/parse.js167
-rw-r--r--examples/cross-domain/node_modules/connect/node_modules/qs/test/stringify.js103
-rw-r--r--examples/cross-domain/node_modules/connect/package.json48
-rw-r--r--examples/cross-domain/node_modules/connect/test.js11
-rw-r--r--examples/cross-domain/package.json5
-rw-r--r--examples/cross-domain/server.js51
-rw-r--r--examples/cross-domain/templates/layout.html4
250 files changed, 102 insertions, 17637 deletions
diff --git a/examples/cross-domain/csrf.js b/examples/cross-domain/csrf.js
new file mode 100644
index 0000000..4d85e70
--- /dev/null
+++ b/examples/cross-domain/csrf.js
@@ -0,0 +1,35 @@
+
+// TODO - Write a better csrf module lol
+// hacked this together for the tutorial
+
+var crypto = require('crypto');
+
+var generateToken = function(len) {
+ return crypto.randomBytes(Math.ceil(len * 3 / 4))
+ .toString('base64')
+ .slice(0, len);
+};
+function defaultValue(req) {
+ return (req.body && req.body._csrf)
+ || (req.query && req.query._csrf)
+ || (req.headers['x-csrf-token']);
+}
+var checkToken = function(req, res, next){
+ var token = req.session._csrf || (req.session._csrf = generateToken(24));
+ if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();
+ var val = defaultValue(req);
+ if (val != token) return next(function(){
+ res.send({auth: false});
+ });
+ next();
+}
+var newToken = function(req, res, next) {
+ var token = req.session._csrf || (req.session._csrf = generateToken(24));
+ next();
+}
+module.exports = {
+ check: checkToken,
+ generate: newToken
+};
+
+
diff --git a/examples/cross-domain/js/models/session.js b/examples/cross-domain/js/models/session.js
index b052c63..522b1fd 100644
--- a/examples/cross-domain/js/models/session.js
+++ b/examples/cross-domain/js/models/session.js
@@ -5,7 +5,21 @@ define([
var SessionModel = Backbone.Model.extend({
urlRoot: '/session',
-
+ initialize: function () {
+ var that = this;
+ // Hook into jquery
+ // Use withCredentials to send the server cookies
+ // The server must allow this through response headers
+ $.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
+ options.xhrFields = {
+ withCredentials: true
+ };
+ // If we have a csrf token send it through with the next request
+ if(typeof that.get('_csrf') !== 'undefined') {
+ jqXHR.setRequestHeader('X-CSRF-Token', that.get('_csrf'));
+ }
+ });
+ },
login: function(creds) {
// Do a POST to /session and send the serialized form creds
this.save(creds, {
@@ -16,10 +30,14 @@ define([
// Do a DELETE to /session and clear the clientside data
var that = this;
this.destroy({
- success: function (model) {
+ success: function (model, resp) {
+
model.clear()
// Set auth to false to trigger a change:auth event
- that.set({auth: false});
+ // The server also returns a new csrf token so that
+ // the user can relogin without refreshing the page
+ that.set({auth: false, _csrf: resp._csrf});
+
}
});
},
diff --git a/examples/cross-domain/js/views/app.js b/examples/cross-domain/js/views/app.js
index 6f0e2d0..601068d 100644
--- a/examples/cross-domain/js/views/app.js
+++ b/examples/cross-domain/js/views/app.js
@@ -31,13 +31,10 @@ define([
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
- // Your server goes below
- //options.url = 'http://localhost:8000' + options.url;
- options.url = 'http://cross-domain.nodejitsu.com' + options.url;
- options.xhrFields = {
- withCredentials: true
- };
- });
+ // Your server goes below
+ //options.url = 'http://localhost:8000' + options.url;
+ options.url = 'http://cross-domain.nodejitsu.com' + options.url;
+ });
},
render: function () {
diff --git a/examples/cross-domain/node_modules/connect/.npmignore b/examples/cross-domain/node_modules/connect/.npmignore
deleted file mode 100644
index 9046dde..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/LICENSE b/examples/cross-domain/node_modules/connect/LICENSE
deleted file mode 100644
index 0c5d22d..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/index.js b/examples/cross-domain/node_modules/connect/index.js
deleted file mode 100644
index 23240ee..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/cache.js b/examples/cross-domain/node_modules/connect/lib/cache.js
deleted file mode 100644
index 052fcdb..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/connect.js b/examples/cross-domain/node_modules/connect/lib/connect.js
deleted file mode 100644
index 8e52858..0000000
--- a/examples/cross-domain/node_modules/connect/lib/connect.js
+++ /dev/null
@@ -1,87 +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.2.1';
-
-/**
- * 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){ app.handle(req, res); }
- 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/examples/cross-domain/node_modules/connect/lib/index.js b/examples/cross-domain/node_modules/connect/lib/index.js
deleted file mode 100644
index 76ed8a1..0000000
--- a/examples/cross-domain/node_modules/connect/lib/index.js
+++ /dev/null
@@ -1,55 +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
- * - [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
- *
- * Internals:
- *
- * - server [prototype](proto.html)
- * - connect [utilities](utils.html)
- * - node monkey [patches](patch.html)
- *
- * 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/examples/cross-domain/node_modules/connect/lib/middleware/basicAuth.js b/examples/cross-domain/node_modules/connect/lib/middleware/basicAuth.js
deleted file mode 100644
index ce7ed41..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/basicAuth.js
+++ /dev/null
@@ -1,98 +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(' ')
- , scheme = parts[0]
- , credentials = new Buffer(parts[1], 'base64').toString().split(':')
- , user = credentials[0]
- , pass = credentials[1];
-
- if ('Basic' != scheme) return next(utils.error(400));
-
- // 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 = user;
- next();
- pause.resume();
- });
- // sync
- } else {
- if (callback(user, pass)) {
- req.user = user;
- next();
- } else {
- unauthorized(res, realm);
- }
- }
- }
-};
-
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/bodyParser.js b/examples/cross-domain/node_modules/connect/lib/middleware/bodyParser.js
deleted file mode 100644
index 9f692cd..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/middleware/compress.js b/examples/cross-domain/node_modules/connect/lib/middleware/compress.js
deleted file mode 100644
index 3bc4c4e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/compress.js
+++ /dev/null
@@ -1,145 +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){
- var type = res.getHeader('Content-Type') || '';
- return type.match(/json|text|javascript/);
-};
-
-/**
- * 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){
- * var type = res.getHeader('Content-Type') || '';
- * return type.match(/json|text|javascript/);
- * };
- *
- * 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) {
- var options = options || {}
- , names = Object.keys(exports.methods)
- , filter = options.filter || exports.filter;
-
- return function(req, res, next){
- var accept = req.headers['accept-encoding']
- , write = res.write
- , end = res.end
- , stream
- , method;
-
- // vary
- res.setHeader('Vary', 'Accept-Encoding');
-
- // proxy
-
- res.write = function(chunk, encoding){
- if (!this.headerSent) this._implicitHeader();
- return stream
- ? stream.write(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(){
- // 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/examples/cross-domain/node_modules/connect/lib/middleware/cookieParser.js b/examples/cross-domain/node_modules/connect/lib/middleware/cookieParser.js
deleted file mode 100644
index af8b097..0000000
--- a/examples/cross-domain/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 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 such as `session()`.
- *
- * Examples:
- *
- * connect()
- * .use(connect.cookieParser('keyboard cat'))
- * .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) {
- var cookie = req.headers.cookie;
- if (req.cookies) return next();
-
- req.secret = secret;
- req.cookies = {};
- req.signedCookies = {};
-
- if (cookie) {
- try {
- req.cookies = utils.parseCookie(cookie);
- if (secret) {
- req.signedCookies = utils.parseSignedCookies(req.cookies, secret);
- var obj = utils.parseJSONCookies(req.signedCookies);
- req.signedCookies = obj.cookies;
- req.cookieHashes = obj.hashes;
- }
- req.cookies = utils.parseJSONCookies(req.cookies).cookies;
- } catch (err) {
- return next(err);
- }
- }
- next();
- };
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/cookieSession.js b/examples/cross-domain/node_modules/connect/lib/middleware/cookieSession.js
deleted file mode 100644
index 5e00e4e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/cookieSession.js
+++ /dev/null
@@ -1,96 +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')
- , crc16 = require('crc').crc16;
-
-// environment
-
-var env = process.env.NODE_ENV;
-
-/**
- * Cookie Session:
- *
- * Cookie session middleware.
- *
- * var app = connect();
- * app.use(connect.cookieParser('tobo!'));
- * app.use(connect.cookieSession({ cookie: { maxAge: 60 * 60 * 1000 }}));
- *
- * Options:
- *
- * - `key` cookie name defaulting to `connect.sess`
- * - `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
- var options = options || {}
- , key = options.key || 'connect.sess'
- , cookie = options.cookie
- , trustProxy = options.proxy;
-
- return function cookieSession(req, res, next) {
- req.session = req.signedCookies[key] || {};
- req.session.cookie = new Cookie(req, cookie);
-
- res.on('header', function(){
- // removed
- if (!req.session) {
- debug('clear session');
- res.setHeader('Set-Cookie', key + '=; expires=' + new Date(0).toUTCString());
- return;
- }
-
- var cookie = req.session.cookie;
- 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
- var originalHash = req.cookieHashes && req.cookieHashes[key];
- var hash = crc16(val);
- if (originalHash == hash) return debug('unmodified session');
-
- // set-cookie
- val = utils.sign(val, req.secret);
- val = utils.serializeCookie(key, val, cookie);
- debug('set-cookie %j', cookie);
- res.setHeader('Set-Cookie', val);
- });
-
- next();
- };
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/csrf.js b/examples/cross-domain/node_modules/connect/lib/middleware/csrf.js
deleted file mode 100644
index 3ab3206..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/csrf.js
+++ /dev/null
@@ -1,75 +0,0 @@
-
-/*!
- * Connect - csrf
- * Copyright(c) 2011 Sencha Inc.
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , crypto = require('crypto');
-
-/**
- * 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) {
- var options = options || {}
- , value = options.value || defaultValue;
-
- return function(req, res, next){
- // generate CSRF token
- var token = req.session._csrf || (req.session._csrf = utils.uid(24));
-
- // ignore GET & HEAD (for now)
- 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/examples/cross-domain/node_modules/connect/lib/middleware/directory.js b/examples/cross-domain/node_modules/connect/lib/middleware/directory.js
deleted file mode 100644
index 7dcfb3c..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/directory.js
+++ /dev/null
@@ -1,227 +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) {
- var accept = req.headers.accept || 'text/plain'
- , url = parse(req.url)
- , dir = decodeURIComponent(url.pathname)
- , path = normalize(join(root, dir))
- , originalUrl = parse(req.originalUrl)
- , originalDir = decodeURIComponent(originalUrl.pathname)
- , showUp = path != root && path != root + '/';
-
- // null byte(s), bad request
- if (~path.indexOf('\0')) return next(utils.error(400));
-
- // malicious path, forbidden
- if (0 != path.indexOf(root)) return next(utils.error(403));
-
- // check if we have a directory
- fs.stat(path, function(err, stat){
- if (err) return 'ENOENT' == err.code
- ? next()
- : next(err);
-
- if (!stat.isDirectory()) return next();
-
- // fetch files
- fs.readdir(path, function(err, files){
- if (err) return next(err);
- if (!hidden) files = removeHidden(files);
- if (filter) files = files.filter(filter);
- files.sort();
-
- // content-negotiation
- for (var key in exports) {
- if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {
- exports[key](req, res, files, next, originalDir, showUp, icons);
- return;
- }
- }
-
- // not acceptable
- next(utils.error(406));
- });
- });
- };
-};
-
-/**
- * Respond with text/html.
- */
-
-exports.html = function(req, res, files, next, dir, showUp, icons){
- fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){
- if (err) return next(err);
- fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){
- if (err) return next(err);
- if (showUp) files.unshift('..');
- str = str
- .replace('{style}', style)
- .replace('{files}', html(files, dir, icons))
- .replace('{directory}', dir)
- .replace('{linked-path}', htmlPath(dir));
- res.setHeader('Content-Type', 'text/html');
- res.setHeader('Content-Length', str.length);
- res.end(str);
- });
- });
-};
-
-/**
- * Respond with application/json.
- */
-
-exports.json = function(req, res, files){
- files = JSON.stringify(files);
- res.setHeader('Content-Type', 'application/json');
- res.setHeader('Content-Length', files.length);
- res.end(files);
-};
-
-/**
- * Respond with text/plain.
- */
-
-exports.plain = function(req, res, files){
- files = files.join('\n') + '\n';
- res.setHeader('Content-Type', 'text/plain');
- res.setHeader('Content-Length', files.length);
- res.end(files);
-};
-
-/**
- * Map html `dir`, returning a linked path.
- */
-
-function htmlPath(dir) {
- var curr = [];
- return dir.split('/').map(function(part){
- curr.push(part);
- return '<a href="' + curr.join('/') + '">' + part + '</a>';
- }).join(' / ');
-}
-
-/**
- * Map html `files`, returning an html unordered list.
- */
-
-function html(files, dir, useIcons) {
- return '<ul id="files">' + files.map(function(file){
- var icon = ''
- , classes = [];
-
- if (useIcons && '..' != file) {
- icon = icons[extname(file)] || icons.default;
- icon = '<img src="data:image/png;base64,' + load(icon) + '" />';
- classes.push('icon');
- }
-
- return '<li><a href="'
- + join(dir, file)
- + '" class="'
- + classes.join(' ') + '"'
- + ' title="' + file + '">'
- + icon + file + '</a></li>';
-
- }).join('\n') + '</ul>';
-}
-
-/**
- * Load and cache the given `icon`.
- *
- * @param {String} icon
- * @return {String}
- * @api private
- */
-
-function load(icon) {
- if (cache[icon]) return cache[icon];
- return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
-}
-
-/**
- * Filter "hidden" `files`, aka files
- * beginning with a `.`.
- *
- * @param {Array} files
- * @return {Array}
- * @api private
- */
-
-function removeHidden(files) {
- return files.filter(function(file){
- return '.' != file[0];
- });
-}
-
-/**
- * Icon map.
- */
-
-var icons = {
- '.js': 'page_white_code_red.png'
- , '.c': 'page_white_c.png'
- , '.h': 'page_white_h.png'
- , '.cc': 'page_white_cplusplus.png'
- , '.php': 'page_white_php.png'
- , '.rb': 'page_white_ruby.png'
- , '.cpp': 'page_white_cplusplus.png'
- , '.swf': 'page_white_flash.png'
- , '.pdf': 'page_white_acrobat.png'
- , 'default': 'page_white.png'
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/errorHandler.js b/examples/cross-domain/node_modules/connect/lib/middleware/errorHandler.js
deleted file mode 100644
index b62aab7..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/errorHandler.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*!
- * Connect - errorHandler
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , url = require('url')
- , fs = require('fs');
-
-// environment
-
-var env = process.env.NODE_ENV || 'development';
-
-/**
- * Error handler:
- *
- * Development error handler, providing stack traces
- * and error message responses for requests accepting text, html,
- * or json.
- *
- * Text:
- *
- * By default, and when _text/plain_ is accepted a simple stack trace
- * or error message will be returned.
- *
- * JSON:
- *
- * When _application/json_ is accepted, connect will respond with
- * an object in the form of `{ "error": error }`.
- *
- * HTML:
- *
- * When accepted connect will output a nice html stack trace.
- *
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function errorHandler(){
- return function errorHandler(err, req, res, next){
- if (err.status) res.statusCode = err.status;
- if (res.statusCode < 400) res.statusCode = 500;
- if ('test' != env) console.error(err.stack);
- var accept = req.headers.accept || '';
- // html
- if (~accept.indexOf('html')) {
- fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
- fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
- var stack = (err.stack || '')
- .split('\n').slice(1)
- .map(function(v){ return '<li>' + v + '</li>'; }).join('');
- html = html
- .replace('{style}', style)
- .replace('{stack}', stack)
- .replace('{title}', exports.title)
- .replace('{statusCode}', res.statusCode)
- .replace(/\{error\}/g, utils.escape(err.toString()));
- res.setHeader('Content-Type', 'text/html; charset=utf-8');
- res.end(html);
- });
- });
- // json
- } else if (~accept.indexOf('json')) {
- var error = { message: err.message, stack: err.stack };
- for (var prop in err) error[prop] = err[prop];
- var json = JSON.stringify({ error: error });
- res.setHeader('Content-Type', 'application/json');
- res.end(json);
- // plain text
- } else {
- res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
- res.end(err.stack);
- }
- };
-};
-
-/**
- * Template title, framework authors may override this value.
- */
-
-exports.title = 'Connect';
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/favicon.js b/examples/cross-domain/node_modules/connect/lib/middleware/favicon.js
deleted file mode 100644
index b344218..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/favicon.js
+++ /dev/null
@@ -1,86 +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 cache.
- */
-
-var icon;
-
-/**
- * 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;
-
- 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();
- }
- };
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/json.js b/examples/cross-domain/node_modules/connect/lib/middleware/json.js
deleted file mode 100644
index dd14d8b..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/json.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*!
- * Connect - json
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils');
-
-/**
- * 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
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- var options = options || {}
- , strict = options.strict === false
- ? false
- : true;
-
- return function json(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
-
- // check Content-Type
- if ('application/json' != utils.mime(req)) return next();
-
- // flag as parsed
- req._body = true;
-
- // parse
- var buf = '';
- req.setEncoding('utf8');
- req.on('data', function(chunk){ buf += chunk });
- req.on('end', function(){
- if (strict && '{' != buf[0] && '[' != buf[0]) return next(utils.error(400));
- try {
- req.body = JSON.parse(buf, options.reviver);
- next();
- } catch (err){
- err.status = 400;
- next(err);
- }
- });
- }
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/limit.js b/examples/cross-domain/node_modules/connect/lib/middleware/limit.js
deleted file mode 100644
index d0b9d9b..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/limit.js
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/*!
- * Connect - limit
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils');
-
-/**
- * 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 = parse(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
- req.on('data', function(chunk){
- received += chunk.length;
- if (received > bytes) req.destroy();
- });
-
- next();
- };
-};
-
-/**
- * Parse byte `size` string.
- *
- * @param {String} size
- * @return {Number}
- * @api private
- */
-
-function parse(size) {
- var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/)
- , n = parseFloat(parts[1])
- , type = parts[2];
-
- var map = {
- kb: 1024
- , mb: 1024 * 1024
- , gb: 1024 * 1024 * 1024
- };
-
- return map[type] * n;
-} \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/logger.js b/examples/cross-domain/node_modules/connect/lib/middleware/logger.js
deleted file mode 100644
index 816f637..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/logger.js
+++ /dev/null
@@ -1,331 +0,0 @@
-
-/*!
- * Connect - logger
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/*!
- * 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(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(''), 'ascii');
- buf.length = 0;
- }
- }, interval);
-
- // swap the stream
- stream = {
- write: function(str){
- buf.push(str);
- }
- };
- }
-
- return function logger(req, res, next) {
- req._startTime = new Date;
-
- // mount safety
- if (req._logging) return next();
-
- // flag as logging
- req._logging = true;
-
- // immediate
- if (immediate) {
- var line = fmt(exports, req, res);
- if (null == line) return;
- stream.write(line + '\n', 'ascii');
- // 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', 'ascii');
- };
- }
-
-
- 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
- , color = 32;
-
- if (status >= 500) color = 31
- else if (status >= 400) color = 33
- else if (status >= 300) color = 36;
-
- return '\033[90m' + req.method
- + ' ' + req.originalUrl + ' '
- + '\033[' + color + 'm' + res.statusCode
- + ' \033[90m'
- + (new Date - req._startTime)
- + 'ms\033[0m';
-});
-
-/**
- * request url
- */
-
-exports.token('url', function(req){
- return req.originalUrl;
-});
-
-/**
- * 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){
- return req.socket && (req.socket.remoteAddress || (req.socket.socket && req.socket.socket.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/examples/cross-domain/node_modules/connect/lib/middleware/methodOverride.js b/examples/cross-domain/node_modules/connect/lib/middleware/methodOverride.js
deleted file mode 100644
index aaf4014..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/middleware/multipart.js b/examples/cross-domain/node_modules/connect/lib/middleware/multipart.js
deleted file mode 100644
index f48e4da..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/multipart.js
+++ /dev/null
@@ -1,99 +0,0 @@
-
-/*!
- * Connect - multipart
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var formidable = require('formidable')
- , utils = require('../utils')
- , qs = require('qs');
-
-/**
- * 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 }));
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- options = options || {};
- return function multipart(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
- req.files = req.files || {};
-
- // 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
- 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){
- next(err);
- done = true;
- });
-
- form.on('end', function(){
- if (done) return;
- try {
- req.body = qs.parse(data);
- req.files = qs.parse(files);
- next();
- } catch (err) {
- next(err);
- }
- });
-
- form.parse(req);
- }
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/query.js b/examples/cross-domain/node_modules/connect/lib/middleware/query.js
deleted file mode 100644
index 93fc5d3..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/middleware/responseTime.js b/examples/cross-domain/node_modules/connect/lib/middleware/responseTime.js
deleted file mode 100644
index 57858f6..0000000
--- a/examples/cross-domain/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(header){
- var duration = new Date - start;
- res.setHeader('X-Response-time', duration + 'ms');
- });
-
- next();
- };
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/session.js b/examples/cross-domain/node_modules/connect/lib/middleware/session.js
deleted file mode 100644
index 1585fe9..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/session.js
+++ /dev/null
@@ -1,325 +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')
- , Cookie = require('./session/cookie')
- , Store = require('./session/store')
- , utils = require('./../utils')
- , parse = utils.parseUrl
- , crc16 = require('crc').crc16
- , crypto = require('crypto');
-
-// 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('keyboard cat'))
- * .use(connect.session({ key: 'sid', cookie: { secure: true }}))
- *
- * Options:
- *
- * - `key` cookie name defaulting to `connect.sid`
- * - `store` session store instance
- * - `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('keyboard cat'))
- * .use(connect.session({ cookie: { maxAge: 60000 }}))
- * .use(function(req, res, next){
- * var sess = req.session;
- * if (sess.views) {
- * res.setHeader('Content-Type', 'text/html');
- * res.write('<p>views: ' + sess.views + '</p>');
- * res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
- * res.end();
- * sess.views++;
- * } else {
- * sess.views = 1;
- * res.end('welcome to the session demo. refresh!');
- * }
- * }
- * )).listen(3000);
- *
- * ## Session#regenerate()
- *
- * To regenerate the session simply invoke the method, once complete
- * a new SID and `Session` instance will be initialized at `req.session`.
- *
- * req.session.regenerate(function(err){
- * // will have a new session here
- * });
- *
- * ## Session#destroy()
- *
- * Destroys the session, removing `req.session`, will be re-generated next request.
- *
- * req.session.destroy(function(err){
- * // cannot access session here
- * });
- *
- * ## Session#reload()
- *
- * Reloads the session data.
- *
- * req.session.reload(function(err){
- * // session updated
- * });
- *
- * ## Session#save()
- *
- * Save the session.
- *
- * req.session.save(function(err){
- * // session saved
- * });
- *
- * ## Session#touch()
- *
- * Updates the `.maxAge` property. Typically this is
- * not necessary to call, as the session middleware does this for you.
- *
- * ## Session#cookie
- *
- * Each session has a unique cookie object accompany it. This allows
- * you to alter the session cookie per visitor. For example we can
- * set `req.session.cookie.expires` to `false` to enable the cookie
- * to remain for only the duration of the user-agent.
- *
- * ## Session#maxAge
- *
- * Alternatively `req.session.cookie.maxAge` will return the time
- * remaining in milliseconds, which we may also re-assign a new value
- * to adjust the `.expires` property appropriately. The following
- * are essentially equivalent
- *
- * var hour = 3600000;
- * req.session.cookie.expires = new Date(Date.now() + hour);
- * req.session.cookie.maxAge = hour;
- *
- * For example when `maxAge` is set to `60000` (one minute), and 30 seconds
- * has elapsed it will return `30000` until the current request has completed,
- * at which time `req.session.touch()` is called to reset `req.session.maxAge`
- * to its original value.
- *
- * req.session.cookie.maxAge;
- * // => 30000
- *
- * Session Store Implementation:
- *
- * Every session store _must_ implement the following methods
- *
- * - `.get(sid, callback)`
- * - `.set(sid, session, callback)`
- * - `.destroy(sid, callback)`
- *
- * Recommended methods include, but are not limited to:
- *
- * - `.length(callback)`
- * - `.clear(callback)`
- *
- * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-function session(options){
- var options = options || {}
- , key = options.key || 'connect.sid'
- , store = options.store || new MemoryStore
- , cookie = options.cookie
- , trustProxy = options.proxy;
-
- // 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(req, cookie);
- };
-
- return function session(req, res, next) {
- // self-awareness
- if (req.session) return next();
-
- // ensure secret is available or bail
- if (!req.secret) throw new Error('connect.cookieParser("secret") required for security when using sessions');
-
- // parse url
- var url = parse(req)
- , path = url.pathname
- , originalHash;
-
- // expose store
- req.sessionStore = store;
-
- // set-cookie
- res.on('header', function(){
- if (!req.session) return;
- var cookie = req.session.cookie
- , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
- , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
- , secured = cookie.secure && tls
- , isNew = req.signedCookies[key] != req.sessionID;
-
- // only send secure cookies via https
- if (cookie.secure && !secured) return debug('not secured');
-
- // browser-session length cookie
- if (null == cookie.expires) {
- if (!isNew) return debug('already set browser-session cookie');
- // compare hashes
- } else if (originalHash == hash(req.session)) {
- return debug('unmodified session');
- }
-
- var val = cookie.serialize(key, req.sessionID);
- 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(){
- debug('saved');
- res.end(data, encoding);
- });
- };
-
- // generate the session
- function generate() {
- store.generate(req);
- }
-
- // get the sessionID from the cookie
- req.sessionID = req.signedCookies[key];
-
- // 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');
- 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);
- originalHash = hash(sess);
- next();
- }
- });
- };
-};
-
-/**
- * Hash the given `sess` object omitting changes
- * to `.cookie`.
- *
- * @param {Object} sess
- * @return {String}
- * @api private
- */
-
-function hash(sess) {
- return crc16(JSON.stringify(sess, function(key, val){
- if ('cookie' != key) return val;
- }));
-}
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/session/cookie.js b/examples/cross-domain/node_modules/connect/lib/middleware/session/cookie.js
deleted file mode 100644
index 5e7f4c3..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/session/cookie.js
+++ /dev/null
@@ -1,129 +0,0 @@
-
-/*!
- * Connect - session - Cookie
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../../utils');
-
-/**
- * Initialize a new `Cookie` with the given `options`.
- *
- * @param {IncomingMessage} req
- * @param {Object} options
- * @api private
- */
-
-var Cookie = module.exports = function Cookie(req, options) {
- this.path = '/';
- this.maxAge = null;
- this.httpOnly = true;
- if (options) utils.merge(this, options);
- Object.defineProperty(this, 'req', { value: req });
- 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
- }
- },
-
- /**
- * Return a serialized cookie string.
- *
- * @return {String}
- * @api public
- */
-
- serialize: function(name, val){
- val = utils.sign(val, this.req.secret);
- return utils.serializeCookie(name, val, this.data);
- },
-
- /**
- * Return JSON representation of this cookie.
- *
- * @return {Object}
- * @api private
- */
-
- toJSON: function(){
- return this.data;
- }
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/session/memory.js b/examples/cross-domain/node_modules/connect/lib/middleware/session/memory.js
deleted file mode 100644
index ec569f5..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/session/memory.js
+++ /dev/null
@@ -1,131 +0,0 @@
-
-/*!
- * Connect - session - MemoryStore
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Store = require('./store')
- , utils = require('../../utils')
- , Session = require('./session');
-
-/**
- * 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/examples/cross-domain/node_modules/connect/lib/middleware/session/session.js b/examples/cross-domain/node_modules/connect/lib/middleware/session/session.js
deleted file mode 100644
index eba8fcf..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/session/session.js
+++ /dev/null
@@ -1,117 +0,0 @@
-
-/*!
- * Connect - session - Session
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../../utils')
- , Cookie = require('./cookie');
-
-/**
- * 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/examples/cross-domain/node_modules/connect/lib/middleware/session/store.js b/examples/cross-domain/node_modules/connect/lib/middleware/session/store.js
deleted file mode 100644
index d72d156..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/session/store.js
+++ /dev/null
@@ -1,86 +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')
- , utils = require('../../utils');
-
-/**
- * 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
- , update = null == update ? true : false;
- sess.cookie = new Cookie(req, 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;
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/static.js b/examples/cross-domain/node_modules/connect/lib/middleware/static.js
deleted file mode 100644
index 5f3c186..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/static.js
+++ /dev/null
@@ -1,247 +0,0 @@
-/*!
- * Connect - staticProvider
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var fs = require('fs')
- , path = require('path')
- , join = path.join
- , basename = path.basename
- , normalize = path.normalize
- , utils = require('../utils')
- , Buffer = require('buffer').Buffer
- , parse = require('url').parse
- , mime = require('mime');
-
-/**
- * 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
- *
- * @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');
- options.root = root;
-
- return function static(req, res, next) {
- options.path = req.url;
- options.getOnly = true;
- send(req, res, next, options);
- };
-};
-
-/**
- * Expose mime module.
- *
- * If you wish to extend the mime table use this
- * reference to the "mime" module in the npm registry.
- */
-
-exports.mime = mime;
-
-/**
- * decodeURIComponent.
- *
- * Allows V8 to only deoptimize this fn instead of all
- * of send().
- *
- * @param {String} path
- * @api private
- */
-
-function decode(path){
- try {
- return decodeURIComponent(path);
- } catch (err) {
- return err;
- }
-}
-
-/**
- * Attempt to tranfer the requested file to `res`.
- *
- * @param {ServerRequest}
- * @param {ServerResponse}
- * @param {Function} next
- * @param {Object} options
- * @api private
- */
-
-var send = exports.send = function(req, res, next, options){
- options = options || {};
- if (!options.path) throw new Error('path required');
-
- // setup
- var maxAge = options.maxAge || 0
- , ranges = req.headers.range
- , head = 'HEAD' == req.method
- , get = 'GET' == req.method
- , root = options.root ? normalize(options.root) : null
- , redirect = false === options.redirect ? false : true
- , getOnly = options.getOnly
- , fn = options.callback
- , hidden = options.hidden
- , done;
-
- // replace next() with callback when available
- if (fn) next = fn;
-
- // ignore non-GET requests
- if (getOnly && !get && !head) return next();
-
- // parse url
- var url = parse(options.path)
- , path = decode(url.pathname)
- , type;
-
- if (path instanceof URIError) return next(utils.error(400));
-
- // null byte(s)
- if (~path.indexOf('\0')) return next(utils.error(400));
-
- // when root is not given, consider .. malicious
- if (!root && ~path.indexOf('..')) return next(utils.error(403));
-
- // index.html support
- if ('/' == path[path.length - 1]) path += 'index.html';
-
- // join / normalize from optional root dir
- path = normalize(join(root, path));
-
- // malicious path
- if (root && 0 != path.indexOf(root)) return next(utils.error(403));
-
- // "hidden" file
- if (!hidden && '.' == basename(path)[0]) return next();
-
- fs.stat(path, function(err, stat){
- // mime type
- type = mime.lookup(path);
-
- // ignore ENOENT
- if (err) {
- if (fn) return fn(err);
- return ('ENOENT' == err.code || 'ENAMETOOLONG' == err.code)
- ? next()
- : next(err);
- // redirect directory in case index.html is present
- } else if (stat.isDirectory()) {
- if (!redirect) return next();
- url = parse(req.originalUrl);
- res.statusCode = 301;
- res.setHeader('Location', url.pathname + '/');
- res.end('Redirecting to ' + url.pathname + '/');
- return;
- }
-
- // header fields
- if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString());
- if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (maxAge / 1000));
- if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString());
- if (!res.getHeader('Content-Type')) {
- var charset = mime.charsets.lookup(type);
- res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
- }
- res.setHeader('Accept-Ranges', 'bytes');
-
- // conditional GET support
- if (utils.conditionalGET(req)) {
- if (!utils.modified(req, res)) {
- req.emit('static');
- return utils.notModified(res);
- }
- }
-
- var opts = {}
- , len = stat.size;
-
- // we have a Range request
- if (ranges) {
- ranges = utils.parseRange(len, ranges);
-
- // valid
- if (ranges) {
- opts.start = ranges[0].start;
- opts.end = ranges[0].end;
-
- // unsatisfiable range
- if (opts.start > len - 1) {
- res.setHeader('Content-Range', 'bytes */' + stat.size);
- return next(utils.error(416));
- }
-
- // limit last-byte-pos to current length
- if (opts.end > len - 1) opts.end= len - 1;
-
- // Content-Range
- len = opts.end - opts.start + 1;
- res.statusCode = 206;
- res.setHeader('Content-Range', 'bytes '
- + opts.start
- + '-'
- + opts.end
- + '/'
- + stat.size);
- }
- }
-
- res.setHeader('Content-Length', len);
-
- // transfer
- if (head) return res.end();
-
- // stream
- var stream = fs.createReadStream(path, opts);
- req.emit('static', stream);
- req.on('close', stream.destroy.bind(stream));
- stream.pipe(res);
-
- // callback
- if (fn) {
- function callback(err) { done || fn(err); done = true }
- req.on('close', callback);
- req.socket.on('error', callback);
- stream.on('error', callback);
- stream.on('end', callback);
- } else {
- stream.on('error', function(err){
- if (res.headerSent) {
- console.error(err.stack);
- req.destroy();
- } else {
- next(err);
- }
- });
- }
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/staticCache.js b/examples/cross-domain/node_modules/connect/lib/middleware/staticCache.js
deleted file mode 100644
index 34bf132..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/staticCache.js
+++ /dev/null
@@ -1,188 +0,0 @@
-
-/*!
- * Connect - staticCache
- * Copyright(c) 2011 Sencha Inc.
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var http = require('http')
- , utils = require('../utils')
- , Cache = require('../cache')
- , url = require('url')
- , fs = require('fs');
-
-/**
- * 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 {Type} name
- * @return {Type}
- * @api public
- */
-
-module.exports = function staticCache(options){
- var options = options || {}
- , cache = new Cache(options.maxObjects || 128)
- , maxlen = options.maxLength || 1024 * 256;
-
- return function staticCache(req, res, next){
- var path = url.parse(req.url).pathname
- , ranges = req.headers.range
- , hit = cache.get(path)
- , hitCC
- , uaCC
- , header
- , age;
-
- function miss() {
- res.setHeader('X-Cache', 'MISS');
- next();
- }
-
- // cache static
- // TODO: change from staticCache() -> static()
- // 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;
-
- // 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(path)){
- if (headers.etag == hit[0].etag) {
- hit[0].date = new Date;
- return;
- } else {
- cache.remove(path);
- }
- }
-
- // validation notifiactions don't contain a steam
- if (null == stream) return;
-
- // add the cache object
- var arr = cache.add(path);
- arr.push(headers);
-
- // store the chunks
- stream.on('data', function(chunk){
- arr.push(chunk);
- });
-
- // flag it as complete
- stream.on('end', function(){
- arr.complete = true;
- });
- });
-
- // cache hit, doesnt support range requests
- if (hit && hit.complete && !ranges) {
- header = utils.merge({}, hit[0]);
- header.Age = age = (new Date - new Date(header.date)) / 1000 | 0;
- header.date = new Date().toUTCString();
-
- // parse cache-controls
- hitCC = utils.parseCacheControl(header['cache-control'] || '');
- uaCC = utils.parseCacheControl(req.headers['cache-control'] || '');
-
- // check if we must revalidate(bypass)
- if (hitCC['no-cache'] || uaCC['no-cache']) return miss();
-
- // check freshness of entity
- if (isStale(hitCC, age) || isStale(uaCC, age)) return miss();
-
- // conditional GET support
- if (utils.conditionalGET(req)) {
- if (!utils.modified(req, res, header)) {
- header['content-length'] = 0;
- res.writeHead(304, header);
- return res.end();
- }
- }
-
- // HEAD support
- if ('HEAD' == req.method) {
- res.writeHead(200, header);
- return res.end();
- }
-
- // respond with cache
- header['x-cache'] = 'HIT';
- res.writeHead(200, header);
-
- // backpressure
- function write(i) {
- var buf = hit[i];
- if (!buf) return res.end();
- if (false === res.write(buf)) {
- res.once('drain', function(){
- write(++i);
- });
- } else {
- write(++i);
- }
- }
-
- return write(1);
- }
-
- miss();
- }
-};
-
-/**
- * Check if cache item is stale
- *
- * @param {Object} cc
- * @param {Number} age
- * @return {Boolean}
- * @api private
- */
-
-function isStale(cc, age) {
- return cc['max-age'] && cc['max-age'] <= age;
-} \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/urlencoded.js b/examples/cross-domain/node_modules/connect/lib/middleware/urlencoded.js
deleted file mode 100644
index 1d9149c..0000000
--- a/examples/cross-domain/node_modules/connect/lib/middleware/urlencoded.js
+++ /dev/null
@@ -1,54 +0,0 @@
-
-/*!
- * Connect - urlencoded
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var utils = require('../utils')
- , qs = require('qs');
-
-/**
- * Urlencoded:
- *
- * Parse x-ww-form-urlencoded request bodies,
- * providing the parsed object as `req.body`.
- *
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-exports = module.exports = function(options){
- options = options || {};
- return function urlencoded(req, res, next) {
- if (req._body) return next();
- req.body = req.body || {};
-
- // check Content-Type
- if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();
-
- // flag as parsed
- req._body = true;
-
- // parse
- 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){
- next(err);
- }
- });
- }
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/middleware/vhost.js b/examples/cross-domain/node_modules/connect/lib/middleware/vhost.js
deleted file mode 100644
index 897a9d8..0000000
--- a/examples/cross-domain/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(/[*]/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/examples/cross-domain/node_modules/connect/lib/patch.js b/examples/cross-domain/node_modules/connect/lib/patch.js
deleted file mode 100644
index 7cf0012..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/proto.js b/examples/cross-domain/node_modules/connect/lib/proto.js
deleted file mode 100644
index bca6ec4..0000000
--- a/examples/cross-domain/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.indexOf(layer.route)) 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/examples/cross-domain/node_modules/connect/lib/public/directory.html b/examples/cross-domain/node_modules/connect/lib/public/directory.html
deleted file mode 100644
index 15164bb..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/directory.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<html>
- <head>
- <title>listing directory {directory}</title>
- <style>{style}</style>
- <script>
- function $(id){
- var el = 'string' == typeof id
- ? document.getElementById(id)
- : id;
-
- el.on = function(event, fn){
- if ('content loaded' == event) event = 'DOMContentLoaded';
- el.addEventListener(event, fn, false);
- };
-
- el.all = function(selector){
- return $(el.querySelectorAll(selector));
- };
-
- el.each = function(fn){
- for (var i = 0, len = el.length; i < len; ++i) {
- fn($(el[i]), i);
- }
- };
-
- el.getClasses = function(){
- return this.getAttribute('class').split(/\s+/);
- };
-
- el.addClass = function(name){
- var classes = this.getAttribute('class');
- el.setAttribute('class', classes
- ? classes + ' ' + name
- : name);
- };
-
- el.removeClass = function(name){
- var classes = this.getClasses().filter(function(curr){
- return curr != name;
- });
- this.setAttribute('class', classes);
- };
-
- return el;
- }
-
- function search() {
- var str = $('search').value
- , links = $('files').all('a');
-
- links.each(function(link){
- var text = link.textContent;
-
- if ('..' == text) return;
- if (str.length && ~text.indexOf(str)) {
- link.addClass('highlight');
- } else {
- link.removeClass('highlight');
- }
- });
- }
-
- $(window).on('content loaded', function(){
- $('search').on('keyup', search);
- });
- </script>
- </head>
- <body class="directory">
- <input id="search" type="text" placeholder="Search" autocomplete="off" />
- <div id="wrapper">
- <h1>{linked-path}</h1>
- {files}
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/lib/public/error.html b/examples/cross-domain/node_modules/connect/lib/public/error.html
deleted file mode 100644
index c5ae73a..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/error.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
- <head>
- <title>{error}</title>
- <style>{style}</style>
- </head>
- <body>
- <div id="wrapper">
- <h1>{title}</h1>
- <h2><em>{statusCode}</em> {error}</h2>
- <ul id="stacktrace">{stack}</ul>
- </div>
- </body>
-</html>
diff --git a/examples/cross-domain/node_modules/connect/lib/public/favicon.ico b/examples/cross-domain/node_modules/connect/lib/public/favicon.ico
deleted file mode 100644
index 895fc96..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page.png
deleted file mode 100644
index 03ddd79..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_add.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_add.png
deleted file mode 100644
index d5bfa07..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_add.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_attach.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_attach.png
deleted file mode 100644
index 89ee2da..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_attach.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_code.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_code.png
deleted file mode 100644
index f7ea904..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_code.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_copy.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_copy.png
deleted file mode 100644
index 195dc6d..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_copy.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_delete.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_delete.png
deleted file mode 100644
index 3141467..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_delete.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_edit.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_edit.png
deleted file mode 100644
index 046811e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_edit.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_error.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_error.png
deleted file mode 100644
index f07f449..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_error.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_excel.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_excel.png
deleted file mode 100644
index eb6158e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_excel.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_find.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_find.png
deleted file mode 100644
index 2f19388..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_find.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_gear.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_gear.png
deleted file mode 100644
index 8e83281..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_gear.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_go.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_go.png
deleted file mode 100644
index 80fe1ed..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_go.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_green.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_green.png
deleted file mode 100644
index de8e003..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_green.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_key.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_key.png
deleted file mode 100644
index d6626cb..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_key.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_lightning.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_lightning.png
deleted file mode 100644
index 7e56870..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_lightning.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_link.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_link.png
deleted file mode 100644
index 312eab0..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_link.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_paintbrush.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_paintbrush.png
deleted file mode 100644
index 246a2f0..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_paintbrush.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_paste.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_paste.png
deleted file mode 100644
index 968f073..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_paste.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_red.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_red.png
deleted file mode 100644
index 0b18247..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_red.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_refresh.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_refresh.png
deleted file mode 100644
index cf347c7..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_refresh.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_save.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_save.png
deleted file mode 100644
index caea546..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_save.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white.png
deleted file mode 100644
index 8b8b1ca..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_acrobat.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_acrobat.png
deleted file mode 100644
index 8f8095e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_acrobat.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_actionscript.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_actionscript.png
deleted file mode 100644
index 159b240..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_actionscript.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_add.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_add.png
deleted file mode 100644
index aa23dde..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_add.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_c.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_c.png
deleted file mode 100644
index 34a05cc..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_c.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_camera.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_camera.png
deleted file mode 100644
index f501a59..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_camera.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cd.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cd.png
deleted file mode 100644
index 848bdaf..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cd.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code.png
deleted file mode 100644
index 0c76bd1..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code_red.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code_red.png
deleted file mode 100644
index 87a6914..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_code_red.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_coldfusion.png
deleted file mode 100644
index c66011f..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_coldfusion.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_compressed.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_compressed.png
deleted file mode 100644
index 2b6b100..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_compressed.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_copy.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_copy.png
deleted file mode 100644
index a9f31a2..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_copy.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cplusplus.png
deleted file mode 100644
index a87cf84..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cplusplus.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_csharp.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_csharp.png
deleted file mode 100644
index ffb8fc9..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_csharp.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cup.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cup.png
deleted file mode 100644
index 0a7d6f4..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_cup.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_database.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_database.png
deleted file mode 100644
index bddba1f..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_database.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_delete.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_delete.png
deleted file mode 100644
index af1ecaf..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_delete.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_dvd.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_dvd.png
deleted file mode 100644
index 4cc537a..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_dvd.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_edit.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_edit.png
deleted file mode 100644
index b93e776..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_edit.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_error.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_error.png
deleted file mode 100644
index 9fc5a0a..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_error.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_excel.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_excel.png
deleted file mode 100644
index b977d7e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_excel.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_find.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_find.png
deleted file mode 100644
index 5818436..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_find.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_flash.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_flash.png
deleted file mode 100644
index 5769120..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_flash.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_freehand.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_freehand.png
deleted file mode 100644
index 8d719df..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_freehand.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_gear.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_gear.png
deleted file mode 100644
index 106f5aa..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_gear.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_get.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_get.png
deleted file mode 100644
index e4a1ecb..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_get.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_go.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_go.png
deleted file mode 100644
index 7e62a92..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_go.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_h.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_h.png
deleted file mode 100644
index e902abb..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_h.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_horizontal.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_horizontal.png
deleted file mode 100644
index 1d2d0a4..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_horizontal.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_key.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_key.png
deleted file mode 100644
index d616484..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_key.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_lightning.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_lightning.png
deleted file mode 100644
index 7215d1e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_lightning.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_link.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_link.png
deleted file mode 100644
index bf7bd1c..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_link.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_magnify.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_magnify.png
deleted file mode 100644
index f6b74cc..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_magnify.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_medal.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_medal.png
deleted file mode 100644
index d3fffb6..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_medal.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_office.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_office.png
deleted file mode 100644
index a65bcb3..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_office.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paint.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paint.png
deleted file mode 100644
index 23a37b8..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paint.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paintbrush.png
deleted file mode 100644
index f907e44..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paintbrush.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paste.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paste.png
deleted file mode 100644
index 5b2cbb3..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_paste.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_php.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_php.png
deleted file mode 100644
index 7868a25..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_php.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_picture.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_picture.png
deleted file mode 100644
index 134b669..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_picture.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_powerpoint.png
deleted file mode 100644
index c4eff03..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_powerpoint.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_put.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_put.png
deleted file mode 100644
index 884ffd6..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_put.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_ruby.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_ruby.png
deleted file mode 100644
index f59b7c4..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_ruby.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_stack.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_stack.png
deleted file mode 100644
index 44084ad..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_stack.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_star.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_star.png
deleted file mode 100644
index 3a1441c..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_star.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_swoosh.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_swoosh.png
deleted file mode 100644
index e770829..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_swoosh.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text.png
deleted file mode 100644
index 813f712..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text_width.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text_width.png
deleted file mode 100644
index d9cf132..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_text_width.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_tux.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_tux.png
deleted file mode 100644
index 52699bf..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_tux.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_vector.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_vector.png
deleted file mode 100644
index 4a05955..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_vector.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_visualstudio.png
deleted file mode 100644
index a0a433d..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_visualstudio.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_width.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_width.png
deleted file mode 100644
index 1eb8809..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_width.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_word.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_word.png
deleted file mode 100644
index ae8ecbf..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_word.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_world.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_world.png
deleted file mode 100644
index 6ed2490..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_world.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_wrench.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_wrench.png
deleted file mode 100644
index fecadd0..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_wrench.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_zip.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_zip.png
deleted file mode 100644
index fd4bbcc..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_white_zip.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_word.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_word.png
deleted file mode 100644
index 834cdfa..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_word.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/icons/page_world.png b/examples/cross-domain/node_modules/connect/lib/public/icons/page_world.png
deleted file mode 100644
index b8895dd..0000000
--- a/examples/cross-domain/node_modules/connect/lib/public/icons/page_world.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/lib/public/style.css b/examples/cross-domain/node_modules/connect/lib/public/style.css
deleted file mode 100644
index 32b6507..0000000
--- a/examples/cross-domain/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/examples/cross-domain/node_modules/connect/lib/utils.js b/examples/cross-domain/node_modules/connect/lib/utils.js
deleted file mode 100644
index bf0731e..0000000
--- a/examples/cross-domain/node_modules/connect/lib/utils.js
+++ /dev/null
@@ -1,508 +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')
- , crc16 = require('crc').crc16
- , parse = require('url').parse
- , Path = require('path')
- , fs = require('fs');
-
-/**
- * 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`.
- *
- * @param {Number} code
- * @return {Error}
- * @api private
- */
-
-exports.error = function(code){
- var err = new Error(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 public
- */
-
-exports.md5 = function(str, encoding){
- return crypto
- .createHash('md5')
- .update(str)
- .digest(encoding || 'hex');
-};
-
-/**
- * Merge object b with object a.
- *
- * var a = { foo: 'bar' }
- * , b = { bar: 'baz' };
- *
- * utils.merge(a, b);
- * // => { foo: 'bar', bar: 'baz' }
- *
- * @param {Object} a
- * @param {Object} b
- * @return {Object}
- * @api private
- */
-
-exports.merge = function(a, b){
- if (a && b) {
- for (var key in b) {
- a[key] = b[key];
- }
- }
- return a;
-};
-
-/**
- * Escape the given string of `html`.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-exports.escape = function(html){
- return String(html)
- .replace(/&(?!\w+;)/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;');
-};
-
-
-/**
- * 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);
-};
-
-/**
- * Sign the given `val` with `secret`.
- *
- * @param {String} val
- * @param {String} secret
- * @return {String}
- * @api private
- */
-
-exports.sign = function(val, secret){
- 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){
- 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`.
- *
- * TODO: tag signed cookies with "s:"
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.parseSignedCookies = function(obj, secret){
- var ret = {};
- Object.keys(obj).forEach(function(key){
- var val = obj[key]
- , signed = exports.unsign(val, secret);
-
- if (signed) {
- ret[key] = signed;
- delete obj[key];
- }
- });
- return ret;
-};
-
-/**
- * Parse JSON cookies.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.parseJSONCookies = function(obj){
- var hashes = {};
-
- Object.keys(obj).forEach(function(key){
- var val = obj[key];
- if (0 == val.indexOf('j:')) {
- try {
- hashes[key] = crc16(val); // only crc json cookies for now
- obj[key] = JSON.parse(val.slice(2));
- } catch (err) {
- // nothing
- }
- }
- });
-
- return {
- cookies: obj,
- hashes: hashes
- };
-};
-
-/**
- * Parse the given cookie string into an object.
- *
- * @param {String} str
- * @return {Object}
- * @api private
- */
-
-exports.parseCookie = function(str){
- var obj = {}
- , pairs = str.split(/[;,] */);
- for (var i = 0, len = pairs.length; i < len; ++i) {
- var pair = pairs[i]
- , eqlIndex = pair.indexOf('=')
- , key = pair.substr(0, eqlIndex).trim()
- , val = pair.substr(++eqlIndex, pair.length).trim();
-
- // quoted values
- if ('"' == val[0]) val = val.slice(1, -1);
-
- // only assign once
- if (undefined == obj[key]) {
- val = val.replace(/\+/g, ' ');
- try {
- obj[key] = decodeURIComponent(val);
- } catch (err) {
- if (err instanceof URIError) {
- obj[key] = val;
- } else {
- throw err;
- }
- }
- }
- }
- return obj;
-};
-
-/**
- * Serialize the given object into a cookie string.
- *
- * utils.serializeCookie('name', 'tj', { httpOnly: true })
- * // => "name=tj; httpOnly"
- *
- * @param {String} name
- * @param {String} val
- * @param {Object} obj
- * @return {String}
- * @api private
- */
-
-exports.serializeCookie = function(name, val, obj){
- var pairs = [name + '=' + encodeURIComponent(val)]
- , obj = obj || {};
-
- if (obj.domain) pairs.push('domain=' + obj.domain);
- if (obj.path) pairs.push('path=' + obj.path);
- if (obj.expires) pairs.push('expires=' + obj.expires.toUTCString());
- if (obj.httpOnly) pairs.push('httpOnly');
- if (obj.secure) pairs.push('secure');
-
- return pairs.join('; ');
-};
-
-/**
- * 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.
- *
- * var pause = utils.pause(req);
- * fs.readFile(path, function(){
- * next();
- * pause.resume();
- * });
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-exports.pause = function(obj){
- var onData
- , onEnd
- , events = [];
-
- // buffer data
- obj.on('data', onData = function(data, encoding){
- events.push(['data', data, encoding]);
- });
-
- // buffer end
- obj.on('end', onEnd = function(data, encoding){
- events.push(['end', data, encoding]);
- });
-
- return {
- end: function(){
- obj.removeListener('data', onData);
- obj.removeListener('end', onEnd);
- },
- resume: function(){
- this.end();
- for (var i = 0, len = events.length; i < len; ++i) {
- obj.emit.apply(obj, events[i]);
- }
- }
- };
-};
-
-/**
- * Check `req` and `res` to see if it has been modified.
- *
- * @param {IncomingMessage} req
- * @param {ServerResponse} res
- * @return {Boolean}
- * @api private
- */
-
-exports.modified = function(req, res, headers) {
- var headers = headers || res._headers || {}
- , modifiedSince = req.headers['if-modified-since']
- , lastModified = headers['last-modified']
- , noneMatch = req.headers['if-none-match']
- , etag = headers['etag'];
-
- if (noneMatch) noneMatch = noneMatch.split(/ *, */);
-
- // check If-None-Match
- if (noneMatch && etag && ~noneMatch.indexOf(etag)) {
- return false;
- }
-
- // check If-Modified-Since
- if (modifiedSince && lastModified) {
- modifiedSince = new Date(modifiedSince);
- lastModified = new Date(lastModified);
- // Ignore invalid dates
- if (!isNaN(modifiedSince.getTime())) {
- if (lastModified <= modifiedSince) return false;
- }
- }
-
- return true;
-};
-
-/**
- * Strip `Content-*` headers from `res`.
- *
- * @param {ServerResponse} res
- * @api private
- */
-
-exports.removeContentHeaders = function(res){
- Object.keys(res._headers).forEach(function(field){
- if (0 == field.indexOf('content')) {
- res.removeHeader(field);
- }
- });
-};
-
-/**
- * Check if `req` is a conditional GET request.
- *
- * @param {IncomingMessage} req
- * @return {Boolean}
- * @api private
- */
-
-exports.conditionalGET = function(req) {
- return req.headers['if-modified-since']
- || req.headers['if-none-match'];
-};
-
-/**
- * Respond with 401 "Unauthorized".
- *
- * @param {ServerResponse} res
- * @param {String} realm
- * @api private
- */
-
-exports.unauthorized = function(res, realm) {
- res.statusCode = 401;
- res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"');
- res.end('Unauthorized');
-};
-
-/**
- * Respond with 304 "Not Modified".
- *
- * @param {ServerResponse} res
- * @param {Object} headers
- * @api private
- */
-
-exports.notModified = function(res) {
- exports.removeContentHeaders(res);
- res.statusCode = 304;
- res.end();
-};
-
-/**
- * Return an ETag in the form of `"<size>-<mtime>"`
- * from the given `stat`.
- *
- * @param {Object} stat
- * @return {String}
- * @api private
- */
-
-exports.etag = function(stat) {
- return '"' + stat.size + '-' + Number(stat.mtime) + '"';
-};
-
-/**
- * Parse "Range" header `str` relative to the given file `size`.
- *
- * @param {Number} size
- * @param {String} str
- * @return {Array}
- * @api private
- */
-
-exports.parseRange = function(size, str){
- var valid = true;
- var arr = str.substr(6).split(',').map(function(range){
- var range = range.split('-')
- , start = parseInt(range[0], 10)
- , end = parseInt(range[1], 10);
-
- // -500
- if (isNaN(start)) {
- start = size - end;
- end = size - 1;
- // 500-
- } else if (isNaN(end)) {
- end = size - 1;
- }
-
- // Invalid
- if (isNaN(start)
- || isNaN(end)
- || start > end
- || start < 0) valid = false;
-
- return {
- start: start,
- end: end
- };
- });
-
- return valid ? arr : null;
-};
-
-/**
- * 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 public
- */
-
-exports.parseUrl = function(req){
- var parsed = req._parsedUrl;
- if (parsed && parsed.href == req.url) {
- return parsed;
- } else {
- return req._parsedUrl = parse(req.url);
- }
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/.gitmodules b/examples/cross-domain/node_modules/connect/node_modules/crc/.gitmodules
deleted file mode 100644
index 2319e18..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "tests/nodeunit"]
- path = tests/nodeunit
- url = git://github.com/caolan/nodeunit.git
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/README.md b/examples/cross-domain/node_modules/connect/node_modules/crc/README.md
deleted file mode 100644
index 01482b3..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# JavaScript CRC 8, 16 and 32.
-
-This is a basic port/copy of the JavaScript CRC implementation. The module works with any CommonJS system supporting `module.exports` notation as well as in the browser. When loaded in the browser, all functions end up under the `window.crc` "namespace".
-
-Original code is taken from http://www.digsys.se/JavaScript/CRC.aspx
-
-## Functions
-
-The following functions are implemented:
-
- crc8(String) #=> Number
- crcArc(String) #=> Number
- crc16(String) #=> Number
- fcs16(String) #=> Number
- crc32(String) #=> Number
- hex8(Number) #=> String
- hex16(Number) #=> String
- hex32(Number) #=> String
-
-## Installation
-
- git clone git://github.com/alexgorbatchev/node-crc.git
-
-or
-
- npm install crc
-
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/lib/crc.js b/examples/cross-domain/node_modules/connect/node_modules/crc/lib/crc.js
deleted file mode 100644
index 9eb9f0a..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/lib/crc.js
+++ /dev/null
@@ -1,362 +0,0 @@
-(function()
-{
- // CRC-8 in table form
- //
- // Copyright (c) 1989 AnDan Software. You may use this program, or
- // code or tables extracted from it, as long as this notice is not
- // removed or changed.
- var CRC8_TAB = new Array(
- // C/C++ language:
- //
- // unsigned char CRC8_TAB[] = {...};
- 0x00,0x1B,0x36,0x2D,0x6C,0x77,0x5A,0x41,0xD8,0xC3,0xEE,0xF5,0xB4,0xAF,0x82,0x99,0xD3,0xC8,0xE5,
- 0xFE,0xBF,0xA4,0x89,0x92,0x0B,0x10,0x3D,0x26,0x67,0x7C,0x51,0x4A,0xC5,0xDE,0xF3,0xE8,0xA9,0xB2,
- 0x9F,0x84,0x1D,0x06,0x2B,0x30,0x71,0x6A,0x47,0x5C,0x16,0x0D,0x20,0x3B,0x7A,0x61,0x4C,0x57,0xCE,
- 0xD5,0xF8,0xE3,0xA2,0xB9,0x94,0x8F,0xE9,0xF2,0xDF,0xC4,0x85,0x9E,0xB3,0xA8,0x31,0x2A,0x07,0x1C,
- 0x5D,0x46,0x6B,0x70,0x3A,0x21,0x0C,0x17,0x56,0x4D,0x60,0x7B,0xE2,0xF9,0xD4,0xCF,0x8E,0x95,0xB8,
- 0xA3,0x2C,0x37,0x1A,0x01,0x40,0x5B,0x76,0x6D,0xF4,0xEF,0xC2,0xD9,0x98,0x83,0xAE,0xB5,0xFF,0xE4,
- 0xC9,0xD2,0x93,0x88,0xA5,0xBE,0x27,0x3C,0x11,0x0A,0x4B,0x50,0x7D,0x66,0xB1,0xAA,0x87,0x9C,0xDD,
- 0xC6,0xEB,0xF0,0x69,0x72,0x5F,0x44,0x05,0x1E,0x33,0x28,0x62,0x79,0x54,0x4F,0x0E,0x15,0x38,0x23,
- 0xBA,0xA1,0x8C,0x97,0xD6,0xCD,0xE0,0xFB,0x74,0x6F,0x42,0x59,0x18,0x03,0x2E,0x35,0xAC,0xB7,0x9A,
- 0x81,0xC0,0xDB,0xF6,0xED,0xA7,0xBC,0x91,0x8A,0xCB,0xD0,0xFD,0xE6,0x7F,0x64,0x49,0x52,0x13,0x08,
- 0x25,0x3E,0x58,0x43,0x6E,0x75,0x34,0x2F,0x02,0x19,0x80,0x9B,0xB6,0xAD,0xEC,0xF7,0xDA,0xC1,0x8B,
- 0x90,0xBD,0xA6,0xE7,0xFC,0xD1,0xCA,0x53,0x48,0x65,0x7E,0x3F,0x24,0x09,0x12,0x9D,0x86,0xAB,0xB0,
- 0xF1,0xEA,0xC7,0xDC,0x45,0x5E,0x73,0x68,0x29,0x32,0x1F,0x04,0x4E,0x55,0x78,0x63,0x22,0x39,0x14,
- 0x0F,0x96,0x8D,0xA0,0xBB,0xFA,0xE1,0xCC,0xD7
- );
-
- function crc8Add(crc,c)
- // 'crc' should be initialized to 0x00.
- {
- return CRC8_TAB[(crc^c)&0xFF];
- };
- // C/C++ language:
- //
- // inline unsigned char crc8Add(unsigned char crc, unsigned char c)
- // {
- // return CRC8_TAB[crc^c];
- // }
-
- // CRC-16 (as it is in SEA's ARC) in table form
- //
- // The logic for this method of calculating the CRC 16 bit polynomial
- // is taken from an article by David Schwaderer in the April 1985
- // issue of PC Tech Journal.
- var CRC_ARC_TAB = new Array(
- // C/C++ language:
- //
- // unsigned short CRC_ARC_TAB[] = {...};
- 0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500,
- 0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1,
- 0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,
- 0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,0x1400,0xD4C1,0xD581,0x1540,
- 0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,0xF001,
- 0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,
- 0x3480,0xF441,0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80,
- 0xFB41,0x3900,0xF9C1,0xF881,0x3840,0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,
- 0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,0xE401,0x24C0,0x2580,0xE541,0x2700,
- 0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,0xA001,0x60C0,
- 0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,
- 0xA441,0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41,
- 0x6900,0xA9C1,0xA881,0x6840,0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01,
- 0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,
- 0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,0x5000,0x90C1,0x9181,
- 0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440,
- 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,
- 0x59C0,0x5880,0x9841,0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1,
- 0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,
- 0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040
- );
-
- function crcArcAdd(crc,c)
- // 'crc' should be initialized to 0x0000.
- {
- return CRC_ARC_TAB[(crc^c)&0xFF]^((crc>>8)&0xFF);
- };
- // C/C++ language:
- //
- // inline unsigned short crcArcAdd(unsigned short crc, unsigned char c)
- // {
- // return CRC_ARC_TAB[(unsigned char)crc^c]^(unsigned short)(crc>>8);
- // }
-
- // CRC-16 (as it is in ZMODEM) in table form
- //
- // Copyright (c) 1989 AnDan Software. You may use this program, or
- // code or tables extracted from it, as long as this notice is not
- // removed or changed.
- var CRC16_TAB = new Array(
- // C/C++ language:
- //
- // unsigned short CRC16_TAB[] = {...};
- 0x0000,0x1021,0x2042,0x3063,0x4084,0x50A5,0x60C6,0x70E7,0x8108,0x9129,0xA14A,0xB16B,0xC18C,
- 0xD1AD,0xE1CE,0xF1EF,0x1231,0x0210,0x3273,0x2252,0x52B5,0x4294,0x72F7,0x62D6,0x9339,0x8318,
- 0xB37B,0xA35A,0xD3BD,0xC39C,0xF3FF,0xE3DE,0x2462,0x3443,0x0420,0x1401,0x64E6,0x74C7,0x44A4,
- 0x5485,0xA56A,0xB54B,0x8528,0x9509,0xE5EE,0xF5CF,0xC5AC,0xD58D,0x3653,0x2672,0x1611,0x0630,
- 0x76D7,0x66F6,0x5695,0x46B4,0xB75B,0xA77A,0x9719,0x8738,0xF7DF,0xE7FE,0xD79D,0xC7BC,0x48C4,
- 0x58E5,0x6886,0x78A7,0x0840,0x1861,0x2802,0x3823,0xC9CC,0xD9ED,0xE98E,0xF9AF,0x8948,0x9969,
- 0xA90A,0xB92B,0x5AF5,0x4AD4,0x7AB7,0x6A96,0x1A71,0x0A50,0x3A33,0x2A12,0xDBFD,0xCBDC,0xFBBF,
- 0xEB9E,0x9B79,0x8B58,0xBB3B,0xAB1A,0x6CA6,0x7C87,0x4CE4,0x5CC5,0x2C22,0x3C03,0x0C60,0x1C41,
- 0xEDAE,0xFD8F,0xCDEC,0xDDCD,0xAD2A,0xBD0B,0x8D68,0x9D49,0x7E97,0x6EB6,0x5ED5,0x4EF4,0x3E13,
- 0x2E32,0x1E51,0x0E70,0xFF9F,0xEFBE,0xDFDD,0xCFFC,0xBF1B,0xAF3A,0x9F59,0x8F78,0x9188,0x81A9,
- 0xB1CA,0xA1EB,0xD10C,0xC12D,0xF14E,0xE16F,0x1080,0x00A1,0x30C2,0x20E3,0x5004,0x4025,0x7046,
- 0x6067,0x83B9,0x9398,0xA3FB,0xB3DA,0xC33D,0xD31C,0xE37F,0xF35E,0x02B1,0x1290,0x22F3,0x32D2,
- 0x4235,0x5214,0x6277,0x7256,0xB5EA,0xA5CB,0x95A8,0x8589,0xF56E,0xE54F,0xD52C,0xC50D,0x34E2,
- 0x24C3,0x14A0,0x0481,0x7466,0x6447,0x5424,0x4405,0xA7DB,0xB7FA,0x8799,0x97B8,0xE75F,0xF77E,
- 0xC71D,0xD73C,0x26D3,0x36F2,0x0691,0x16B0,0x6657,0x7676,0x4615,0x5634,0xD94C,0xC96D,0xF90E,
- 0xE92F,0x99C8,0x89E9,0xB98A,0xA9AB,0x5844,0x4865,0x7806,0x6827,0x18C0,0x08E1,0x3882,0x28A3,
- 0xCB7D,0xDB5C,0xEB3F,0xFB1E,0x8BF9,0x9BD8,0xABBB,0xBB9A,0x4A75,0x5A54,0x6A37,0x7A16,0x0AF1,
- 0x1AD0,0x2AB3,0x3A92,0xFD2E,0xED0F,0xDD6C,0xCD4D,0xBDAA,0xAD8B,0x9DE8,0x8DC9,0x7C26,0x6C07,
- 0x5C64,0x4C45,0x3CA2,0x2C83,0x1CE0,0x0CC1,0xEF1F,0xFF3E,0xCF5D,0xDF7C,0xAF9B,0xBFBA,0x8FD9,
- 0x9FF8,0x6E17,0x7E36,0x4E55,0x5E74,0x2E93,0x3EB2,0x0ED1,0x1EF0
- );
-
- function crc16Add(crc,c)
- // 'crc' should be initialized to 0x0000.
- {
- return CRC16_TAB[((crc>>8)^c)&0xFF]^((crc<<8)&0xFFFF);
- };
- // C/C++ language:
- //
- // inline unsigned short crc16Add(unsigned short crc, unsigned char c)
- // {
- // return CRC16_TAB[(unsigned char)(crc>>8)^c]^(unsigned short)(crc<<8);
- // }
-
- // FCS-16 (as it is in PPP) in table form
- //
- // Described in RFC-1662 by William Allen Simpson, see RFC-1662 for references.
- //
- // Modified by Anders Danielsson, March 10, 2006.
- var FCS_16_TAB = new Array(
- // C/C++ language:
- //
- // unsigned short FCS_16_TAB[256] = {...};
- 0x0000,0x1189,0x2312,0x329B,0x4624,0x57AD,0x6536,0x74BF,0x8C48,0x9DC1,0xAF5A,0xBED3,0xCA6C,
- 0xDBE5,0xE97E,0xF8F7,0x1081,0x0108,0x3393,0x221A,0x56A5,0x472C,0x75B7,0x643E,0x9CC9,0x8D40,
- 0xBFDB,0xAE52,0xDAED,0xCB64,0xF9FF,0xE876,0x2102,0x308B,0x0210,0x1399,0x6726,0x76AF,0x4434,
- 0x55BD,0xAD4A,0xBCC3,0x8E58,0x9FD1,0xEB6E,0xFAE7,0xC87C,0xD9F5,0x3183,0x200A,0x1291,0x0318,
- 0x77A7,0x662E,0x54B5,0x453C,0xBDCB,0xAC42,0x9ED9,0x8F50,0xFBEF,0xEA66,0xD8FD,0xC974,0x4204,
- 0x538D,0x6116,0x709F,0x0420,0x15A9,0x2732,0x36BB,0xCE4C,0xDFC5,0xED5E,0xFCD7,0x8868,0x99E1,
- 0xAB7A,0xBAF3,0x5285,0x430C,0x7197,0x601E,0x14A1,0x0528,0x37B3,0x263A,0xDECD,0xCF44,0xFDDF,
- 0xEC56,0x98E9,0x8960,0xBBFB,0xAA72,0x6306,0x728F,0x4014,0x519D,0x2522,0x34AB,0x0630,0x17B9,
- 0xEF4E,0xFEC7,0xCC5C,0xDDD5,0xA96A,0xB8E3,0x8A78,0x9BF1,0x7387,0x620E,0x5095,0x411C,0x35A3,
- 0x242A,0x16B1,0x0738,0xFFCF,0xEE46,0xDCDD,0xCD54,0xB9EB,0xA862,0x9AF9,0x8B70,0x8408,0x9581,
- 0xA71A,0xB693,0xC22C,0xD3A5,0xE13E,0xF0B7,0x0840,0x19C9,0x2B52,0x3ADB,0x4E64,0x5FED,0x6D76,
- 0x7CFF,0x9489,0x8500,0xB79B,0xA612,0xD2AD,0xC324,0xF1BF,0xE036,0x18C1,0x0948,0x3BD3,0x2A5A,
- 0x5EE5,0x4F6C,0x7DF7,0x6C7E,0xA50A,0xB483,0x8618,0x9791,0xE32E,0xF2A7,0xC03C,0xD1B5,0x2942,
- 0x38CB,0x0A50,0x1BD9,0x6F66,0x7EEF,0x4C74,0x5DFD,0xB58B,0xA402,0x9699,0x8710,0xF3AF,0xE226,
- 0xD0BD,0xC134,0x39C3,0x284A,0x1AD1,0x0B58,0x7FE7,0x6E6E,0x5CF5,0x4D7C,0xC60C,0xD785,0xE51E,
- 0xF497,0x8028,0x91A1,0xA33A,0xB2B3,0x4A44,0x5BCD,0x6956,0x78DF,0x0C60,0x1DE9,0x2F72,0x3EFB,
- 0xD68D,0xC704,0xF59F,0xE416,0x90A9,0x8120,0xB3BB,0xA232,0x5AC5,0x4B4C,0x79D7,0x685E,0x1CE1,
- 0x0D68,0x3FF3,0x2E7A,0xE70E,0xF687,0xC41C,0xD595,0xA12A,0xB0A3,0x8238,0x93B1,0x6B46,0x7ACF,
- 0x4854,0x59DD,0x2D62,0x3CEB,0x0E70,0x1FF9,0xF78F,0xE606,0xD49D,0xC514,0xB1AB,0xA022,0x92B9,
- 0x8330,0x7BC7,0x6A4E,0x58D5,0x495C,0x3DE3,0x2C6A,0x1EF1,0x0F78
- );
-
- function fcs16Add(fcs,c)
- // 'fcs' should be initialized to 0xFFFF and after the computation it should be
- // complemented (inverted).
- //
- // If the FCS-16 is calculated over the data and over the complemented FCS-16, the
- // result will always be 0xF0B8 (without the complementation).
- {
- return FCS_16_TAB[(fcs^c)&0xFF]^((fcs>>8)&0xFF);
- };
-
- // C/C++ language:
- //
- // inline unsigned short fcs16Add(unsigned short fcs, unsigned char c)
- // {
- // return FCS_16_TAB[(unsigned char)fcs^c]^(unsigned short)(fcs>>8);
- // }
-
- //
- // CRC-32 (as it is in ZMODEM) in table form
- //
- // Copyright (C) 1986 Gary S. Brown. You may use this program, or
- // code or tables extracted from it, as desired without restriction.
- //
- // Modified by Anders Danielsson, February 5, 1989 and March 10, 2006.
- //
- // This is also known as FCS-32 (as it is in PPP), described in
- // RFC-1662 by William Allen Simpson, see RFC-1662 for references.
- //
- var CRC32_TAB = new Array( /* CRC polynomial 0xEDB88320 */
- // C/C++ language:
- //
- // unsigned long CRC32_TAB[] = {...};
- 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,
- 0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,
- 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7,
- 0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,
- 0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,
- 0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59,
- 0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F,
- 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D,
- 0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433,
- 0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01,
- 0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,
- 0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65,
- 0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB,
- 0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9,
- 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F,
- 0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD,
- 0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683,
- 0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1,
- 0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7,
- 0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5,
- 0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B,
- 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79,
- 0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F,
- 0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D,
- 0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713,
- 0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21,
- 0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777,
- 0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45,
- 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB,
- 0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9,
- 0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF,
- 0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D
- );
-
- function crc32Add(crc,c)
- // 'crc' should be initialized to 0xFFFFFFFF and after the computation it should be
- // complemented (inverted).
- //
- // CRC-32 is also known as FCS-32.
- //
- // If the FCS-32 is calculated over the data and over the complemented FCS-32, the
- // result will always be 0xDEBB20E3 (without the complementation).
- {
- return CRC32_TAB[(crc^c)&0xFF]^((crc>>8)&0xFFFFFF);
- };
- //
- // C/C++ language:
- //
- // inline unsigned long crc32Add(unsigned long crc, unsigned char c)
- // {
- // return CRC32_TAB[(unsigned char)crc^c]^(crc>>8);
- // }
- //
-
- function crc8(str)
- {
- var n,
- len = str.length,
- crc = 0
- ;
-
- for(i = 0; i < len; i++)
- crc = crc8Add(crc, str.charCodeAt(i));
-
- return crc;
- };
-
- function crcArc(str)
- {
- var i,
- len = str.length,
- crc = 0
- ;
-
- for(i = 0; i < len; i++)
- crc = crcArcAdd(crc, str.charCodeAt(i));
-
- return crc;
- };
-
- function crc16(str)
- {
- var i,
- len = str.length,
- crc = 0
- ;
-
- for(i = 0; i < len; i++)
- crc = crc16Add(crc, str.charCodeAt(i));
-
- return crc;
- };
-
- function fcs16(str)
- {
- var i,
- len = str.length,
- fcs = 0xFFFF
- ;
-
- for(i = 0; i < len; i++)
- fcs = fcs16Add(fcs,str.charCodeAt(i));
-
- return fcs^0xFFFF;
- };
-
- function crc32(str)
- {
- var i,
- len = str.length,
- crc = 0xFFFFFFFF
- ;
-
- for(i = 0; i < len; i++)
- crc = crc32Add(crc, str.charCodeAt(i));
-
- return crc^0xFFFFFFFF;
- };
-
- /**
- * Convert value as 8-bit unsigned integer to 2 digit hexadecimal number.
- */
- function hex8(val)
- {
- var n = val & 0xFF,
- str = n.toString(16).toUpperCase()
- ;
-
- while(str.length < 2)
- str = "0" + str;
-
- return str;
- };
-
- /**
- * Convert value as 16-bit unsigned integer to 4 digit hexadecimal number.
- */
- function hex16(val)
- {
- return hex8(val >> 8) + hex8(val);
- };
-
- /**
- * Convert value as 32-bit unsigned integer to 8 digit hexadecimal number.
- */
- function hex32(val)
- {
- return hex16(val >> 16) + hex16(val);
- };
-
- var target, property;
-
- if(typeof(window) == 'undefined')
- {
- target = module;
- property = 'exports';
- }
- else
- {
- target = window;
- property = 'crc';
- }
-
- target[property] = {
- 'crc8' : crc8,
- 'crcArc' : crcArc,
- 'crc16' : crc16,
- 'fcs16' : fcs16,
- 'crc32' : crc32,
- 'hex8' : hex8,
- 'hex16' : hex16,
- 'hex32' : hex32
- };
-})();
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/package.json b/examples/cross-domain/node_modules/connect/node_modules/crc/package.json
deleted file mode 100644
index c386312..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/package.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "crc",
- "version": "0.1.0",
- "description": "CRC JavaScript implementation",
- "author": {
- "name": "Alex Gorbatchev",
- "email": "alex.gorbatchev@gmail.com"
- },
- "contributors": [],
- "main": "./lib/crc.js",
- "scripts": {},
- "directories": {},
- "repository": {
- "type": "git",
- "url": "git://github.com/alexgorbatchev/node-crc.git"
- },
- "_id": "crc@0.1.0",
- "dependencies": {},
- "devDependencies": {},
- "optionalDependencies": {},
- "engines": {
- "node": "*"
- },
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "3b046df472cac6fa1a805e708c296b26f1a40b2c"
- },
- "_from": "crc@0.1.0"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/crc_tests.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/crc_tests.js
deleted file mode 100755
index 93eea42..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/crc_tests.js
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env ./nodeunit/bin/nodeunit
-
-var crc = require('../lib/crc');
-
-var fixture = {
- 'crc8': [
- ['hello world', 64]
- ],
-
- 'crc16': [
- ['hello world', 15332]
- ],
-
- 'crc32': [
- ['hello world', 222957957]
- ],
-
- 'crcArc': [
- ['hello world', 14785]
- ],
-
- 'fcs16': [
- ['hello world', 44550]
- ],
-
- 'hex8': [
- [64, '40']
- ],
-
- 'hex16': [
- [15332, '3BE4']
- ],
-
- 'hex32': [
- [222957957, '0D4A1185']
- ]
-};
-
-var suite = module.exports['crc'] = {};
-
-for(var func in fixture)
-{
- var list = fixture[func];
-
- for(var i = 0; i < list.length; i++)
- {
- var input = list[i][0],
- output = list[i][1],
- name = [ func, input, output ].join(' - ')
- ;
-
- suite[name] = (function(func, input, output)
- {
-
- return function(assert)
- {
- assert.deepEqual(crc[func](input), output);
- assert.done();
- };
-
- })(func, input, output);
- }
-};
-
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore
deleted file mode 100644
index 1a82501..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-dist
-stamp-build
-test/fixtures/dir2
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md
deleted file mode 100644
index ebaa38e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md
+++ /dev/null
@@ -1,56 +0,0 @@
-Nodeunit contributors (sorted alphabeticaly)
-============================================
-
-* **[Alex Gorbatchev](https://github.com/alexgorbatchev)**
-
- * Deeper default object inspection
- * Timeout to ensure flushing of console output (default reporter)
-
-* **[Alex Wolfe](https://github.com/alexkwolfe)**
-
- * HTML test reporter
-
-* **[Caolan McMahon](https://github.com/caolan)**
-
- * Author and maintainer
- * Most features develpopment
-
-* **[Carl Fürstenberg](https://github.com/azatoth)**
-
- * Debian-friendly Makefile, supports both 'node' and 'nodejs' executables
- * Sandbox utility
- * Minimal test reporter
-
-* **[Gerad Suyderhoud](https://github.com/gerad)**
-
- * First comand-line tool
-
-* **[Kadir Pekel](https://github.com/coffeemate)**
-
- * Improvements to default test reporter
- * HTTP test utility
-
-* **[Oleg Efimov](https://github.com/Sannis)**
-
- * Adding 'make lint' and fixing nodelint errors
- * Option parsing, --help text and config file support
- * Reporters option for command-line tool
-
-* **[Orlando Vazquez](https://github.com/orlandov)**
-
- * Added jUnit XML reporter
-
-* **[Ryan Dahl](https://github.com/ry)**
-
- * Add package.json
-
-* **[Sam Stephenson](https://github.com/sstephenson)**
-
- * Coffee-script support
-
-* **[Thomas Mayfield](https://github.com/thegreatape)**
-
- * Async setUp and tearDown support for testCase
-
-**[Full contributors list](https://github.com/caolan/nodeunit/contributors).**
-
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE
deleted file mode 100644
index b7f9d50..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2010 Caolan McMahon
-
-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/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile
deleted file mode 100644
index f3e57cc..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile
+++ /dev/null
@@ -1,126 +0,0 @@
-PACKAGE = nodeunit
-NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
-
-PREFIX ?= /usr/local
-BINDIR ?= $(PREFIX)/bin
-DATADIR ?= $(PREFIX)/share
-MANDIR ?= $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
-NODEJSLIBDIR ?= $(LIBDIR)/$(NODEJS)
-
-BUILDDIR = dist
-
-DOCS = $(shell find doc -name '*.md' \
- |sed 's|.md|.1|g' \
- |sed 's|doc/|man1/|g' \
- )
-
-
-$(shell if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi)
-
-all: build doc
-
-browser:
- # super hacky build script for browser version!
- mkdir -p $(BUILDDIR)/browser
- rm -rf $(BUILDDIR)/browser/*
- # build browser version of nodeunit.js
- cat share/license.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "nodeunit = (function(){" >> $(BUILDDIR)/browser/nodeunit.js
- cat deps/json2.js >> $(BUILDDIR)/browser/nodeunit.js
- # make assert global
- echo "var assert = this.assert = {};" >> $(BUILDDIR)/browser/nodeunit.js
- echo "var types = {};" >> $(BUILDDIR)/browser/nodeunit.js
- echo "var core = {};" >> $(BUILDDIR)/browser/nodeunit.js
- echo "var nodeunit = {};" >> $(BUILDDIR)/browser/nodeunit.js
- echo "var reporter = {};" >> $(BUILDDIR)/browser/nodeunit.js
- cat deps/async.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
- cat lib/assert.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "})(assert);" >> $(BUILDDIR)/browser/nodeunit.js
- echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
- cat lib/types.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "})(types);" >> $(BUILDDIR)/browser/nodeunit.js
- echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
- cat lib/core.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "})(core);" >> $(BUILDDIR)/browser/nodeunit.js
- echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js
- cat lib/reporters/browser.js >> $(BUILDDIR)/browser/nodeunit.js
- echo "})(reporter);" >> $(BUILDDIR)/browser/nodeunit.js
- echo "nodeunit = core;" >> $(BUILDDIR)/browser/nodeunit.js
- echo "nodeunit.assert = assert;" >> $(BUILDDIR)/browser/nodeunit.js
- echo "nodeunit.reporter = reporter;" >> $(BUILDDIR)/browser/nodeunit.js
- echo "nodeunit.run = reporter.run;" >> $(BUILDDIR)/browser/nodeunit.js
- echo "return nodeunit; })();" >> $(BUILDDIR)/browser/nodeunit.js
- sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/nodeunit.js
- # copy nodeunit.css
- cp share/nodeunit.css $(BUILDDIR)/browser/nodeunit.css
- # create nodeunit.min.js
- uglifyjs $(BUILDDIR)/browser/nodeunit.js > $(BUILDDIR)/browser/nodeunit.min.js
- # create test scripts
- mkdir -p $(BUILDDIR)/browser/test
- cp test/test.html $(BUILDDIR)/browser/test/test.html
- # test-base.js
- echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-base.js
- cat test/test-base.js >> $(BUILDDIR)/browser/test/test-base.js
- echo "})(this.test_base = {});" >> $(BUILDDIR)/browser/test/test-base.js
- sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-base.js
- # test-runmodule.js
- echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runmodule.js
- cat test/test-runmodule.js >> $(BUILDDIR)/browser/test/test-runmodule.js
- echo "})(this.test_runmodule = {});" >> $(BUILDDIR)/browser/test/test-runmodule.js
- sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runmodule.js
- # test-runtest.js
- echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runtest.js
- cat test/test-runtest.js >> $(BUILDDIR)/browser/test/test-runtest.js
- echo "})(this.test_runtest = {});" >> $(BUILDDIR)/browser/test/test-runtest.js
- sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runtest.js
- # test-testcase.js
- echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-testcase.js
- cat test/test-testcase.js >> $(BUILDDIR)/browser/test/test-testcase.js
- echo "})(this.test_testcase = {});" >> $(BUILDDIR)/browser/test/test-testcase.js
- sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-testcase.js
- # copy nodeunit.js to dist/browser/test to make it easier for me to host and
- # run on windows VMs with IE
- cp $(BUILDDIR)/browser/nodeunit.js $(BUILDDIR)/browser/test/nodeunit.js
- cp $(BUILDDIR)/browser/nodeunit.css $(BUILDDIR)/browser/test/nodeunit.css
-
-build: stamp-build
-
-stamp-build: $(wildcard deps/* lib/*.js)
- touch $@;
- mkdir -p $(BUILDDIR)/nodeunit
- cp -R bin deps index.js lib package.json $(BUILDDIR)/nodeunit
- printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/bin/nodeunit $$@' > $(BUILDDIR)/nodeunit.sh
-
-test:
- $(NODEJS) ./bin/nodeunit test
-
-install: build
- install --directory $(NODEJSLIBDIR)
- cp -a $(BUILDDIR)/nodeunit $(NODEJSLIBDIR)
- install --mode=0755 $(BUILDDIR)/nodeunit.sh $(BINDIR)/nodeunit
- install --directory $(MANDIR)/man1/
- cp -a man1/nodeunit.1 $(MANDIR)/man1/
-
-uninstall:
- rm -rf $(NODEJSLIBDIR)/nodeunit $(NODEJSLIBDIR)/nodeunit.js $(BINDIR)/nodeunit
- rm -rf $(MANDIR)/man1/nodeunit.1
-
-clean:
- rm -rf $(BUILDDIR) stamp-build
-
-lint:
- nodelint --config nodelint.cfg ./index.js ./bin/nodeunit ./bin/nodeunit.json ./lib/*.js ./lib/reporters/*.js ./test/*.js
-
-doc: man1 $(DOCS)
- @true
-
-man1:
- @if ! test -d man1 ; then mkdir -p man1 ; fi
-
-# use `npm install ronn` for this to work.
-man1/%.1: doc/%.md
- ronn --roff $< > $@
-
-.PHONY: browser test install uninstall build all
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/README.md b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/README.md
deleted file mode 100644
index 67026a2..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/README.md
+++ /dev/null
@@ -1,430 +0,0 @@
-Nodeunit
-========
-
-Simple syntax, powerful tools. Nodeunit provides easy async unit testing for
-node.js and the browser.
-
-* Simple to use
-* Just export the tests from a module
-* Works with node.js and in the browser.
-* Helps you avoid common pitfalls when testing asynchronous code
-* Easy to add test cases with setUp and tearDown functions if you wish
-* Flexible reporters for custom output, built-in support for HTML and jUnit XML
-* Allows the use of mocks and stubs
-
-__Contributors__
-
-* [alexgorbatchev](https://github.com/alexgorbatchev)
-* [alexkwolfe](https://github.com/alexkwolfe)
-* [azatoth](https://github.com/azatoth)
-* [coffeemate](https://github.com/coffeemate)
-* [orlandov](https://github.com/orlandov)
-* [Sannis](https://github.com/Sannis)
-* [sstephenson](https://github.com/sstephenson)
-* [thegreatape](https://github.com/thegreatape)
-* and thanks to [cjohansen](https://github.com/cjohansen) for input and advice
- on implementing setUp and tearDown functions. See
- [cjohansen's fork](https://github.com/cjohansen/nodeunit).
-
-Also, check out gerad's [nodeunit-dsl](https://github.com/gerad/nodeunit-dsl)
-project, which implements a 'pretty dsl on top of nodeunit'.
-
-More contributor information can be found in the CONTRIBUTORS.md file.
-
-Usage
------
-
-Here is an example unit test module:
-
- exports.testSomething = function(test){
- test.expect(1);
- test.ok(true, "this assertion should pass");
- test.done();
- };
-
- exports.testSomethingElse = function(test){
- test.ok(false, "this assertion should fail");
- test.done();
- };
-
-When run using the included test runner, this will output the following:
-
-<img src="https://github.com/caolan/nodeunit/raw/master/img/example_fail.png" />
-
-Installation
-------------
-
-There are two options for installing nodeunit:
-
-1. Clone / download nodeunit from [github](https://github.com/caolan/nodeunit),
- then:
-
- make && sudo make install
-
-2. Install via npm:
-
- npm install nodeunit
-
-API Documentation
------------------
-
-Nodeunit uses the functions available in the node.js
-[assert module](http://nodejs.org/api.html#assert-280):
-
-* __ok(value, [message])__ - Tests if value is a true value.
-* __equal(actual, expected, [message])__ - Tests shallow, coercive equality
- with the equal comparison operator ( == ).
-* __notEqual(actual, expected, [message])__ - Tests shallow, coercive
- non-equality with the not equal comparison operator ( != ).
-* __deepEqual(actual, expected, [message])__ - Tests for deep equality.
-* __notDeepEqual(actual, expected, [message])__ - Tests for any deep
- inequality.
-* __strictEqual(actual, expected, [message])__ - Tests strict equality, as
- determined by the strict equality operator ( === )
-* __notStrictEqual(actual, expected, [message])__ - Tests strict non-equality,
- as determined by the strict not equal operator ( !== )
-* __throws(block, [error], [message])__ - Expects block to throw an error.
-* __doesNotThrow(block, [error], [message])__ - Expects block not to throw an
- error.
-* __ifError(value)__ - Tests if value is not a false value, throws if it is a
- true value. Useful when testing the first argument, error in callbacks.
-
-Nodeunit also provides the following functions within tests:
-
-* __expect(amount)__ - Specify how many assertions are expected to run within a
- test. Very useful for ensuring that all your callbacks and assertions are
- run.
-* __done()__ - Finish the current test function, and move on to the next. ALL
- tests should call this!
-
-Nodeunit aims to be simple and easy to learn. This is achieved through using
-existing structures (such as node.js modules) to maximum effect, and reducing
-the API where possible, to make it easier to digest.
-
-Tests are simply exported from a module, but they are still run in the order
-they are defined.
-
-__Note:__ Users of old nodeunit versions may remember using ok, equals and same
-in the style of qunit, instead of the assert functions above. These functions
-still exist for backwards compatibility, and are simply aliases to their assert
-module counterparts.
-
-
-Asynchronous Testing
---------------------
-
-When testing asynchronous code, there are a number of sharp edges to watch out
-for. Thankfully, nodeunit is designed to help you avoid as many of these
-pitfalls as possible. For the most part, testing asynchronous code in nodeunit
-_just works_.
-
-
-### Tests run in series
-
-While running tests in parallel seems like a good idea for speeding up your
-test suite, in practice I've found it means writing much more complicated
-tests. Because of node's module cache, running tests in parallel means mocking
-and stubbing is pretty much impossible. One of the nicest things about testing
-in javascript is the ease of doing stubs:
-
- var _readFile = fs.readFile;
- fs.readFile = function(path, callback){
- // its a stub!
- };
- // test function that uses fs.readFile
-
- // we're done
- fs.readFile = _readFile;
-
-You cannot do this when running tests in parallel. In order to keep testing as
-simple as possible, nodeunit avoids it. Thankfully, most unit-test suites run
-fast anyway.
-
-
-### Explicit ending of tests
-
-When testing async code its important that tests end at the correct point, not
-just after a given number of assertions. Otherwise your tests can run short,
-ending before all assertions have completed. Its important to detect too
-many assertions as well as too few. Combining explicit ending of tests with
-an expected number of assertions helps to avoid false test passes, so be sure
-to use the test.expect() method at the start of your test functions, and
-test.done() when finished.
-
-
-Groups, setUp and tearDown
---------------------------
-
-Nodeunit allows the nesting of test functions:
-
- exports.test1 = function (test) {
- ...
- }
-
- exports.group = {
- test2: function (test) {
- ...
- },
- test3: function (test) {
- ...
- }
- }
-
-This would be run as:
-
- test1
- group - test2
- group - test3
-
-Using these groups its possible to add setUp and tearDown functions to your
-tests. Nodeunit has a utility function called testCase which allows you to
-define a setUp function, which is run before each test, and a tearDown
-function, which is run after each test calls test.done():
-
- var testCase = require('nodeunit').testCase;
-
- module.exports = testCase({
- setUp: function (callback) {
- this.foo = 'bar';
- callback();
- },
- tearDown: function (callback) {
- // clean up
- callback();
- },
- test1: function (test) {
- test.equals(this.foo, 'bar');
- test.done();
- }
- });
-
-In this way, its possible to have multiple groups of tests in a module, each
-group with its own setUp and tearDown functions.
-
-
-Running Tests
--------------
-
-Nodeunit comes with a basic command-line test runner, which can be installed
-using 'sudo make install'. Example usage:
-
- nodeunit testmodule1.js testfolder [...]
-
-The default test reporter uses color output, because I think that's more fun :) I
-intend to add a no-color option in future. To give you a feeling of the fun you'll
-be having writing tests, lets fix the example at the start of the README:
-
-<img src="https://github.com/caolan/nodeunit/raw/master/img/example_pass.png" />
-
-Ahhh, Doesn't that feel better?
-
-When using the included test runner, it will exit using the failed number of
-assertions as the exit code. Exiting with 0 when all tests pass.
-
-
-### Command-line Options
-
-* __--reporter FILE__ - you can set the test reporter to a custom module or
-on of the modules in nodeunit/lib/reporters, when omitted, the default test runner
-is used.
-* __--list-reporters__ - list available build-in reporters.
-* __--config FILE__ - load config options from a JSON file, allows
-the customisation of color schemes for the default test reporter etc. See
-bin/nodeunit.json for current available options.
-* __--version__ or __-v__ - report nodeunit version
-* __--help__ - show nodeunit help
-
-
-Running tests in the browser
-----------------------------
-
-Nodeunit tests can also be run inside the browser. For example usage, see
-the examples/browser folder. The basic syntax is as follows:
-
-__test.html__
-
- <html>
- <head>
- <title>Example Test Suite</title>
- <link rel="stylesheet" href="nodeunit.css" type="text/css" />
- <script src="nodeunit.js"></script>
- <script src="suite1.js"></script>
- <script src="suite2.js"></script>
- </head>
- <body>
- <h1 id="nodeunit-header>Example Test Suite</h1>
- <script>
- nodeunit.run({
- 'Suite One': suite1,
- 'Suite Two': suite2
- });
- </script>
- </body>
- </html>
-
-Here, suite1 and suite2 are just object literals containing test functions or
-groups, as would be returned if you did require('test-suite') in node.js:
-
-__suite1.js__
-
- this.suite1 = {
- 'example test': function (test) {
- test.ok(true, 'everything is ok');
- test.done();
- }
- };
-
-If you wish to use a commonjs format for your test suites (using exports), it is
-up to you to define the commonjs tools for the browser. There are a number of
-alternatives and its important it fits with your existing code, which is
-why nodeunit does not currently provide this out of the box.
-
-In the example above, the tests will run when the page is loaded.
-
-The browser-version of nodeunit.js is created in dist/browser when you do, 'make
-browser'. You'll need [UglifyJS](https://github.com/mishoo/UglifyJS) installed in
-order for it to automatically create nodeunit.min.js.
-
-
-Adding nodeunit to Your Projects
---------------------------------
-
-If you don't want people to have to install the nodeunit command-line tool,
-you'll want to create a script that runs the tests for your project with the
-correct require paths set up. Here's an example test script, with a deps
-directory containing the projects dependencies:
-
- #!/usr/bin/env node
- require.paths.unshift(__dirname + '/deps');
-
- var reporter = require('nodeunit').reporters.default;
- reporter.run(['test']);
-
-If you're using git, you might find it useful to include nodeunit as a
-submodule. Using submodules makes it easy for developers to download nodeunit
-and run your test suite, without cluttering up your repository with
-the source code. To add nodeunit as a git submodule do the following:
-
- git submodule add git://github.com/caolan/nodeunit.git deps/nodeunit
-
-This will add nodeunit to the deps folder of your project. Now, when cloning
-the repository, nodeunit can be downloaded by doing the following:
-
- git submodule init
- git submodule update
-
-Let's update the test script above with a helpful hint on how to get nodeunit,
-if its missing:
-
- #!/usr/bin/env node
-
- require.paths.unshift(__dirname + '/deps');
-
- try {
- var reporter = require('nodeunit').reporters.default;
- }
- catch(e) {
- var sys = require('sys');
- sys.puts("Cannot find nodeunit module.");
- sys.puts("You can download submodules for this project by doing:");
- sys.puts("");
- sys.puts(" git submodule init");
- sys.puts(" git submodule update");
- sys.puts("");
- process.exit();
- }
-
- process.chdir(__dirname);
- reporter.run(['test']);
-
-Now if someone attempts to run your test suite without nodeunit installed they
-will be prompted to download the submodules for your project.
-
-
-Built-in Test Reporters
------------------------
-
-* __default__ - The standard reporter seen in the nodeunit screenshots
-* __minimal__ - Pretty, minimal output, shows errors and progress only
-* __html__ - Outputs a HTML report to stdout
-* __junit__ - Creates jUnit compatible XML reports, which can be used with
- continuous integration tools such as [Hudson](http://hudson-ci.org/).
-
-
-Writing a Test Reporter
----------------------
-
-Nodeunit exports runTest(fn, options), runModule(mod, options) and
-runFiles(paths, options). You'll most likely want to run test suites from
-files, which can be done using the latter function. The _options_ argument can
-contain callbacks which run during testing. Nodeunit provides the following
-callbacks:
-
-* __moduleStart(name)__ - called before a module is tested
-* __moduleDone(name, assertions)__ - called once all test functions within the
- module have completed (see assertions object reference below)
- ALL tests within the module
-* __testStart(name)__ - called before a test function is run
-* __testDone(name, assertions)__ - called once a test function has completed
- (by calling test.done())
-* __log(assertion)__ - called whenever an assertion is made (see assertion
- object reference below)
-* __done(assertions)__ - called after all tests/modules are complete
-
-The __assertion__ object:
-
-* __passed()__ - did the assertion pass?
-* __failed()__ - did the assertion fail?
-* __error__ - the AssertionError if the assertion failed
-* __method__ - the nodeunit assertion method used (ok, same, equals...)
-* __message__ - the message the assertion method was called with (optional)
-
-The __assertionList__ object:
-
-* An array-like object with the following new attributes:
- * __failures()__ - the number of assertions which failed
- * __duration__ - the time taken for the test to complete in msecs
-
-For a reference implementation of a test reporter, see lib/reporters/default.js in
-the nodeunit project directory.
-
-
-Sandbox utility
----------------
-
-This is a function which evaluates JavaScript files in a sandbox and returns the
-context. The sandbox function can be used for testing client-side code or private
-un-exported functions within a module.
-
- var sandbox = require('nodeunit').utils.sandbox;
- var example = sandbox('example.js');
-
-__sandbox(files, sandbox)__ - Evaluates JavaScript files in a sandbox, returning
-the context. The first argument can either be a single filename or an array of
-filenames. If multiple filenames are given their contents are concatenated before
-evalution. The second argument is an optional context to use for the sandbox.
-
-
-Running the nodeunit Tests
---------------------------
-
-The tests for nodeunit are written using nodeunit itself as the test framework.
-However, the module test-base.js first does some basic tests using the assert
-module to ensure that test functions are actually run, and a basic level of
-nodeunit functionality is available.
-
-To run the nodeunit tests do:
-
- make test
-
-__Note:__ There was a bug in node v0.2.0 causing the tests to hang, upgrading
-to v0.2.1 fixes this.
-
-
-Contributing
-------------
-
-Contributions to the project are most welcome, so feel free to fork and improve.
-When submitting a pull request, please run 'make lint' first to ensure
-we're following a consistent coding style.
-
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit
deleted file mode 100755
index 4162a2d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env node
-
-var
- fs = require('fs'),
- sys = require('sys'),
- path = require('path');
-
-require.paths.push(process.cwd());
-var args = process.ARGV.slice(2);
-
-var files = [];
-
-var testrunner,
- config_file,
- config_param_found = false,
- output_param_found = false,
- reporter_file = 'default',
- reporter_param_found = false;
-
-var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" +
- "Options:\n\n" +
- " --config FILE the path to a JSON file with options\n" +
- " --reporter FILE optional path to a reporter file to customize the output\n" +
- " --list-reporters list available build-in reporters\n" +
- " -h, --help display this help and exit\n" +
- " -v, --version output version information and exit";
-
-
-// load default options
-var content = fs.readFileSync(__dirname + '/nodeunit.json', 'utf8');
-var options = JSON.parse(content);
-
-// a very basic pseudo --options parser
-args.forEach(function (arg) {
- if (arg.slice(0, 9) === "--config=") {
- config_file = arg.slice(9);
- } else if (arg === '--config') {
- config_param_found = true;
- } else if (config_param_found) {
- config_file = arg;
- config_param_found = false;
- } else if (arg.slice(0, 9) === "--output=") {
- options.output = arg.slice(9);
- } else if (arg === '--output') {
- output_param_found = true;
- } else if (output_param_found) {
- options.output = arg;
- output_param_found = false;
- } else if (arg.slice(0, 11) === "--reporter=") {
- reporter_file = arg.slice(11);
- } else if (arg === '--reporter') {
- reporter_param_found = true;
- } else if (reporter_param_found) {
- reporter_file = arg;
- reporter_param_found = false;
- } else if (arg === '--list-reporters') {
- var reporters = fs.readdirSync(__dirname + '/../lib/reporters');
- reporters = reporters.filter(function (reporter_file) {
- return (/\.js$/).test(reporter_file);
- }).map(function (reporter_file) {
- return reporter_file.replace(/\.js$/, '');
- }).filter(function (reporter_file) {
- return reporter_file !== 'index';
- });
- sys.puts('Build-in reporters: ');
- reporters.forEach(function (reporter_file) {
- var reporter = require('../lib/reporters/' + reporter_file);
- sys.puts(' * ' + reporter_file + (reporter.info ? ': ' + reporter.info : ''));
- });
- process.exit(0);
- } else if ((arg === '-v') || (arg === '--version')) {
- var content = fs.readFileSync(__dirname + '/../package.json', 'utf8');
- var pkg = JSON.parse(content);
- sys.puts(pkg.version);
- process.exit(0);
- } else if ((arg === '-h') || (arg === '--help')) {
- sys.puts(usage);
- process.exit(0);
- } else {
- files.push(arg);
- }
-});
-
-if (files.length === 0) {
- sys.puts('Files required.');
- sys.puts(usage);
- process.exit(1);
-}
-
-if (config_file) {
- content = fs.readFileSync(config_file, 'utf8');
- var custom_options = JSON.parse(content);
-
- for (var option in custom_options) {
- if (typeof option === 'string') {
- options[option] = custom_options[option];
- }
- }
-}
-
-var builtin_reporters = require(__dirname + '/../lib/reporters');
-if (reporter_file in builtin_reporters) {
- testrunner = builtin_reporters[reporter_file];
-}
-else {
- testrunner = require(reporter_file);
-}
-testrunner.run(files, options);
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit.json b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit.json
deleted file mode 100644
index 5c7778f..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/bin/nodeunit.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "error_prefix": "\u001B[31m",
- "error_suffix": "\u001B[39m",
- "ok_prefix": "\u001B[32m",
- "ok_suffix": "\u001B[39m",
- "bold_prefix": "\u001B[1m",
- "bold_suffix": "\u001B[22m",
- "assertion_prefix": "\u001B[35m",
- "assertion_suffix": "\u001B[39m"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/async.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/async.js
deleted file mode 100644
index c8fccc3..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/async.js
+++ /dev/null
@@ -1,602 +0,0 @@
-/*global setTimeout: false, console: false */
-(function () {
-
- var async = {};
-
- // global on the server, window in the browser
- var root = this,
- previous_async = root.async;
-
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = async;
- }
- else {
- root.async = async;
- }
-
- async.noConflict = function () {
- root.async = previous_async;
- return async;
- };
-
- //// cross-browser compatiblity functions ////
-
- var _forEach = function (arr, iterator) {
- if (arr.forEach) {
- return arr.forEach(iterator);
- }
- for (var i = 0; i < arr.length; i += 1) {
- iterator(arr[i], i, arr);
- }
- };
-
- var _map = function (arr, iterator) {
- if (arr.map) {
- return arr.map(iterator);
- }
- var results = [];
- _forEach(arr, function (x, i, a) {
- results.push(iterator(x, i, a));
- });
- return results;
- };
-
- var _reduce = function (arr, iterator, memo) {
- if (arr.reduce) {
- return arr.reduce(iterator, memo);
- }
- _forEach(arr, function (x, i, a) {
- memo = iterator(memo, x, i, a);
- });
- return memo;
- };
-
- var _keys = function (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
- var keys = [];
- for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- keys.push(k);
- }
- }
- return keys;
- };
-
- var _indexOf = function (arr, item) {
- if (arr.indexOf) {
- return arr.indexOf(item);
- }
- for (var i = 0; i < arr.length; i += 1) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- };
-
- //// exported async module functions ////
-
- //// nextTick implementation with browser-compatible fallback ////
- async.nextTick = function (fn) {
- if (typeof process === 'undefined' || !(process.nextTick)) {
- setTimeout(fn, 0);
- }
- else {
- process.nextTick(fn);
- }
- };
-
- async.forEach = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- _forEach(arr, function (x) {
- iterator(x, function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- }
- });
- });
- };
-
- async.forEachSeries = function (arr, iterator, callback) {
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- var iterate = function () {
- iterator(arr[completed], function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed === arr.length) {
- callback();
- }
- else {
- iterate();
- }
- }
- });
- };
- iterate();
- };
-
-
- var doParallel = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEach].concat(args));
- };
- };
- var doSeries = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEachSeries].concat(args));
- };
- };
-
-
- var _asyncMap = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (err, v) {
- results[x.index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- };
- async.map = doParallel(_asyncMap);
- async.mapSeries = doSeries(_asyncMap);
-
-
- // reduce only has a series version, as doing reduce in parallel won't
- // work in many situations.
- async.reduce = function (arr, memo, iterator, callback) {
- async.forEachSeries(arr, function (x, callback) {
- iterator(memo, x, function (err, v) {
- memo = v;
- callback(err);
- });
- }, function (err) {
- callback(err, memo);
- });
- };
- // inject alias
- async.inject = async.reduce;
- // foldl alias
- async.foldl = async.reduce;
-
- async.reduceRight = function (arr, memo, iterator, callback) {
- var reversed = _map(arr, function (x) {
- return x;
- }).reverse();
- async.reduce(reversed, memo, iterator, callback);
- };
- // foldr alias
- async.foldr = async.reduceRight;
-
- var _filter = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.filter = doParallel(_filter);
- async.filterSeries = doSeries(_filter);
- // select alias
- async.select = async.filter;
- async.selectSeries = async.filterSeries;
-
- var _reject = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (!v) {
- results.push(x);
- }
- callback();
- });
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
- async.reject = doParallel(_reject);
- async.rejectSeries = doSeries(_reject);
-
- var _detect = function (eachfn, arr, iterator, main_callback) {
- eachfn(arr, function (x, callback) {
- iterator(x, function (result) {
- if (result) {
- main_callback(x);
- }
- else {
- callback();
- }
- });
- }, function (err) {
- main_callback();
- });
- };
- async.detect = doParallel(_detect);
- async.detectSeries = doSeries(_detect);
-
- async.some = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (v) {
- main_callback(true);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(false);
- });
- };
- // any alias
- async.any = async.some;
-
- async.every = function (arr, iterator, main_callback) {
- async.forEach(arr, function (x, callback) {
- iterator(x, function (v) {
- if (!v) {
- main_callback(false);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(true);
- });
- };
- // all alias
- async.all = async.every;
-
- async.sortBy = function (arr, iterator, callback) {
- async.map(arr, function (x, callback) {
- iterator(x, function (err, criteria) {
- if (err) {
- callback(err);
- }
- else {
- callback(null, {value: x, criteria: criteria});
- }
- });
- }, function (err, results) {
- if (err) {
- return callback(err);
- }
- else {
- var fn = function (left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- };
- callback(null, _map(results.sort(fn), function (x) {
- return x.value;
- }));
- }
- });
- };
-
- async.auto = function (tasks, callback) {
- callback = callback || function () {};
- var keys = _keys(tasks);
- if (!keys.length) {
- return callback(null);
- }
-
- var completed = [];
-
- var listeners = [];
- var addListener = function (fn) {
- listeners.unshift(fn);
- };
- var removeListener = function (fn) {
- for (var i = 0; i < listeners.length; i += 1) {
- if (listeners[i] === fn) {
- listeners.splice(i, 1);
- return;
- }
- }
- };
- var taskComplete = function () {
- _forEach(listeners, function (fn) {
- fn();
- });
- };
-
- addListener(function () {
- if (completed.length === keys.length) {
- callback(null);
- }
- });
-
- _forEach(keys, function (k) {
- var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
- var taskCallback = function (err) {
- if (err) {
- callback(err);
- // stop subsequent errors hitting callback multiple times
- callback = function () {};
- }
- else {
- completed.push(k);
- taskComplete();
- }
- };
- var requires = task.slice(0, Math.abs(task.length - 1)) || [];
- var ready = function () {
- return _reduce(requires, function (a, x) {
- return (a && _indexOf(completed, x) !== -1);
- }, true);
- };
- if (ready()) {
- task[task.length - 1](taskCallback);
- }
- else {
- var listener = function () {
- if (ready()) {
- removeListener(listener);
- task[task.length - 1](taskCallback);
- }
- };
- addListener(listener);
- }
- });
- };
-
- async.waterfall = function (tasks, callback) {
- if (!tasks.length) {
- return callback();
- }
- callback = callback || function () {};
- var wrapIterator = function (iterator) {
- return function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- var args = Array.prototype.slice.call(arguments, 1);
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- }
- else {
- args.push(callback);
- }
- async.nextTick(function () {
- iterator.apply(null, args);
- });
- }
- };
- };
- wrapIterator(async.iterator(tasks))();
- };
-
- async.parallel = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.map(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEach(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.series = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.mapSeries(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.forEachSeries(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
-
- async.iterator = function (tasks) {
- var makeCallback = function (index) {
- var fn = function () {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- };
- fn.next = function () {
- return (index < tasks.length - 1) ? makeCallback(index + 1): null;
- };
- return fn;
- };
- return makeCallback(0);
- };
-
- async.apply = function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function () {
- return fn.apply(
- null, args.concat(Array.prototype.slice.call(arguments))
- );
- };
- };
-
- var _concat = function (eachfn, arr, fn, callback) {
- var r = [];
- eachfn(arr, function (x, cb) {
- fn(x, function (err, y) {
- r = r.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, r);
- });
- };
- async.concat = doParallel(_concat);
- async.concatSeries = doSeries(_concat);
-
- async.whilst = function (test, iterator, callback) {
- if (test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.whilst(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.until = function (test, iterator, callback) {
- if (!test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.until(test, iterator, callback);
- });
- }
- else {
- callback();
- }
- };
-
- async.queue = function (worker, concurrency) {
- var workers = 0;
- var tasks = [];
- var q = {
- concurrency: concurrency,
- push: function (data, callback) {
- tasks.push({data: data, callback: callback});
- async.nextTick(q.process);
- },
- process: function () {
- if (workers < q.concurrency && tasks.length) {
- var task = tasks.splice(0, 1)[0];
- workers += 1;
- worker(task.data, function () {
- workers -= 1;
- if (task.callback) {
- task.callback.apply(task, arguments);
- }
- q.process();
- });
- }
- },
- length: function () {
- return tasks.length;
- }
- };
- return q;
- };
-
- var _console_fn = function (name) {
- return function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- fn.apply(null, args.concat([function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (typeof console !== 'undefined') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- }
- else if (console[name]) {
- _forEach(args, function (x) {
- console[name](x);
- });
- }
- }
- }]));
- };
- };
- async.log = _console_fn('log');
- async.dir = _console_fn('dir');
- /*async.info = _console_fn('info');
- async.warn = _console_fn('warn');
- async.error = _console_fn('error');*/
-
-}());
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js
deleted file mode 100644
index f6abf29..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js
+++ /dev/null
@@ -1,125 +0,0 @@
-
-/*!
- * EJS
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var sys = require('sys');
-
-/**
- * Library version.
- */
-
-exports.version = '0.0.3';
-
-/**
- * Intermediate js cache.
- *
- * @type Object
- */
-
-var cache = {};
-
-/**
- * Clear intermediate js cache.
- *
- * @api public
- */
-
-exports.clearCache = function(){
- cache = {};
-};
-
-/**
- * Escape the given string of `html`.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-function escape(html){
- return String(html)
- .replace(/&(?!\w+;)/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;');
-}
-
-/**
- * Parse the given `str` of ejs, returning the function body.
- *
- * @param {String} str
- * @return {String}
- * @api public
- */
-
-var parse = exports.parse = function(str){
- return 'var buf = [];\n'
- + "with (locals) {\nbuf.push('"
- + String(str)
- .replace(/[\r\t]/g, " ")
- .replace(/\n/g, "\\n")
- .split("<%").join("\t")
- .replace(/((^|%>)[^\t]*)'/g, "$1\r")
- .replace(/\t=(.*?)%>/g, "', escape($1) ,'")
- .replace(/\t-(.*?)%>/g, "', $1 ,'")
- .split("\t").join("');")
- .split("%>").join("buf.push('")
- .split("\r").join("\\'")
- + "');\n}\nreturn buf.join('');";
-};
-
-/**
- * Compile the given `str` of ejs into a `Function`.
- *
- * @param {String} str
- * @param {Object} options
- * @return {Function}
- * @api public
- */
-
-var compile = exports.compile = function(str, options){
- if (options.debug) sys.puts(parse(str));
- return new Function('locals, escape', parse(str));
-};
-
-/**
- * Render the given `str` of ejs.
- *
- * Options:
- *
- * - `locals` Local variables object
- * - `cache` Compiled functions are cached, requires `filename`
- * - `filename` Used by `cache` to key caches
- * - `context|scope` Function execution context
- * - `debug` Output generated function body
- *
- * @param {String} str
- * @param {Object} options
- * @return {String}
- * @api public
- */
-
-exports.render = function(str, options){
- var fn,
- options = options || {};
- if (options.cache) {
- if (options.filename) {
- fn = cache[options.filename] = compile(str, options);
- } else {
- throw new Error('"cache" option requires "filename".');
- }
- } else {
- fn = compile(str, options);
- }
- return fn.call(
- options.context || options.scope,
- options.locals || {},
- escape);
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js
deleted file mode 100644
index 22b44d9..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- http://www.JSON.org/json2.js
- 2010-11-17
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or '&nbsp;'),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, strict: false, regexp: false */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (!this.JSON) {
- this.JSON = {};
-}
-
-(function () {
- "use strict";
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf()) ?
- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ?
- '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
-.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
-.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
-.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md
deleted file mode 100644
index efde75c..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md
+++ /dev/null
@@ -1,60 +0,0 @@
-nodeunit(1) -- simple node.js unit testing tool
-===============================================
-
-## SYNOPSIS
-
- nodeunit [options] <file-or-directory> [<file-or-directory> ...]
-
-## DESCRIPTION
-
-Nodeunit is a simple unit testing tool based on the node.js assert module.
-
-* Simple to use
-* Just export the tests from a module
-* Helps you avoid common pitfalls when testing asynchronous code
-* Easy to add test cases with setUp and tearDown functions if you wish
-* Allows the use of mocks and stubs
-
-## OPTIONS
-
- __--config FILE__:
- Load config options from a JSON file, allows the customisation
- of color schemes for the default test reporter etc.
- See bin/nodeunit.json for current available options.
-
- __--reporter FILE__:
- You can set the test reporter to a custom module or on of the modules
- in nodeunit/lib/reporters, when omitted, the default test runner is used.
-
- __--list-reporters__:
- List available build-in reporters.
-
- __-h__, __--help__:
- Display the help and exit.
-
- __-v__, __--version__:
- Output version information and exit.
-
- __<file-or-directory>__:
- You can run nodeunit on specific files or on all *\*.js* files inside
- a directory.
-
-## AUTHORS
-
-Written by Caolan McMahon and other nodeunit contributors.
-Contributors list: <http://github.com/caolan/nodeunit/contributors>.
-
-## REPORTING BUGS
-
-Report nodeunit bugs to <http://github.com/caolan/nodeunit/issues>.
-
-## COPYRIGHT
-
-Copyright © 2010 Caolan McMahon.
-Nodeunit has been released under the MIT license:
-<http://github.com/caolan/nodeunit/raw/master/LICENSE>.
-
-## SEE ALSO
-
-node(1)
-
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js
deleted file mode 100644
index 8c12b0f..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js
+++ /dev/null
@@ -1,1757 +0,0 @@
-/*!
- * Nodeunit
- * https://github.com/caolan/nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * json2.js
- * http://www.JSON.org/json2.js
- * Public Domain.
- * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
- */
-nodeunit = (function(){
-/*
- http://www.JSON.org/json2.js
- 2010-11-17
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or '&nbsp;'),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, strict: false, regexp: false */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (!this.JSON) {
- this.JSON = {};
-}
-
-(function () {
- "use strict";
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf()) ?
- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ?
- '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' :
- '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
-.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
-.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
-.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
-var assert = {};
-var types = {};
-var core = {};
-var nodeunit = {};
-var reporter = {};
-(function(){
-
- var async = {};
-
- // global on the server, window in the browser
- var root = this;
- var previous_async = root.async;
-
- if(typeof module !== 'undefined' && module.exports) module.exports = async;
- else root.async = async;
-
- async.noConflict = function(){
- root.async = previous_async;
- return async;
- };
-
- //// cross-browser compatiblity functions ////
-
- var _forEach = function(arr, iterator){
- if(arr.forEach) return arr.forEach(iterator);
- for(var i=0; i<arr.length; i++){
- iterator(arr[i], i, arr);
- }
- };
-
- var _map = function(arr, iterator){
- if(arr.map) return arr.map(iterator);
- var results = [];
- _forEach(arr, function(x, i, a){
- results.push(iterator(x, i, a));
- })
- return results;
- };
-
- var _reduce = function(arr, iterator, memo){
- if(arr.reduce) return arr.reduce(iterator, memo);
- _forEach(arr, function(x, i, a){
- memo = iterator(memo, x, i, a);
- });
- return memo;
- };
-
- var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
- };
-
- var _indexOf = function(arr, item){
- if(arr.indexOf) return arr.indexOf(item);
- for(var i=0; i<arr.length; i++){
- if(arr[i] === item) return i;
- }
- return -1;
- };
-
- //// exported async module functions ////
-
- //// nextTick implementation with browser-compatible fallback ////
- async.nextTick = function(fn){
- if(typeof process == 'undefined' || !(process.nextTick)){
- setTimeout(fn, 0);
- }
- else process.nextTick(fn);
- };
-
- async.forEach = function(arr, iterator, callback){
- if(!arr.length) return callback();
- var completed = 0;
- _forEach(arr, function(x){
- iterator(x, function(err){
- if(err){
- callback(err);
- callback = function(){};
- }
- else {
- completed++;
- if(completed == arr.length) callback();
- }
- });
- });
- };
-
- async.forEachSeries = function(arr, iterator, callback){
- if(!arr.length) return callback();
- var completed = 0;
- var iterate = function(){
- iterator(arr[completed], function(err){
- if(err){
- callback(err);
- callback = function(){};
- }
- else {
- completed++;
- if(completed == arr.length) callback();
- else iterate();
- }
- });
- };
- iterate();
- };
-
-
- var doParallel = function(fn){
- return function(){
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEach].concat(args));
- };
- };
- var doSeries = function(fn){
- return function(){
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.forEachSeries].concat(args));
- };
- };
-
-
- var _asyncMap = function(eachfn, arr, iterator, callback){
- var results = [];
- arr = _map(arr, function(x, i){
- return {index: i, value: x};
- });
- eachfn(arr, function(x, callback){
- iterator(x.value, function(err, v){
- results[x.index] = v;
- callback(err);
- });
- }, function(err){
- callback(err, results);
- });
- };
- async.map = doParallel(_asyncMap);
- async.mapSeries = doSeries(_asyncMap);
-
-
- // reduce only has a series version, as doing reduce in parallel won't
- // work in many situations.
- async.reduce = function(arr, memo, iterator, callback){
- async.forEachSeries(arr, function(x, callback){
- iterator(memo, x, function(err, v){
- memo = v;
- callback(err);
- });
- }, function(err){
- callback(err, memo);
- });
- };
- // inject alias
- async.inject = async.reduce;
- // foldl alias
- async.foldl = async.reduce;
-
- async.reduceRight = function(arr, memo, iterator, callback){
- var reversed = _map(arr, function(x){return x;}).reverse();
- async.reduce(reversed, memo, iterator, callback);
- };
- // foldr alias
- async.foldr = async.reduceRight;
-
- var _filter = function(eachfn, arr, iterator, callback){
- var results = [];
- arr = _map(arr, function(x, i){
- return {index: i, value: x};
- });
- eachfn(arr, function(x, callback){
- iterator(x.value, function(v){
- if(v) results.push(x);
- callback();
- });
- }, function(err){
- callback(_map(results.sort(function(a,b){
- return a.index - b.index;
- }), function(x){
- return x.value;
- }));
- });
- };
- async.filter = doParallel(_filter);
- async.filterSeries = doSeries(_filter);
- // select alias
- async.select = async.filter;
- async.selectSeries = async.filterSeries;
-
- var _reject = function(eachfn, arr, iterator, callback){
- var results = [];
- arr = _map(arr, function(x, i){
- return {index: i, value: x};
- });
- eachfn(arr, function(x, callback){
- iterator(x.value, function(v){
- if(!v) results.push(x);
- callback();
- });
- }, function(err){
- callback(_map(results.sort(function(a,b){
- return a.index - b.index;
- }), function(x){
- return x.value;
- }));
- });
- };
- async.reject = doParallel(_reject);
- async.rejectSeries = doSeries(_reject);
-
- var _detect = function(eachfn, arr, iterator, main_callback){
- eachfn(arr, function(x, callback){
- iterator(x, function(result){
- if(result) main_callback(x);
- else callback();
- });
- }, function(err){
- main_callback();
- });
- };
- async.detect = doParallel(_detect);
- async.detectSeries = doSeries(_detect);
-
- async.some = function(arr, iterator, main_callback){
- async.forEach(arr, function(x, callback){
- iterator(x, function(v){
- if(v){
- main_callback(true);
- main_callback = function(){};
- }
- callback();
- });
- }, function(err){
- main_callback(false);
- });
- };
- // any alias
- async.any = async.some;
-
- async.every = function(arr, iterator, main_callback){
- async.forEach(arr, function(x, callback){
- iterator(x, function(v){
- if(!v){
- main_callback(false);
- main_callback = function(){};
- }
- callback();
- });
- }, function(err){
- main_callback(true);
- });
- };
- // all alias
- async.all = async.every;
-
- async.sortBy = function(arr, iterator, callback){
- async.map(arr, function(x, callback){
- iterator(x, function(err, criteria){
- if(err) callback(err);
- else callback(null, {value: x, criteria: criteria});
- });
- }, function(err, results){
- if(err) return callback(err);
- else callback(null, _map(results.sort(function(left, right){
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }), function(x){return x.value;}));
- })
- };
-
- async.auto = function(tasks, callback){
- callback = callback || function(){};
- var keys = _keys(tasks);
- if(!keys.length) return callback(null);
-
- var completed = [];
-
- var listeners = [];
- var addListener = function(fn){
- listeners.unshift(fn);
- };
- var removeListener = function(fn){
- for(var i=0; i<listeners.length; i++){
- if(listeners[i] === fn){
- listeners.splice(i, 1);
- return;
- }
- }
- };
- var taskComplete = function(){
- _forEach(listeners, function(fn){fn();});
- };
-
- addListener(function(){
- if(completed.length == keys.length){
- callback(null);
- }
- });
-
- _forEach(keys, function(k){
- var task = (tasks[k] instanceof Function)? [tasks[k]]: tasks[k];
- var taskCallback = function(err){
- if(err){
- callback(err);
- // stop subsequent errors hitting callback multiple times
- callback = function(){};
- }
- else {
- completed.push(k);
- taskComplete();
- }
- };
- var requires = task.slice(0, Math.abs(task.length-1)) || [];
- var ready = function(){
- return _reduce(requires, function(a,x){
- return (a && _indexOf(completed, x) != -1);
- }, true);
- };
- if(ready()) task[task.length-1](taskCallback);
- else {
- var listener = function(){
- if(ready()){
- removeListener(listener);
- task[task.length-1](taskCallback);
- }
- };
- addListener(listener);
- }
- });
- };
-
- async.waterfall = function(tasks, callback){
- if(!tasks.length) return callback();
- callback = callback || function(){};
- var wrapIterator = function(iterator){
- return function(err){
- if(err){
- callback(err);
- callback = function(){};
- }
- else {
- var args = Array.prototype.slice.call(arguments, 1);
- var next = iterator.next();
- if(next) args.push(wrapIterator(next));
- else args.push(callback);
- async.nextTick(function(){iterator.apply(null, args);});
- }
- };
- };
- wrapIterator(async.iterator(tasks))();
- };
-
- async.parallel = function(tasks, callback){
- callback = callback || function(){};
- async.map(tasks, function(fn, callback){
- if(fn){
- fn(function(err){
- var args = Array.prototype.slice.call(arguments,1);
- if(args.length <= 1) args = args[0];
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- };
-
- async.series = function(tasks, callback){
- callback = callback || function(){};
- async.mapSeries(tasks, function(fn, callback){
- if(fn){
- fn(function(err){
- var args = Array.prototype.slice.call(arguments,1);
- if(args.length <= 1) args = args[0];
- callback.call(null, err, args || null);
- });
- }
- }, callback);
- };
-
- async.iterator = function(tasks){
- var makeCallback = function(index){
- var fn = function(){
- if(tasks.length) tasks[index].apply(null, arguments);
- return fn.next();
- };
- fn.next = function(){
- return (index < tasks.length-1)? makeCallback(index+1): null;
- };
- return fn;
- };
- return makeCallback(0);
- };
-
- async.apply = function(fn){
- var args = Array.prototype.slice.call(arguments, 1);
- return function(){
- return fn.apply(
- null, args.concat(Array.prototype.slice.call(arguments))
- );
- };
- };
-
- var _concat = function(eachfn, arr, fn, callback){
- var r = [];
- eachfn(arr, function(x, cb){
- fn(x, function(err, y){
- r = r.concat(y || []);
- cb(err);
- });
- }, function(err){
- callback(err, r);
- });
- };
- async.concat = doParallel(_concat);
- async.concatSeries = doSeries(_concat);
-
- var _console_fn = function(name){
- return function(fn){
- var args = Array.prototype.slice.call(arguments, 1);
- fn.apply(null, args.concat([function(err){
- var args = Array.prototype.slice.call(arguments, 1);
- if(typeof console != 'undefined'){
- if(err){
- if(console.error) console.error(err);
- }
- else if(console[name]){
- _forEach(args, function(x){console[name](x);});
- }
- }
- }]));
- };
- };
- async.log = _console_fn('log');
- async.dir = _console_fn('dir');
- /*async.info = _console_fn('info');
- async.warn = _console_fn('warn');
- async.error = _console_fn('error');*/
-
-})();
-(function(exports){
-/**
- * This file is based on the node.js assert module, but with some small
- * changes for browser-compatibility
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- */
-
-
-/**
- * Added for browser compatibility
- */
-
-var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
-};
-
-
-
-// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
-//
-// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
-//
-// Originally from narwhal.js (http://narwhaljs.org)
-// Copyright (c) 2009 Thomas Robinson <280north.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 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.
-
-
-var pSlice = Array.prototype.slice;
-
-// 1. The assert module provides functions that throw
-// AssertionError's when particular conditions are not met. The
-// assert module must conform to the following interface.
-
-var assert = exports;
-
-// 2. The AssertionError is defined in assert.
-// new assert.AssertionError({message: message, actual: actual, expected: expected})
-
-assert.AssertionError = function AssertionError (options) {
- this.name = "AssertionError";
- this.message = options.message;
- this.actual = options.actual;
- this.expected = options.expected;
- this.operator = options.operator;
- var stackStartFunction = options.stackStartFunction || fail;
-
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, stackStartFunction);
- }
-};
-// code from util.inherits in node
-assert.AssertionError.super_ = Error;
-
-
-// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call
-// TODO: test what effect this may have
-var ctor = function () { this.constructor = assert.AssertionError; };
-ctor.prototype = Error.prototype;
-assert.AssertionError.prototype = new ctor();
-
-
-assert.AssertionError.prototype.toString = function() {
- if (this.message) {
- return [this.name+":", this.message].join(' ');
- } else {
- return [ this.name+":"
- , JSON.stringify(this.expected )
- , this.operator
- , JSON.stringify(this.actual)
- ].join(" ");
- }
-};
-
-// assert.AssertionError instanceof Error
-
-assert.AssertionError.__proto__ = Error.prototype;
-
-// At present only the three keys mentioned above are used and
-// understood by the spec. Implementations or sub modules can pass
-// other keys to the AssertionError's constructor - they will be
-// ignored.
-
-// 3. All of the following functions must throw an AssertionError
-// when a corresponding condition is not met, with a message that
-// may be undefined if not provided. All assertion methods provide
-// both the actual and expected values to the assertion error for
-// display purposes.
-
-function fail(actual, expected, message, operator, stackStartFunction) {
- throw new assert.AssertionError({
- message: message,
- actual: actual,
- expected: expected,
- operator: operator,
- stackStartFunction: stackStartFunction
- });
-}
-
-// EXTENSION! allows for well behaved errors defined elsewhere.
-assert.fail = fail;
-
-// 4. Pure assertion tests whether a value is truthy, as determined
-// by !!guard.
-// assert.ok(guard, message_opt);
-// This statement is equivalent to assert.equal(true, guard,
-// message_opt);. To test strictly for the value true, use
-// assert.strictEqual(true, guard, message_opt);.
-
-assert.ok = function ok(value, message) {
- if (!!!value) fail(value, true, message, "==", assert.ok);
-};
-
-// 5. The equality assertion tests shallow, coercive equality with
-// ==.
-// assert.equal(actual, expected, message_opt);
-
-assert.equal = function equal(actual, expected, message) {
- if (actual != expected) fail(actual, expected, message, "==", assert.equal);
-};
-
-// 6. The non-equality assertion tests for whether two objects are not equal
-// with != assert.notEqual(actual, expected, message_opt);
-
-assert.notEqual = function notEqual(actual, expected, message) {
- if (actual == expected) {
- fail(actual, expected, message, "!=", assert.notEqual);
- }
-};
-
-// 7. The equivalence assertion tests a deep equality relation.
-// assert.deepEqual(actual, expected, message_opt);
-
-assert.deepEqual = function deepEqual(actual, expected, message) {
- if (!_deepEqual(actual, expected)) {
- fail(actual, expected, message, "deepEqual", assert.deepEqual);
- }
-};
-
-function _deepEqual(actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
-
- } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
- if (actual.length != expected.length) return false;
-
- for (var i = 0; i < actual.length; i++) {
- if (actual[i] !== expected[i]) return false;
- }
-
- return true;
-
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
-}
-
-function isUndefinedOrNull (value) {
- return value === null || value === undefined;
-}
-
-function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
-}
-
-function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return _deepEqual(a, b);
- }
- try{
- var ka = _keys(a),
- kb = _keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!_deepEqual(a[key], b[key] ))
- return false;
- }
- return true;
-}
-
-// 8. The non-equivalence assertion tests for any deep inequality.
-// assert.notDeepEqual(actual, expected, message_opt);
-
-assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
- if (_deepEqual(actual, expected)) {
- fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual);
- }
-};
-
-// 9. The strict equality assertion tests strict equality, as determined by ===.
-// assert.strictEqual(actual, expected, message_opt);
-
-assert.strictEqual = function strictEqual(actual, expected, message) {
- if (actual !== expected) {
- fail(actual, expected, message, "===", assert.strictEqual);
- }
-};
-
-// 10. The strict non-equality assertion tests for strict inequality, as determined by !==.
-// assert.notStrictEqual(actual, expected, message_opt);
-
-assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
- if (actual === expected) {
- fail(actual, expected, message, "!==", assert.notStrictEqual);
- }
-};
-
-function _throws (shouldThrow, block, err, message) {
- var exception = null,
- threw = false,
- typematters = true;
-
- message = message || "";
-
- //handle optional arguments
- if (arguments.length == 3) {
- if (typeof(err) == "string") {
- message = err;
- typematters = false;
- }
- } else if (arguments.length == 2) {
- typematters = false;
- }
-
- try {
- block();
- } catch (e) {
- threw = true;
- exception = e;
- }
-
- if (shouldThrow && !threw) {
- fail( "Missing expected exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if (!shouldThrow && threw && typematters && exception instanceof err) {
- fail( "Got unwanted exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if ((shouldThrow && threw && typematters && !(exception instanceof err)) ||
- (!shouldThrow && threw)) {
- throw exception;
- }
-};
-
-// 11. Expected to throw an error:
-// assert.throws(block, Error_opt, message_opt);
-
-assert.throws = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [true].concat(pSlice.call(arguments)));
-};
-
-// EXTENSION! This is annoying to write outside this module.
-assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [false].concat(pSlice.call(arguments)));
-};
-
-assert.ifError = function (err) { if (err) {throw err;}};
-})(assert);
-(function(exports){
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-/**
- * Module dependencies
- */
-
-
-
-/**
- * Creates assertion objects representing the result of an assert call.
- * Accepts an object or AssertionError as its argument.
- *
- * @param {object} obj
- * @api public
- */
-
-exports.assertion = function (obj) {
- return {
- method: obj.method || '',
- message: obj.message || (obj.error && obj.error.message) || '',
- error: obj.error,
- passed: function () {
- return !this.error;
- },
- failed: function () {
- return Boolean(this.error);
- }
- };
-};
-
-/**
- * Creates an assertion list object representing a group of assertions.
- * Accepts an array of assertion objects.
- *
- * @param {Array} arr
- * @param {Number} duration
- * @api public
- */
-
-exports.assertionList = function (arr, duration) {
- var that = arr || [];
- that.failures = function () {
- var failures = 0;
- for (var i=0; i<this.length; i++) {
- if (this[i].failed()) failures++;
- }
- return failures;
- };
- that.duration = duration || 0;
- return that;
-};
-
-/**
- * Create a wrapper function for assert module methods. Executes a callback
- * after the it's complete with an assertion object representing the result.
- *
- * @param {Function} callback
- * @api private
- */
-
-var assertWrapper = function (callback) {
- return function (new_method, assert_method, arity) {
- return function () {
- var message = arguments[arity-1];
- var a = exports.assertion({method: new_method, message: message});
- try {
- assert[assert_method].apply(null, arguments);
- }
- catch (e) {
- a.error = e;
- }
- callback(a);
- };
- };
-};
-
-/**
- * Creates the 'test' object that gets passed to every test function.
- * Accepts the name of the test function as its first argument, followed by
- * the start time in ms, the options object and a callback function.
- *
- * @param {String} name
- * @param {Number} start
- * @param {Object} options
- * @param {Function} callback
- * @api public
- */
-
-exports.test = function (name, start, options, callback) {
- var expecting;
- var a_list = [];
-
- var wrapAssert = assertWrapper(function (a) {
- a_list.push(a);
- async.nextTick(function () {
- options.log(a);
- });
- });
-
- var test = {
- done: function (err) {
- if (expecting !== undefined && expecting !== a_list.length) {
- var e = new Error(
- 'Expected ' + expecting + ' assertions, ' +
- a_list.length + ' ran'
- );
- var a1 = exports.assertion({method: 'expect', error: e});
- a_list.push(a1);
- async.nextTick(function () {
- options.log(a1);
- });
- }
- if (err) {
- var a2 = exports.assertion({error: err});
- a_list.push(a2);
- async.nextTick(function () {
- options.log(a2);
- });
- }
- var end = new Date().getTime();
- async.nextTick(function () {
- var assertion_list = exports.assertionList(a_list, end - start);
- options.testDone(name, assertion_list);
- callback(null, a_list);
- });
- },
- ok: wrapAssert('ok', 'ok', 2),
- same: wrapAssert('same', 'deepEqual', 3),
- equals: wrapAssert('equals', 'equal', 3),
- expect: function (num) {
- expecting = num;
- },
- _assertion_list: a_list
- };
- // add all functions from the assert module
- for (var k in assert) {
- if (assert.hasOwnProperty(k)) {
- test[k] = wrapAssert(k, k, assert[k].length);
- }
- }
- return test;
-};
-
-/**
- * Ensures an options object has all callbacks, adding empty callback functions
- * if any are missing.
- *
- * @param {Object} opt
- * @return {Object}
- * @api public
- */
-
-exports.options = function (opt) {
- var optionalCallback = function (name) {
- opt[name] = opt[name] || function () {};
- };
-
- optionalCallback('moduleStart');
- optionalCallback('moduleDone');
- optionalCallback('testStart');
- optionalCallback('testDone');
- optionalCallback('log');
-
- // 'done' callback is not optional.
-
- return opt;
-};
-})(types);
-(function(exports){
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-/**
- * Module dependencies
- */
-
-
-
-/**
- * Added for browser compatibility
- */
-
-var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
-};
-
-
-/**
- * Runs a test function (fn) from a loaded module. After the test function
- * calls test.done(), the callback is executed with an assertionList as its
- * second argument.
- *
- * @param {String} name
- * @param {Function} fn
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runTest = function (name, fn, opt, callback) {
- var options = types.options(opt);
-
- options.testStart(name);
- var start = new Date().getTime();
- var test = types.test(name, start, options, callback);
-
- try {
- fn(test);
- }
- catch (e) {
- test.done(e);
- }
-};
-
-/**
- * Takes an object containing test functions or other test suites as properties
- * and runs each in series. After all tests have completed, the callback is
- * called with a list of all assertions as the second argument.
- *
- * If a name is passed to this function it is prepended to all test and suite
- * names that run within it.
- *
- * @param {String} name
- * @param {Object} suite
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runSuite = function (name, suite, opt, callback) {
- var keys = _keys(suite);
-
- async.concatSeries(keys, function (k, cb) {
- var prop = suite[k], _name;
-
- _name = name ? [].concat(name, k) : [k];
-
- _name.toString = function () {
- // fallback for old one
- return this.join(' - ');
- };
-
- if (typeof prop === 'function') {
- exports.runTest(_name, suite[k], opt, cb);
- }
- else {
- exports.runSuite(_name, suite[k], opt, cb);
- }
- }, callback);
-};
-
-/**
- * Run each exported test function or test suite from a loaded module.
- *
- * @param {String} name
- * @param {Object} mod
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runModule = function (name, mod, opt, callback) {
- var options = types.options(opt);
-
- options.moduleStart(name);
- var start = new Date().getTime();
-
- exports.runSuite(null, mod, opt, function (err, a_list) {
- var end = new Date().getTime();
- var assertion_list = types.assertionList(a_list, end - start);
- options.moduleDone(name, assertion_list);
- callback(null, a_list);
- });
-};
-
-/**
- * Treats an object literal as a list of modules keyed by name. Runs each
- * module and finished with calling 'done'. You can think of this as a browser
- * safe alternative to runFiles in the nodeunit module.
- *
- * @param {Object} modules
- * @param {Object} opt
- * @api public
- */
-
-// TODO: add proper unit tests for this function
-exports.runModules = function (modules, opt) {
- var all_assertions = [];
- var options = types.options(opt);
- var start = new Date().getTime();
-
- async.concatSeries(_keys(modules), function (k, cb) {
- exports.runModule(k, modules[k], options, cb);
- },
- function (err, all_assertions) {
- var end = new Date().getTime();
- options.done(types.assertionList(all_assertions, end - start));
- });
-};
-
-
-/**
- * Utility for wrapping a suite of test functions with setUp and tearDown
- * functions.
- *
- * @param {Object} suite
- * @return {Object}
- * @api public
- */
-
-exports.testCase = function (suite) {
- var tests = {};
-
- var setUp = suite.setUp;
- var tearDown = suite.tearDown;
- delete suite.setUp;
- delete suite.tearDown;
-
- var keys = _keys(suite);
-
- // TODO: replace reduce here with browser-safe alternative
- return keys.reduce(function (tests, k) {
- tests[k] = function (test) {
- var context = {};
- if (tearDown) {
- var done = test.done;
- test.done = function (err) {
- try {
- tearDown.call(context, function (err2) {
- if (err && err2) {
- test._assertion_list.push(
- types.assertion({error: err})
- );
- return done(err2);
- }
- done(err || err2);
- });
- }
- catch (e) {
- done(e);
- }
- };
- }
- if (setUp) {
- setUp.call(context, function (err) {
- if (err) {
- return test.done(err);
- }
- suite[k].call(context, test);
- });
- }
- else {
- suite[k].call(context, test);
- }
- };
-
- return tests;
- }, {});
-};
-})(core);
-(function(exports){
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-
-/**
- * NOTE: this test runner is not listed in index.js because it cannot be
- * used with the command-line tool, only inside the browser.
- */
-
-
-/**
- * Reporter info string
- */
-
-exports.info = "Browser-based test reporter";
-
-
-exports.addStyles = function () {
- document.body.innerHTML += '<style type="text/css">' +
- 'body { font: 12px Helvetica Neue }' +
- 'h2 { margin:0 ; padding:0 }' +
- 'pre {' +
- 'font: 11px Andale Mono;' +
- 'margin-left: 1em;' +
- 'padding-left: 1em;' +
- 'margin-top: 0;' +
- 'font-size:smaller;' +
- '}' +
- '.assertion_message { margin-left: 1em; }' +
- ' ol {' +
- 'list-style: none;' +
- 'margin-left: 1em;' +
- 'padding-left: 1em;' +
- 'text-indent: -1em;' +
- '}' +
- ' ol li.pass:before { content: "\\2714 \\0020"; }' +
- ' ol li.fail:before { content: "\\2716 \\0020"; }' +
- '</style>';
-};
-
-
-/**
- * Run all tests within each module, reporting the results
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (modules, options) {
- var start = new Date().getTime();
- exports.addStyles();
-
- var html = '';
- nodeunit.runModules(modules, {
- moduleStart: function (name) {
- html += '<h2>' + name + '</h2>';
- html += '<ol>';
- },
- testDone: function (name, assertions) {
- if (!assertions.failures()) {
- html += '<li class="pass">' + name + '</li>';
- }
- else {
- html += '<li class="fail">' + name;
- for (var i=0; i<assertions.length; i++) {
- var a = assertions[i];
- if (a.failed()) {
- if (a.error instanceof assert.AssertionError && a.message) {
- html += '<div class="assertion_message">' +
- 'Assertion Message: ' + a.message +
- '</div>';
- }
- html += '<pre>';
- html += a.error.stack || a.error;
- html += '</pre>';
- }
- };
- html += '</li>';
- }
- },
- moduleDone: function () {
- html += '</ol>';
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
- if (assertions.failures()) {
- html += '<h3>FAILURES: ' + assertions.failures() +
- '/' + assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)</h3>';
- }
- else {
- html += '<h3>OK: ' + assertions.length +
- ' assertions (' + assertions.duration + 'ms)</h3>';
- }
- document.body.innerHTML += html;
- }
- });
-};
-})(reporter);
-nodeunit = core;
-nodeunit.assert = assert;
-nodeunit.reporter = reporter;
-nodeunit.run = reporter.run;
-return nodeunit; })();
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js
deleted file mode 100644
index 0d5fc90..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js
+++ /dev/null
@@ -1,12 +0,0 @@
-this.suite1 = {
- 'test one': function (test) {
- test.ok(true, 'everythings ok');
- setTimeout(function () {
- test.done();
- }, 10);
- },
- 'apples and oranges': function (test) {
- test.equal('apples', 'oranges', 'comparing apples and oranges');
- test.done();
- }
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js
deleted file mode 100644
index c7288e8..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js
+++ /dev/null
@@ -1,13 +0,0 @@
-this.suite2 = {
- 'another test': function (test) {
- setTimeout(function () {
- // lots of assertions
- test.ok(true, 'everythings ok');
- test.ok(true, 'everythings ok');
- test.ok(true, 'everythings ok');
- test.ok(true, 'everythings ok');
- test.ok(true, 'everythings ok');
- test.done();
- }, 10);
- }
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html
deleted file mode 100644
index e9f8180..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
- <head>
- <title>Example tests</title>
- <script src="nodeunit.js"></script>
- <script src="suite1.js"></script>
- <script src="suite2.js"></script>
- </head>
- <body>
- <script>
- nodeunit.run({
- 'suite1': suite1,
- 'suite2': suite2
- });
- </script>
- </body>
-</html>
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png
deleted file mode 100644
index 78ff425..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png
deleted file mode 100644
index 069d716..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png
+++ /dev/null
Binary files differ
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/index.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/index.js
deleted file mode 100644
index 07867d0..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// This file is just added for convenience so this repository can be
-// directly checked out into a project's deps folder
-module.exports = require('./lib/nodeunit');
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js
deleted file mode 100644
index 8d9e0e3..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * This file is based on the node.js assert module, but with some small
- * changes for browser-compatibility
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- */
-
-
-/**
- * Added for browser compatibility
- */
-
-var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
-};
-
-
-
-// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
-//
-// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
-//
-// Originally from narwhal.js (http://narwhaljs.org)
-// Copyright (c) 2009 Thomas Robinson <280north.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 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.
-
-
-var pSlice = Array.prototype.slice;
-
-// 1. The assert module provides functions that throw
-// AssertionError's when particular conditions are not met. The
-// assert module must conform to the following interface.
-
-var assert = exports;
-
-// 2. The AssertionError is defined in assert.
-// new assert.AssertionError({message: message, actual: actual, expected: expected})
-
-assert.AssertionError = function AssertionError (options) {
- this.name = "AssertionError";
- this.message = options.message;
- this.actual = options.actual;
- this.expected = options.expected;
- this.operator = options.operator;
- var stackStartFunction = options.stackStartFunction || fail;
-
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, stackStartFunction);
- }
-};
-// code from util.inherits in node
-assert.AssertionError.super_ = Error;
-
-
-// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call
-// TODO: test what effect this may have
-var ctor = function () { this.constructor = assert.AssertionError; };
-ctor.prototype = Error.prototype;
-assert.AssertionError.prototype = new ctor();
-
-
-assert.AssertionError.prototype.toString = function() {
- if (this.message) {
- return [this.name+":", this.message].join(' ');
- } else {
- return [ this.name+":"
- , JSON.stringify(this.expected )
- , this.operator
- , JSON.stringify(this.actual)
- ].join(" ");
- }
-};
-
-// assert.AssertionError instanceof Error
-
-assert.AssertionError.__proto__ = Error.prototype;
-
-// At present only the three keys mentioned above are used and
-// understood by the spec. Implementations or sub modules can pass
-// other keys to the AssertionError's constructor - they will be
-// ignored.
-
-// 3. All of the following functions must throw an AssertionError
-// when a corresponding condition is not met, with a message that
-// may be undefined if not provided. All assertion methods provide
-// both the actual and expected values to the assertion error for
-// display purposes.
-
-function fail(actual, expected, message, operator, stackStartFunction) {
- throw new assert.AssertionError({
- message: message,
- actual: actual,
- expected: expected,
- operator: operator,
- stackStartFunction: stackStartFunction
- });
-}
-
-// EXTENSION! allows for well behaved errors defined elsewhere.
-assert.fail = fail;
-
-// 4. Pure assertion tests whether a value is truthy, as determined
-// by !!guard.
-// assert.ok(guard, message_opt);
-// This statement is equivalent to assert.equal(true, guard,
-// message_opt);. To test strictly for the value true, use
-// assert.strictEqual(true, guard, message_opt);.
-
-assert.ok = function ok(value, message) {
- if (!!!value) fail(value, true, message, "==", assert.ok);
-};
-
-// 5. The equality assertion tests shallow, coercive equality with
-// ==.
-// assert.equal(actual, expected, message_opt);
-
-assert.equal = function equal(actual, expected, message) {
- if (actual != expected) fail(actual, expected, message, "==", assert.equal);
-};
-
-// 6. The non-equality assertion tests for whether two objects are not equal
-// with != assert.notEqual(actual, expected, message_opt);
-
-assert.notEqual = function notEqual(actual, expected, message) {
- if (actual == expected) {
- fail(actual, expected, message, "!=", assert.notEqual);
- }
-};
-
-// 7. The equivalence assertion tests a deep equality relation.
-// assert.deepEqual(actual, expected, message_opt);
-
-assert.deepEqual = function deepEqual(actual, expected, message) {
- if (!_deepEqual(actual, expected)) {
- fail(actual, expected, message, "deepEqual", assert.deepEqual);
- }
-};
-
-function _deepEqual(actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
-}
-
-function isUndefinedOrNull (value) {
- return value === null || value === undefined;
-}
-
-function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
-}
-
-function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return _deepEqual(a, b);
- }
- try{
- var ka = _keys(a),
- kb = _keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!_deepEqual(a[key], b[key] ))
- return false;
- }
- return true;
-}
-
-// 8. The non-equivalence assertion tests for any deep inequality.
-// assert.notDeepEqual(actual, expected, message_opt);
-
-assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
- if (_deepEqual(actual, expected)) {
- fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual);
- }
-};
-
-// 9. The strict equality assertion tests strict equality, as determined by ===.
-// assert.strictEqual(actual, expected, message_opt);
-
-assert.strictEqual = function strictEqual(actual, expected, message) {
- if (actual !== expected) {
- fail(actual, expected, message, "===", assert.strictEqual);
- }
-};
-
-// 10. The strict non-equality assertion tests for strict inequality, as determined by !==.
-// assert.notStrictEqual(actual, expected, message_opt);
-
-assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
- if (actual === expected) {
- fail(actual, expected, message, "!==", assert.notStrictEqual);
- }
-};
-
-function _throws (shouldThrow, block, err, message) {
- var exception = null,
- threw = false,
- typematters = true;
-
- message = message || "";
-
- //handle optional arguments
- if (arguments.length == 3) {
- if (typeof(err) == "string") {
- message = err;
- typematters = false;
- }
- } else if (arguments.length == 2) {
- typematters = false;
- }
-
- try {
- block();
- } catch (e) {
- threw = true;
- exception = e;
- }
-
- if (shouldThrow && !threw) {
- fail( "Missing expected exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if (!shouldThrow && threw && typematters && exception instanceof err) {
- fail( "Got unwanted exception"
- + (err && err.name ? " ("+err.name+")." : '.')
- + (message ? " " + message : "")
- );
- }
- if ((shouldThrow && threw && typematters && !(exception instanceof err)) ||
- (!shouldThrow && threw)) {
- throw exception;
- }
-};
-
-// 11. Expected to throw an error:
-// assert.throws(block, Error_opt, message_opt);
-
-assert.throws = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [true].concat(pSlice.call(arguments)));
-};
-
-// EXTENSION! This is annoying to write outside this module.
-assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
- _throws.apply(this, [false].concat(pSlice.call(arguments)));
-};
-
-assert.ifError = function (err) { if (err) {throw err;}};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js
deleted file mode 100644
index 981d7c6..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js
+++ /dev/null
@@ -1,236 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-/**
- * Module dependencies
- */
-
-var async = require('../deps/async'), //@REMOVE_LINE_FOR_BROWSER
- types = require('./types'); //@REMOVE_LINE_FOR_BROWSER
-
-
-/**
- * Added for browser compatibility
- */
-
-var _keys = function(obj){
- if(Object.keys) return Object.keys(obj);
- var keys = [];
- for(var k in obj){
- if(obj.hasOwnProperty(k)) keys.push(k);
- }
- return keys;
-};
-
-
-/**
- * Runs a test function (fn) from a loaded module. After the test function
- * calls test.done(), the callback is executed with an assertionList as its
- * second argument.
- *
- * @param {String} name
- * @param {Function} fn
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runTest = function (name, fn, opt, callback) {
- var options = types.options(opt);
-
- options.testStart(name);
- var start = new Date().getTime();
- var test = types.test(name, start, options, callback);
-
- try {
- fn(test);
- }
- catch (e) {
- test.done(e);
- }
-};
-
-/**
- * Takes an object containing test functions or other test suites as properties
- * and runs each in series. After all tests have completed, the callback is
- * called with a list of all assertions as the second argument.
- *
- * If a name is passed to this function it is prepended to all test and suite
- * names that run within it.
- *
- * @param {String} name
- * @param {Object} suite
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runSuite = function (name, suite, opt, callback) {
- var keys = _keys(suite);
-
- async.concatSeries(keys, function (k, cb) {
- var prop = suite[k], _name;
-
- _name = name ? [].concat(name, k) : [k];
-
- _name.toString = function () {
- // fallback for old one
- return this.join(' - ');
- };
-
- if (typeof prop === 'function') {
- exports.runTest(_name, suite[k], opt, cb);
- }
- else {
- exports.runSuite(_name, suite[k], opt, cb);
- }
- }, callback);
-};
-
-/**
- * Run each exported test function or test suite from a loaded module.
- *
- * @param {String} name
- * @param {Object} mod
- * @param {Object} opt
- * @param {Function} callback
- * @api public
- */
-
-exports.runModule = function (name, mod, opt, callback) {
- var options = types.options(opt);
-
- options.moduleStart(name);
- var start = new Date().getTime();
-
- exports.runSuite(null, mod, opt, function (err, a_list) {
- var end = new Date().getTime();
- var assertion_list = types.assertionList(a_list, end - start);
- options.moduleDone(name, assertion_list);
- callback(null, a_list);
- });
-};
-
-/**
- * Treats an object literal as a list of modules keyed by name. Runs each
- * module and finished with calling 'done'. You can think of this as a browser
- * safe alternative to runFiles in the nodeunit module.
- *
- * @param {Object} modules
- * @param {Object} opt
- * @api public
- */
-
-// TODO: add proper unit tests for this function
-exports.runModules = function (modules, opt) {
- var all_assertions = [];
- var options = types.options(opt);
- var start = new Date().getTime();
-
- async.concatSeries(_keys(modules), function (k, cb) {
- exports.runModule(k, modules[k], options, cb);
- },
- function (err, all_assertions) {
- var end = new Date().getTime();
- options.done(types.assertionList(all_assertions, end - start));
- });
-};
-
-
-/**
- * Wraps a test function with setUp and tearDown functions.
- * Used by testCase.
- *
- * @param {Function} setUp
- * @param {Function} tearDown
- * @param {Function} fn
- * @api private
- */
-
-var wrapTest = function (setUp, tearDown, fn) {
- return function (test) {
- var context = {};
- if (tearDown) {
- var done = test.done;
- test.done = function (err) {
- try {
- tearDown.call(context, function (err2) {
- if (err && err2) {
- test._assertion_list.push(
- types.assertion({error: err})
- );
- return done(err2);
- }
- done(err || err2);
- });
- }
- catch (e) {
- done(e);
- }
- };
- }
- if (setUp) {
- setUp.call(context, function (err) {
- if (err) {
- return test.done(err);
- }
- fn.call(context, test);
- });
- }
- else {
- fn.call(context, test);
- }
- }
-};
-
-
-/**
- * Wraps a group of tests with setUp and tearDown functions.
- * Used by testCase.
- *
- * @param {Function} setUp
- * @param {Function} tearDown
- * @param {Object} group
- * @api private
- */
-
-var wrapGroup = function (setUp, tearDown, group) {
- var tests = {};
- var keys = _keys(group);
- for (var i=0; i<keys.length; i++) {
- var k = keys[i];
- if (typeof group[k] === 'function') {
- tests[k] = wrapTest(setUp, tearDown, group[k]);
- }
- else if (typeof group[k] === 'object') {
- tests[k] = wrapGroup(setUp, tearDown, group[k]);
- }
- }
- return tests;
-}
-
-
-/**
- * Utility for wrapping a suite of test functions with setUp and tearDown
- * functions.
- *
- * @param {Object} suite
- * @return {Object}
- * @api public
- */
-
-exports.testCase = function (suite) {
- var setUp = suite.setUp;
- var tearDown = suite.tearDown;
- delete suite.setUp;
- delete suite.tearDown;
- return wrapGroup(setUp, tearDown, suite);
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/nodeunit.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/nodeunit.js
deleted file mode 100644
index 7b8fd70..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/nodeunit.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var async = require('../deps/async'),
- types = require('./types'),
- utils = require('./utils'),
- core = require('./core'),
- reporters = require('./reporters'),
- path = require('path');
-
-
-/**
- * Export sub-modules.
- */
-
-exports.types = types;
-exports.utils = utils;
-exports.reporters = reporters;
-
-// backwards compatibility
-exports.testrunner = {
- run: function () {
- console.log(
- 'WARNING: nodeunit.testrunner is going to be deprecated, please ' +
- 'use nodeunit.reporters.default instead!'
- );
- return reporters['default'].run.apply(this, arguments);
- }
-};
-
-
-/**
- * Export all core functions
- */
-
-for (var k in core) {
- exports[k] = core[k];
-};
-
-
-/**
- * Load modules from paths array and run all exported tests in series. If a path
- * is a directory, load all supported file types inside it as modules. This only
- * reads 1 level deep in the directory and does not recurse through
- * sub-directories.
- *
- * @param {Array} paths
- * @param {Object} opt
- * @api public
- */
-
-exports.runFiles = function (paths, opt) {
- var all_assertions = [];
- var options = types.options(opt);
- var start = new Date().getTime();
-
- if (!paths.length) {
- return options.done(types.assertionList(all_assertions));
- }
-
- utils.modulePaths(paths, function (err, files) {
- if (err) throw err;
- async.concatSeries(files, function (file, cb) {
- var name = path.basename(file);
- exports.runModule(name, require(file), options, cb);
- },
- function (err, all_assertions) {
- var end = new Date().getTime();
- options.done(types.assertionList(all_assertions, end - start));
- });
- });
-
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/browser.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/browser.js
deleted file mode 100644
index a169406..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/browser.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-
-/**
- * NOTE: this test runner is not listed in index.js because it cannot be
- * used with the command-line tool, only inside the browser.
- */
-
-
-/**
- * Reporter info string
- */
-
-exports.info = "Browser-based test reporter";
-
-
-/**
- * Run all tests within each module, reporting the results
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (modules, options) {
- var start = new Date().getTime();
-
- function setText(el, txt) {
- if ('innerText' in el) {
- el.innerText = txt;
- }
- else if ('textContent' in el){
- el.textContent = txt;
- }
- }
-
- function getOrCreate(tag, id) {
- var el = document.getElementById(id);
- if (!el) {
- el = document.createElement(tag);
- el.id = id;
- document.body.appendChild(el);
- }
- return el;
- };
-
- var header = getOrCreate('h1', 'nodeunit-header');
- var banner = getOrCreate('h2', 'nodeunit-banner');
- var userAgent = getOrCreate('h2', 'nodeunit-userAgent');
- var tests = getOrCreate('ol', 'nodeunit-tests');
- var result = getOrCreate('p', 'nodeunit-testresult');
-
- setText(userAgent, navigator.userAgent);
-
- nodeunit.runModules(modules, {
- moduleStart: function (name) {
- /*var mheading = document.createElement('h2');
- mheading.innerText = name;
- results.appendChild(mheading);
- module = document.createElement('ol');
- results.appendChild(module);*/
- },
- testDone: function (name, assertions) {
- var test = document.createElement('li');
- var strong = document.createElement('strong');
- strong.innerHTML = name + ' <b style="color: black;">(' +
- '<b class="fail">' + assertions.failures() + '</b>, ' +
- '<b class="pass">' + assertions.passes() + '</b>, ' +
- assertions.length +
- ')</b>';
- test.className = assertions.failures() ? 'fail': 'pass';
- test.appendChild(strong);
-
- var aList = document.createElement('ol');
- aList.style.display = 'none';
- test.onclick = function () {
- var d = aList.style.display;
- aList.style.display = (d == 'none') ? 'block': 'none';
- };
- for (var i=0; i<assertions.length; i++) {
- var li = document.createElement('li');
- var a = assertions[i];
- if (a.failed()) {
- li.innerHTML = (a.message || a.method || 'no message') +
- '<pre>' + (a.error.stack || a.error) + '</pre>';
- li.className = 'fail';
- }
- else {
- li.innerHTML = a.message || a.method || 'no message';
- li.className = 'pass';
- }
- aList.appendChild(li);
- }
- test.appendChild(aList);
- tests.appendChild(test);
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
-
- var failures = assertions.failures();
- banner.className = failures ? 'fail': 'pass';
-
- result.innerHTML = 'Tests completed in ' + duration +
- ' milliseconds.<br/><span class="passed">' +
- assertions.passes() + '</span> assertions of ' +
- '<span class="all">' + assertions.length + '<span> passed, ' +
- assertions.failures() + ' failed.';
- }
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js
deleted file mode 100644
index c3d725d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var nodeunit = require('../nodeunit'),
- utils = require('../utils'),
- fs = require('fs'),
- sys = require('sys'),
- path = require('path');
- AssertionError = require('../assert').AssertionError;
-
-/**
- * Reporter info string
- */
-
-exports.info = "Default tests reporter";
-
-
-/**
- * Run all tests within each module, reporting the results to the command-line.
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (files, options) {
-
- if (!options) {
- // load default options
- var content = fs.readFileSync(
- __dirname + '/../../bin/nodeunit.json', 'utf8'
- );
- options = JSON.parse(content);
- }
-
- var error = function (str) {
- return options.error_prefix + str + options.error_suffix;
- };
- var ok = function (str) {
- return options.ok_prefix + str + options.ok_suffix;
- };
- var bold = function (str) {
- return options.bold_prefix + str + options.bold_suffix;
- };
- var assertion_message = function (str) {
- return options.assertion_prefix + str + options.assertion_suffix;
- };
-
- var start = new Date().getTime();
- var paths = files.map(function (p) {
- return path.join(process.cwd(), p);
- });
-
- nodeunit.runFiles(paths, {
- moduleStart: function (name) {
- sys.puts('\n' + bold(name));
- },
- testDone: function (name, assertions) {
- if (!assertions.failures()) {
- sys.puts('✔ ' + name);
- }
- else {
- sys.puts(error('✖ ' + name) + '\n');
- assertions.forEach(function (a) {
- if (a.failed()) {
- a = utils.betterErrors(a);
- if (a.error instanceof AssertionError && a.message) {
- sys.puts(
- 'Assertion Message: ' +
- assertion_message(a.message)
- );
- }
- sys.puts(a.error.stack + '\n');
- }
- });
- }
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
- if (assertions.failures()) {
- sys.puts(
- '\n' + bold(error('FAILURES: ')) + assertions.failures() +
- '/' + assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)'
- );
- }
- else {
- sys.puts(
- '\n' + bold(ok('OK: ')) + assertions.length +
- ' assertions (' + assertions.duration + 'ms)'
- );
- }
- // alexgorbatchev 2010-11-10 :: should be able to flush stdout
- // here, but doesn't seem to work, instead delay the exit to give
- // enough to time flush.
- // process.stdout.flush()
- // process.stdout.end()
- setTimeout(function () {
- process.reallyExit(assertions.failures());
- }, 10);
- }
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js
deleted file mode 100644
index a693c2d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var nodeunit = require('../nodeunit'),
- utils = require('../utils'),
- fs = require('fs'),
- sys = require('sys'),
- path = require('path'),
- AssertionError = require('assert').AssertionError;
-
-/**
- * Reporter info string
- */
-
-exports.info = "Report tests result as HTML";
-
-/**
- * Run all tests within each module, reporting the results to the command-line.
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (files, options) {
-
- var start = new Date().getTime();
- var paths = files.map(function (p) {
- return path.join(process.cwd(), p);
- });
-
- sys.puts('<html>');
- sys.puts('<head>');
- sys.puts('<title></title>');
- sys.puts('<style type="text/css">');
- sys.puts('body { font: 12px Helvetica Neue }');
- sys.puts('h2 { margin:0 ; padding:0 }');
- sys.puts('pre { font: 11px Andale Mono; margin-left: 1em; padding-left: 1em; margin-top:0; font-size:smaller;}');
- sys.puts('.assertion_message { margin-left: 1em; }');
- sys.puts(' ol {' +
- ' list-style: none;' +
- ' margin-left: 1em;' +
- ' padding-left: 1em;' +
- ' text-indent: -1em;' +
- '}');
- sys.puts(' ol li.pass:before { content: "\\2714 \\0020"; }');
- sys.puts(' ol li.fail:before { content: "\\2716 \\0020"; }');
- sys.puts('</style>');
- sys.puts('</head>');
- sys.puts('<body>');
- nodeunit.runFiles(paths, {
- moduleStart: function (name) {
- sys.puts('<h2>' + name + '</h2>');
- sys.puts('<ol>');
- },
- testDone: function (name, assertions) {
- if (!assertions.failures()) {
- sys.puts('<li class="pass">' + name + '</li>');
- }
- else {
- sys.puts('<li class="fail">' + name);
- assertions.forEach(function (a) {
- if (a.failed()) {
- a = utils.betterErrors(a);
- if (a.error instanceof AssertionError && a.message) {
- sys.puts('<div class="assertion_message">' +
- 'Assertion Message: ' + a.message +
- '</div>');
- }
- sys.puts('<pre>');
- sys.puts(a.error.stack);
- sys.puts('</pre>');
- }
- });
- sys.puts('</li>');
- }
- },
- moduleDone: function () {
- sys.puts('</ol>');
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
- if (assertions.failures()) {
- sys.puts(
- '<h3>FAILURES: ' + assertions.failures() +
- '/' + assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)</h3>'
- );
- }
- else {
- sys.puts(
- '<h3>OK: ' + assertions.length +
- ' assertions (' + assertions.duration + 'ms)</h3>'
- );
- }
- sys.puts('</body>');
- // should be able to flush stdout here, but doesn't seem to work,
- // instead delay the exit to give enough to time flush.
- setTimeout(function () {
- process.reallyExit(assertions.failures());
- }, 10);
- }
- });
-
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js
deleted file mode 100644
index bbaf800..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-module.exports = {
- 'junit': require('./junit'),
- 'default': require('./default'),
- 'skip_passed': require('./skip_passed'),
- 'minimal': require('./minimal'),
- 'html': require('./html')
- // browser test reporter is not listed because it cannot be used
- // with the command line tool, only inside a browser.
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js
deleted file mode 100644
index bc1e1ec..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var nodeunit = require('../nodeunit'),
- utils = require('../utils'),
- fs = require('fs'),
- sys = require('sys'),
- path = require('path'),
- async = require('../../deps/async'),
- AssertionError = require('assert').AssertionError,
- child_process = require('child_process'),
- ejs = require('../../deps/ejs');
-
-
-/**
- * Reporter info string
- */
-
-exports.info = "jUnit XML test reports";
-
-
-/**
- * Ensures a directory exists using mkdir -p.
- *
- * @param {String} path
- * @param {Function} callback
- * @api private
- */
-
-var ensureDir = function (path, callback) {
- var mkdir = child_process.spawn('mkdir', ['-p', path]);
- mkdir.on('error', function (err) {
- callback(err);
- callback = function(){};
- });
- mkdir.on('exit', function (code) {
- if (code === 0) callback();
- else callback(new Error('mkdir exited with code: ' + code));
- });
-};
-
-
-/**
- * Returns absolute version of a path. Relative paths are interpreted
- * relative to process.cwd() or the cwd parameter. Paths that are already
- * absolute are returned unaltered.
- *
- * @param {String} p
- * @param {String} cwd
- * @return {String}
- * @api public
- */
-
-var abspath = function (p, /*optional*/cwd) {
- if (p[0] === '/') return p;
- cwd = cwd || process.cwd();
- return path.normalize(path.join(cwd, p));
-};
-
-
-/**
- * Run all tests within each module, reporting the results to the command-line,
- * then writes out junit-compatible xml documents.
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (files, opts, callback) {
- if (!opts.output) {
- console.error(
- 'Error: No output directory defined.\n' +
- '\tEither add an "output" property to your nodeunit.json config ' +
- 'file, or\n\tuse the --output command line option.'
- );
- return;
- }
- opts.output = abspath(opts.output);
- var error = function (str) {
- return opts.error_prefix + str + opts.error_suffix;
- };
- var ok = function (str) {
- return opts.ok_prefix + str + opts.ok_suffix;
- };
- var bold = function (str) {
- return opts.bold_prefix + str + opts.bold_suffix;
- };
-
- var start = new Date().getTime();
- var paths = files.map(function (p) {
- return path.join(process.cwd(), p);
- });
-
- var modules = {}
- var curModule;
-
- nodeunit.runFiles(paths, {
- moduleStart: function (name) {
- curModule = {
- errorCount: 0,
- failureCount: 0,
- tests: 0,
- testcases: [],
- name: name
- };
- modules[name] = curModule;
- },
- testDone: function (name, assertions) {
- var testcase = {name: name};
- for (var i=0; i<assertions.length; assertions++) {
- var a = assertions[i];
- if (a.failed()) {
- a = utils.betterErrors(a);
- testcase.failure = {
- message: a.message,
- backtrace: a.error.stack
- };
-
- if (a.error instanceof AssertionError) {
- curModule.failureCount++;
- }
- else {
- curModule.errorCount++;
- }
- break;
- }
- }
- curModule.tests++;
- curModule.testcases.push(testcase);
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
-
- ensureDir(opts.output, function (err) {
- var tmpl = __dirname + "/../../share/junit.xml.ejs";
- fs.readFile(tmpl, function (err, data) {
- if (err) throw err;
- var tmpl = data.toString();
-
- async.forEach(Object.keys(modules), function (k, cb) {
- var module = modules[k];
- var rendered = ejs.render(tmpl, {
- locals: {suites: [module]}
- });
- var filename = path.join(
- opts.output,
- module.name + '.xml'
- );
- sys.puts('Writing ' + filename);
- fs.writeFile(filename, rendered, cb);
- },
- function (err) {
- if (err) throw err;
- else if (assertions.failures()) {
- sys.puts(
- '\n' + bold(error('FAILURES: ')) +
- assertions.failures() + '/' +
- assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)'
- );
- }
- else {
- sys.puts(
- '\n' + bold(ok('OK: ')) + assertions.length +
- ' assertions (' + assertions.duration + 'ms)'
- );
- }
- });
-
- });
- });
-
- }
- });
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/minimal.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/minimal.js
deleted file mode 100644
index 951e39d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/minimal.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var nodeunit = require('../nodeunit'),
- utils = require('../utils'),
- fs = require('fs'),
- sys = require('sys'),
- path = require('path'),
- AssertionError = require('assert').AssertionError;
-
-/**
- * Reporter info string
- */
-
-exports.info = "Pretty minimal output";
-
-/**
- * Run all tests within each module, reporting the results to the command-line.
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (files, options) {
-
- if (!options) {
- // load default options
- var content = fs.readFileSync(
- __dirname + '/../../bin/nodeunit.json', 'utf8'
- );
- options = JSON.parse(content);
- }
-
- var red = function (str) {
- return options.error_prefix + str + options.error_suffix;
- };
- var green = function (str) {
- return options.ok_prefix + str + options.ok_suffix;
- };
- var magenta = function (str) {
- return options.assertion_prefix + str + options.assertion_suffix;
- };
- var bold = function (str) {
- return options.bold_prefix + str + options.bold_suffix;
- };
-
- var start = new Date().getTime();
- var paths = files.map(function (p) {
- return path.join(process.cwd(), p);
- });
-
- nodeunit.runFiles(paths, {
- moduleStart: function (name) {
- sys.print(bold(name) + ': ');
- },
- moduleDone: function (name, assertions) {
- sys.puts('');
- if (assertions.failures()) {
- assertions.forEach(function (a) {
- if (a.failed()) {
- a = utils.betterErrors(a);
- if (a.error instanceof AssertionError && a.message) {
- sys.puts(
- 'Assertion in test ' + bold(a.testname) + ': ' +
- magenta(a.message)
- );
- }
- sys.puts(a.error.stack + '\n');
- }
- });
- }
-
- },
- testStart: function () {
- },
- testDone: function (name, assertions) {
- if (!assertions.failures()) {
- sys.print('.');
- }
- else {
- sys.print(red('F'));
- assertions.forEach(function (assertion) {
- assertion.testname = name;
- });
- }
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
- if (assertions.failures()) {
- sys.puts(
- '\n' + bold(red('FAILURES: ')) + assertions.failures() +
- '/' + assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)'
- );
- }
- else {
- sys.puts(
- '\n' + bold(green('OK: ')) + assertions.length +
- ' assertions (' + assertions.duration + 'ms)'
- );
- }
- // should be able to flush stdout here, but doesn't seem to work,
- // instead delay the exit to give enough to time flush.
- setTimeout(function () {
- process.reallyExit(assertions.failures());
- }, 10);
- }
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/skip_passed.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/skip_passed.js
deleted file mode 100644
index e2abf38..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/skip_passed.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var nodeunit = require('../nodeunit'),
- utils = require('../utils'),
- fs = require('fs'),
- sys = require('sys'),
- path = require('path'),
- AssertionError = require('assert').AssertionError;
-
-/**
- * Reporter info string
- */
-
-exports.info = "Skip passed tests output";
-
-/**
- * Run all tests within each module, reporting the results to the command-line.
- *
- * @param {Array} files
- * @api public
- */
-
-exports.run = function (files, options) {
-
- if (!options) {
- // load default options
- var content = fs.readFileSync(
- __dirname + '/../../bin/nodeunit.json', 'utf8'
- );
- options = JSON.parse(content);
- }
-
- var error = function (str) {
- return options.error_prefix + str + options.error_suffix;
- };
- var ok = function (str) {
- return options.ok_prefix + str + options.ok_suffix;
- };
- var bold = function (str) {
- return options.bold_prefix + str + options.bold_suffix;
- };
- var assertion_message = function (str) {
- return options.assertion_prefix + str + options.assertion_suffix;
- };
-
- var start = new Date().getTime();
- var paths = files.map(function (p) {
- return path.join(process.cwd(), p);
- });
-
- nodeunit.runFiles(paths, {
- moduleStart: function (name) {
- sys.puts('\n' + bold(name));
- },
- testDone: function (name, assertions) {
- if (assertions.failures()) {
- sys.puts(error('✖ ' + name) + '\n');
- assertions.forEach(function (a) {
- if (a.failed()) {
- a = utils.betterErrors(a);
- if (a.error instanceof AssertionError && a.message) {
- sys.puts(
- 'Assertion Message: ' + assertion_message(a.message)
- );
- }
- sys.puts(a.error.stack + '\n');
- }
- });
- }
- },
- moduleDone: function (name, assertions) {
- if (!assertions.failures()) {
- sys.puts('✔ all tests passed');
- }
- else {
- sys.puts(error('✖ some tests failed'));
- }
- },
- done: function (assertions) {
- var end = new Date().getTime();
- var duration = end - start;
- if (assertions.failures()) {
- sys.puts(
- '\n' + bold(error('FAILURES: ')) + assertions.failures() +
- '/' + assertions.length + ' assertions failed (' +
- assertions.duration + 'ms)'
- );
- }
- else {
- sys.puts(
- '\n' + bold(ok('OK: ')) + assertions.length +
- ' assertions (' + assertions.duration + 'ms)'
- );
- }
- // should be able to flush stdout here, but doesn't seem to work,
- // instead delay the exit to give enough to time flush.
- setTimeout(function () {
- process.reallyExit(assertions.failures());
- }, 10);
- }
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/types.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/types.js
deleted file mode 100644
index 1f9b12d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/types.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-/**
- * Module dependencies
- */
-
-var assert = require('./assert'), //@REMOVE_LINE_FOR_BROWSER
- async = require('../deps/async'); //@REMOVE_LINE_FOR_BROWSER
-
-
-/**
- * Creates assertion objects representing the result of an assert call.
- * Accepts an object or AssertionError as its argument.
- *
- * @param {object} obj
- * @api public
- */
-
-exports.assertion = function (obj) {
- return {
- method: obj.method || '',
- message: obj.message || (obj.error && obj.error.message) || '',
- error: obj.error,
- passed: function () {
- return !this.error;
- },
- failed: function () {
- return Boolean(this.error);
- }
- };
-};
-
-/**
- * Creates an assertion list object representing a group of assertions.
- * Accepts an array of assertion objects.
- *
- * @param {Array} arr
- * @param {Number} duration
- * @api public
- */
-
-exports.assertionList = function (arr, duration) {
- var that = arr || [];
- that.failures = function () {
- var failures = 0;
- for (var i=0; i<this.length; i++) {
- if (this[i].failed()) failures++;
- }
- return failures;
- };
- that.passes = function () {
- return that.length - that.failures();
- };
- that.duration = duration || 0;
- return that;
-};
-
-/**
- * Create a wrapper function for assert module methods. Executes a callback
- * after the it's complete with an assertion object representing the result.
- *
- * @param {Function} callback
- * @api private
- */
-
-var assertWrapper = function (callback) {
- return function (new_method, assert_method, arity) {
- return function () {
- var message = arguments[arity-1];
- var a = exports.assertion({method: new_method, message: message});
- try {
- assert[assert_method].apply(null, arguments);
- }
- catch (e) {
- a.error = e;
- }
- callback(a);
- };
- };
-};
-
-/**
- * Creates the 'test' object that gets passed to every test function.
- * Accepts the name of the test function as its first argument, followed by
- * the start time in ms, the options object and a callback function.
- *
- * @param {String} name
- * @param {Number} start
- * @param {Object} options
- * @param {Function} callback
- * @api public
- */
-
-exports.test = function (name, start, options, callback) {
- var expecting;
- var a_list = [];
-
- var wrapAssert = assertWrapper(function (a) {
- a_list.push(a);
- if (options.log) {
- async.nextTick(function () {
- options.log(a);
- });
- }
- });
-
- var test = {
- done: function (err) {
- if (expecting !== undefined && expecting !== a_list.length) {
- var e = new Error(
- 'Expected ' + expecting + ' assertions, ' +
- a_list.length + ' ran'
- );
- var a1 = exports.assertion({method: 'expect', error: e});
- a_list.push(a1);
- if (options.log) {
- async.nextTick(function () {
- options.log(a1);
- });
- }
- }
- if (err) {
- var a2 = exports.assertion({error: err});
- a_list.push(a2);
- if (options.log) {
- async.nextTick(function () {
- options.log(a2);
- });
- }
- }
- var end = new Date().getTime();
- async.nextTick(function () {
- var assertion_list = exports.assertionList(a_list, end - start);
- options.testDone(name, assertion_list);
- callback(null, a_list);
- });
- },
- ok: wrapAssert('ok', 'ok', 2),
- same: wrapAssert('same', 'deepEqual', 3),
- equals: wrapAssert('equals', 'equal', 3),
- expect: function (num) {
- expecting = num;
- },
- _assertion_list: a_list
- };
- // add all functions from the assert module
- for (var k in assert) {
- if (assert.hasOwnProperty(k)) {
- test[k] = wrapAssert(k, k, assert[k].length);
- }
- }
- return test;
-};
-
-/**
- * Ensures an options object has all callbacks, adding empty callback functions
- * if any are missing.
- *
- * @param {Object} opt
- * @return {Object}
- * @api public
- */
-
-exports.options = function (opt) {
- var optionalCallback = function (name) {
- opt[name] = opt[name] || function () {};
- };
-
- optionalCallback('moduleStart');
- optionalCallback('moduleDone');
- optionalCallback('testStart');
- optionalCallback('testDone');
- //optionalCallback('log');
-
- // 'done' callback is not optional.
-
- return opt;
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/utils.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/utils.js
deleted file mode 100644
index dd4605e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/lib/utils.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/*!
- * Nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- */
-
-/**
- * Module dependencies
- */
-
-var async = require('../deps/async'),
- fs = require('fs'),
- sys = require('sys'),
- Script = process.binding('evals').Script,
- http = require('http');
-
-
-/**
- * Detect if coffee-script is available and search for .coffee as an
- * extension in modulePaths if it is.
- */
-
-var extensionPattern;
-try {
- require('coffee-script');
- extensionPattern = /\.(?:js|coffee)$/;
-}
-catch (e) {
- extensionPattern = /\.js$/;
-}
-
-
-/**
- * Finds all modules at each path in an array, If a path is a directory, it
- * returns all supported file types inside it. This only reads 1 level deep in
- * the directory and does not recurse through sub-directories.
- *
- * The extension (.js, .coffee etc) is stripped from the filenames so they can
- * simply be require()'ed.
- *
- * @param {Array} paths
- * @param {Function} callback
- * @api public
- */
-
-exports.modulePaths = function (paths, callback) {
- async.concat(paths, function (p, cb) {
- fs.stat(p, function (err, stats) {
- if (err) {
- return cb(err);
- }
- if (stats.isFile()) {
- return cb(null, [p]);
- }
- if (stats.isDirectory()) {
- fs.readdir(p, function (err, files) {
- if (err) {
- return cb(err);
- }
-
- // filter out any filenames with unsupported extensions
- var modules = files.filter(function (filename) {
- return extensionPattern.exec(filename);
- });
-
- // remove extension from module name and prepend the
- // directory path
- var fullpaths = modules.map(function (filename) {
- var mod_name = filename.replace(extensionPattern, '');
- return [p, mod_name].join('/');
- });
-
- // sort filenames here, because Array.map changes order
- fullpaths.sort();
-
- cb(null, fullpaths);
- });
- }
- });
- }, callback);
-};
-
-/**
- * Evaluates JavaScript files in a sandbox, returning the context. The first
- * argument can either be a single filename or an array of filenames. If
- * multiple filenames are given their contents are concatenated before
- * evalution. The second argument is an optional context to use for the sandbox.
- *
- * @param files
- * @param {Object} sandbox
- * @return {Object}
- * @api public
- */
-
-exports.sandbox = function (files, /*optional*/sandbox) {
- var source, script, result;
- if (!(files instanceof Array)) {
- files = [files];
- }
- source = files.map(function (file) {
- return fs.readFileSync(file, 'utf8');
- }).join('');
-
- if (!sandbox) {
- sandbox = {};
- }
- script = new Script(source);
- result = script.runInNewContext(sandbox);
- return sandbox;
-};
-
-/**
- * Provides a http request, response testing environment.
- *
- * Example:
- *
- * var httputil = require('nodeunit').utils.httputil
- * exports.testSomething = function(test) {
- * httputil(function (req, resp) {
- * resp.writeHead(200, {});
- * resp.end('test data');
- * },
- * function(server, client) {
- * client.fetch('GET', '/', {}, function(resp) {
- * test.equal('test data', resp.body);
- * server.close();
- * test.done();
- * })
- * });
- * };
- *
- * @param {Function} cgi
- * @param {Function} envReady
- * @api public
- */
-exports.httputil = function (cgi, envReady) {
- var hostname = process.env.HOSTNAME || 'localhost';
- var port = process.env.PORT || 3000;
-
- var server = http.createServer(cgi);
- server.listen(port, hostname);
-
- var client = http.createClient(port, hostname);
- client.fetch = function (method, path, headers, respReady) {
- var request = this.request(method, path, headers);
- request.end();
- request.on('response', function (response) {
- response.setEncoding('utf8');
- response.on('data', function (chunk) {
- if (response.body) {
- response.body += chunk;
- } else {
- response.body = chunk;
- }
- });
- response.on('end', function () {
- if (response.headers['content-type'] === 'application/json') {
- response.bodyAsObject = JSON.parse(response.body);
- }
- respReady(response);
- });
- });
- };
-
- process.nextTick(function () {
- if (envReady && typeof envReady === 'function') {
- envReady(server, client);
- }
- });
-};
-
-
-/**
- * Improves formatting of AssertionError messages to make deepEqual etc more
- * readable.
- *
- * @param {Object} assertion
- * @return {Object}
- * @api public
- */
-
-exports.betterErrors = function (assertion) {
- if (!assertion.error) return;
-
- var e = assertion.error;
- // deepEqual error message is a bit sucky, lets improve it!
- // e.actual and e.expected could be null or undefined, so
- // using getOwnPropertyDescriptor to see if they exist:
- if (Object.getOwnPropertyDescriptor(e, 'actual') &&
- Object.getOwnPropertyDescriptor(e, 'expected')) {
-
- // alexgorbatchev 2010-10-22 :: Added a bit of depth to inspection
- var actual = sys.inspect(e.actual, false, 10).replace(/\n$/, '');
- var expected = sys.inspect(e.expected, false, 10).replace(/\n$/, '');
- var multiline = (
- actual.indexOf('\n') !== -1 ||
- expected.indexOf('\n') !== -1
- );
- var spacing = (multiline ? '\n' : ' ');
- e._message = e.message;
- e.stack = (
- e.name + ':' + spacing +
- actual + spacing + e.operator + spacing +
- expected + '\n' +
- e.stack.split('\n').slice(1).join('\n')
- );
- }
- return assertion;
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/man1/nodeunit.1 b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/man1/nodeunit.1
deleted file mode 100644
index 450772d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/man1/nodeunit.1
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" Generated with Ronnjs/v0.1
-.\" http://github.com/kapouer/ronnjs/
-.
-.TH "NODEUNIT" "1" "October 2010" "" ""
-.
-.SH "NAME"
-\fBnodeunit\fR \-\- simple node\.js unit testing tool
-.
-.SH "SYNOPSIS"
-.
-.nf
-nodeunit [options] <file\-or\-directory> [<file\-or\-directory> \.\.\.]
-.
-.fi
-.
-.SH "DESCRIPTION"
-Nodeunit is a simple unit testing tool based on the node\.js assert module\.
-.
-.IP "\(bu" 4
-Simple to use
-.
-.IP "\(bu" 4
-Just export the tests from a module
-.
-.IP "\(bu" 4
-Helps you avoid common pitfalls when testing asynchronous code
-.
-.IP "\(bu" 4
-Easy to add test cases with setUp and tearDown functions if you wish
-.
-.IP "\(bu" 4
-Allows the use of mocks and stubs
-.
-.IP "" 0
-.
-.SH "OPTIONS"
- \fB\-\-config FILE\fR:
-.
-.br
- Load config options from a JSON file, allows the customisation
- of color schemes for the default test reporter etc\.
- See bin/nodeunit\.json for current available options\.
-.
-.P
- \fB\-\-reporter FILE\fR:
-.
-.br
- You can set the test reporter to a custom module or on of the modules
- in nodeunit/lib/reporters, when omitted, the default test runner is used\.
-.
-.P
- \fB\-\-list\-reporters\fR:
-.
-.br
- List available build\-in reporters\.
-.
-.P
- \fB\-h\fR, \fB\-\-help\fR:
-.
-.br
- Display the help and exit\.
-.
-.P
- \fB\-v\fR, \fB\-\-version\fR:
-.
-.br
- Output version information and exit\.
-.
-.P
- \fB<file\-or\-directory>\fR:
- You can run nodeunit on specific files or on all \fI*\.js\fR files inside
-.
-.br
- a directory\.
-.
-.SH "AUTHORS"
-Written by Caolan McMahon and other nodeunit contributors\.
-.
-.br
-Contributors list: \fIhttp://github\.com/caolan/nodeunit/contributors\fR\|\.
-.
-.SH "REPORTING BUGS"
-Report nodeunit bugs to \fIhttp://github\.com/caolan/nodeunit/issues\fR\|\.
-.
-.SH "COPYRIGHT"
-Copyright © 2010 Caolan McMahon\.
-.
-.br
-Nodeunit has been released under the MIT license:
-.
-.br
-\fIhttp://github\.com/caolan/nodeunit/raw/master/LICENSE\fR\|\.
-.
-.SH "SEE ALSO"
-node(1)
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg
deleted file mode 100644
index 457a967..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-var options = {
- indent: 4,
- onevar: false
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/package.json b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/package.json
deleted file mode 100644
index 20cd2fa..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/package.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{ "name": "nodeunit"
-, "description": "Easy unit testing for node.js and the browser."
-, "maintainers":
- [ { "name": "Caolan McMahon"
- , "web": "https://github.com/caolan"
- }
- ]
-, "contributors" :
- [ { "name": "Alex Gorbatchev"
- , "web": "https://github.com/alexgorbatchev"
- }
- , { "name": "Alex Wolfe"
- , "web": "https://github.com/alexkwolfe"
- }
- , { "name": "Carl Fürstenberg"
- , "web": "https://github.com/azatoth"
- }
- , { "name": "Gerad Suyderhoud"
- , "web": "https://github.com/gerad"
- }
- , { "name": "Kadir Pekel"
- , "web": "https://github.com/coffeemate"
- }
- , { "name": "Oleg Efimov"
- , "web": "https://github.com/Sannis"
- }
- , { "name": "Orlando Vazquez"
- , "web": "https://github.com/orlandov"
- }
- , { "name": "Ryan Dahl"
- , "web": "https://github.com/ry"
- }
- , { "name": "Sam Stephenson"
- , "web": "https://github.com/sstephenson"
- }
- , { "name": "Thomas Mayfield"
- , "web": "https://github.com/thegreatape"
- }
- ]
-, "version": "0.5.0"
-, "repository" :
- { "type" : "git"
- , "url" : "http://github.com/caolan/nodeunit.git"
- }
-, "bugs" : { "web" : "http://github.com/caolan/nodeunit/issues" }
-, "licenses" :
- [ { "type" : "MIT"
- , "url" : "http://github.com/caolan/nodeunit/raw/master/LICENSE"
- }
- ]
-, "directories" : { "lib": "./lib", "doc" : "./doc", "man" : "./man1" }
-, "bin" : { "nodeunit" : "./bin/nodeunit" }
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs
deleted file mode 100644
index c1db5bb..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<% for (var i=0; i < suites.length; i++) { %>
- <% var suite=suites[i]; %>
- <testsuite name="<%= suite.name %>"
- errors="<%= suite.errorCount %>"
- failures="<%= suite.failureCount %>"
- tests="<%= suite.tests %>">
- <% for (var j=0; j < suite.testcases.length; j++) { %>
- <% var testcase=suites[i].testcases[j]; %>
- <testcase name="<%= testcase.name %>">
- <% if (testcase.failure) { %>
- <failure message="<%= testcase.failure.message %>">
- <% if (testcase.failure.backtrace) { %><%= testcase.failure.backtrace %><% } %>
- </failure>
- <% } %>
- </testcase>
- <% } %>
- </testsuite>
-<% } %>
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js
deleted file mode 100644
index f0f326f..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*!
- * Nodeunit
- * https://github.com/caolan/nodeunit
- * Copyright (c) 2010 Caolan McMahon
- * MIT Licensed
- *
- * json2.js
- * http://www.JSON.org/json2.js
- * Public Domain.
- * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
- */
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css
deleted file mode 100644
index 274434a..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
- * Styles taken from qunit.css
- */
-
-h1#nodeunit-header, h1.nodeunit-header {
- padding: 15px;
- font-size: large;
- background-color: #06b;
- color: white;
- font-family: 'trebuchet ms', verdana, arial;
- margin: 0;
-}
-
-h1#nodeunit-header a {
- color: white;
-}
-
-h2#nodeunit-banner {
- height: 2em;
- border-bottom: 1px solid white;
- background-color: #eee;
- margin: 0;
- font-family: 'trebuchet ms', verdana, arial;
-}
-h2#nodeunit-banner.pass {
- background-color: green;
-}
-h2#nodeunit-banner.fail {
- background-color: red;
-}
-
-h2#nodeunit-userAgent, h2.nodeunit-userAgent {
- padding: 10px;
- background-color: #eee;
- color: black;
- margin: 0;
- font-size: small;
- font-weight: normal;
- font-family: 'trebuchet ms', verdana, arial;
- font-size: 10pt;
-}
-
-div#nodeunit-testrunner-toolbar {
- background: #eee;
- border-top: 1px solid black;
- padding: 10px;
- font-family: 'trebuchet ms', verdana, arial;
- margin: 0;
- font-size: 10pt;
-}
-
-ol#nodeunit-tests {
- font-family: 'trebuchet ms', verdana, arial;
- font-size: 10pt;
-}
-ol#nodeunit-tests li strong {
- cursor:pointer;
-}
-ol#nodeunit-tests .pass {
- color: green;
-}
-ol#nodeunit-tests .fail {
- color: red;
-}
-
-p#nodeunit-testresult {
- margin-left: 1em;
- font-size: 10pt;
- font-family: 'trebuchet ms', verdana, arial;
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee
deleted file mode 100644
index a1c069b..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee
+++ /dev/null
@@ -1,4 +0,0 @@
-j = 0
-j += i for i in [0..5]
-
-exports.name = "mock_coffee_#{j}"
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js
deleted file mode 100644
index 3021776..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.name = 'mock_module3';
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js
deleted file mode 100644
index 876f9ca..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.name = 'mock_module4';
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js
deleted file mode 100644
index 4c093ad..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.name = 'mock_module1';
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js
deleted file mode 100644
index a63d012..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.name = 'mock_module2';
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js
deleted file mode 100644
index 2ef7115..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js
+++ /dev/null
@@ -1,3 +0,0 @@
-function hello_world(arg) {
- return "_" + arg + "_";
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js
deleted file mode 100644
index 55a764e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js
+++ /dev/null
@@ -1,3 +0,0 @@
-function get_a_variable() {
- return typeof a_variable;
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js
deleted file mode 100644
index 1fd1e78..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js
+++ /dev/null
@@ -1 +0,0 @@
-var t=t?t+1:1;
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js
deleted file mode 100644
index 64b8c8b..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * This module is not a plain nodeunit test suite, but instead uses the
- * assert module to ensure a basic level of functionality is present,
- * allowing the rest of the tests to be written using nodeunit itself.
- *
- * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-var assert = require('assert'), // @REMOVE_LINE_FOR_BROWSER
- async = require('../deps/async'), // @REMOVE_LINE_FOR_BROWSER
- nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
-
-
-// NOT A TEST - util function to make testing faster.
-// retries the assertion until it passes or the timeout is reached,
-// at which point it throws the assertion error
-var waitFor = function (fn, timeout, callback, start) {
- start = start || new Date().getTime();
- callback = callback || function () {};
- try {
- fn();
- callback();
- }
- catch (e) {
- if (e instanceof assert.AssertionError) {
- var now = new Date().getTime();
- if (now - start >= timeout) {
- throw e;
- }
- else {
- async.nextTick(function () {
- waitFor(fn, timeout, callback, start);
- });
- }
- }
- else {
- throw e;
- }
- }
-};
-
-
-// TESTS:
-
-// Are exported tests actually run? - store completed tests in this variable
-// for checking later
-var tests_called = {};
-
-// most basic test that should run, the tests_called object is tested
-// at the end of this module to ensure the tests were actually run by nodeunit
-exports.testCalled = function (test) {
- tests_called.testCalled = true;
- test.done();
-};
-
-// generates test functions for nodeunit assertions
-var makeTest = function (method, args_pass, args_fail) {
- return function (test) {
- var test1_called = false;
- var test2_called = false;
-
- // test pass
- nodeunit.runTest(
- 'testname',
- function (test) {
- test[method].apply(test, args_pass);
- test.done();
- },
- {testDone: function (name, assertions) {
- assert.equal(assertions.length, 1);
- assert.equal(assertions.failures(), 0);
- }},
- function () {
- test1_called = true;
- }
- );
-
- // test failure
- nodeunit.runTest(
- 'testname',
- function (test) {
- test[method].apply(test, args_fail);
- test.done();
- },
- {testDone: function (name, assertions) {
- assert.equal(assertions.length, 1);
- assert.equal(assertions.failures(), 1);
- }},
- function () {
- test2_called = true;
- }
- );
-
- // ensure tests were run
- waitFor(function () {
- assert.ok(test1_called);
- assert.ok(test2_called);
- tests_called[method] = true;
- }, 500, test.done);
- };
-};
-
-// ensure basic assertions are working:
-exports.testOk = makeTest('ok', [true], [false]);
-exports.testEquals = makeTest('equals', [1, 1], [1, 2]);
-exports.testSame = makeTest('same',
- [{test: 'test'}, {test: 'test'}],
- [{test: 'test'}, {monkey: 'penguin'}]
-);
-
-// from the assert module:
-exports.testEqual = makeTest('equal', [1, 1], [1, 2]);
-exports.testNotEqual = makeTest('notEqual', [1, 2], [1, 1]);
-exports.testDeepEqual = makeTest('deepEqual',
- [{one: 1}, {one: 1}], [{one: 1}, {two: 2}]
-);
-exports.testNotDeepEqual = makeTest('notDeepEqual',
- [{one: 1}, {two: 2}], [{one: 1}, {one: 1}]
-);
-exports.testStrictEqual = makeTest('strictEqual', [1, 1], [1, true]);
-exports.testNotStrictEqual = makeTest('notStrictEqual', [true, 1], [1, 1]);
-exports.testThrows = makeTest('throws',
- [function () {
- throw new Error('test');
- }],
- [function () {
- return;
- }]
-);
-exports.testDoesNotThrows = makeTest('doesNotThrow',
- [function () {
- return;
- }],
- [function () {
- throw new Error('test');
- }]
-);
-exports.testIfError = makeTest('ifError', [false], [new Error('test')]);
-
-
-exports.testExpect = function (test) {
- var test1_called = false,
- test2_called = false,
- test3_called = false;
-
- // correct number of tests run
- nodeunit.runTest(
- 'testname',
- function (test) {
- test.expect(2);
- test.ok(true);
- test.ok(true);
- test.done();
- },
- {testDone: function (name, assertions) {
- test.equals(assertions.length, 2);
- test.equals(assertions.failures(), 0);
- }},
- function () {
- test1_called = true;
- }
- );
-
- // no tests run
- nodeunit.runTest(
- 'testname',
- function (test) {
- test.expect(2);
- test.done();
- },
- {testDone: function (name, assertions) {
- test.equals(assertions.length, 1);
- test.equals(assertions.failures(), 1);
- }},
- function () {
- test2_called = true;
- }
- );
-
- // incorrect number of tests run
- nodeunit.runTest(
- 'testname',
- function (test) {
- test.expect(2);
- test.ok(true);
- test.ok(true);
- test.ok(true);
- test.done();
- },
- {testDone: function (name, assertions) {
- test.equals(assertions.length, 4);
- test.equals(assertions.failures(), 1);
- }},
- function () {
- test3_called = true;
- }
- );
-
- // ensure callbacks fired
- waitFor(function () {
- assert.ok(test1_called);
- assert.ok(test2_called);
- assert.ok(test3_called);
- tests_called.expect = true;
- }, 500, test.done);
-};
-
-
-// tests are async, so wait for them to be called
-waitFor(function () {
- assert.ok(tests_called.testCalled);
- assert.ok(tests_called.ok);
- assert.ok(tests_called.equals);
- assert.ok(tests_called.same);
- assert.ok(tests_called.expect);
-}, 10000);
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js
deleted file mode 100644
index 08f7eb5..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js
+++ /dev/null
@@ -1,114 +0,0 @@
-var nodeunit = require('../lib/nodeunit');
-
-
-exports.testFailingLog = function (test) {
- test.expect(3);
-
- // this is meant to bubble to the top, and will be ignored for the purposes
- // of testing:
- var ignored_error = new Error('ignore this callback error');
- var err_handler = function (err) {
- if (err && err.message !== ignored_error.message) {
- throw err;
- }
- };
- process.addListener('uncaughtException', err_handler);
-
- // A failing callback should not affect the test outcome
- var testfn = function (test) {
- test.ok(true, 'test.ok');
- test.done();
- };
- nodeunit.runTest('testname', testfn, {
- log: function (assertion) {
- test.ok(true, 'log called');
- throw ignored_error;
- },
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 1, 'total');
- process.removeListener('uncaughtException', err_handler);
- }
- }, test.done);
-};
-
-exports.testFailingTestDone = function (test) {
- test.expect(2);
-
- var ignored_error = new Error('ignore this callback error');
- var err_handler = function (err) {
- if (err && err.message !== ignored_error.message) {
- throw err;
- }
- };
- process.addListener('uncaughtException', err_handler);
-
- // A failing callback should not affect the test outcome
- var testfn = function (test) {
- test.done();
- };
- nodeunit.runTest('testname', testfn, {
- log: function (assertion) {
- test.ok(false, 'log should not be called');
- },
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 0, 'total');
- process.nextTick(function () {
- process.removeListener('uncaughtException', err_handler);
- test.done();
- });
- throw ignored_error;
- }
- }, function () {});
-};
-
-exports.testAssertionObj = function (test) {
- test.expect(4);
- var testfn = function (test) {
- test.ok(true, 'ok true');
- test.done();
- };
- nodeunit.runTest('testname', testfn, {
- log: function (assertion) {
- test.ok(assertion.passed() === true, 'assertion.passed');
- test.ok(assertion.failed() === false, 'assertion.failed');
- },
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 1, 'total');
- }
- }, test.done);
-};
-
-exports.testLogOptional = function (test) {
- test.expect(2);
- var testfn = function (test) {
- test.ok(true, 'ok true');
- test.done();
- };
- nodeunit.runTest('testname', testfn, {
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 1, 'total');
- }
- }, test.done);
-};
-
-exports.testExpectWithFailure = function (test) {
- test.expect(3);
- var testfn = function (test) {
- test.expect(1);
- test.ok(false, 'test.ok');
- test.done();
- };
- nodeunit.runTest('testname', testfn, {
- log: function (assertion) {
- test.equals(assertion.method, 'ok', 'assertion.method');
- },
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 1, 'failures');
- test.equals(assertions.length, 1, 'total');
- }
- }, test.done);
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js
deleted file mode 100644
index e5ee25c..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js
+++ /dev/null
@@ -1,55 +0,0 @@
-var nodeunit = require('../lib/nodeunit');
-var httputil = require('../lib/utils').httputil;
-
-exports.testHttpUtilBasics = function (test) {
-
- test.expect(6);
-
- httputil(function (req, resp) {
- test.equal(req.method, 'PUT');
- test.equal(req.url, '/newpair');
- test.equal(req.headers.foo, 'bar');
-
- resp.writeHead(500, {'content-type': 'text/plain'});
- resp.end('failed');
- }, function (server, client) {
- client.fetch('PUT', '/newpair', {'foo': 'bar'}, function (resp) {
- test.equal(resp.statusCode, 500);
- test.equal(resp.headers['content-type'], 'text/plain');
- test.equal(resp.body, 'failed');
-
- server.close();
- test.done();
- });
- });
-};
-
-exports.testHttpUtilJsonHandling = function (test) {
-
- test.expect(9);
-
- httputil(function (req, resp) {
- test.equal(req.method, 'GET');
- test.equal(req.url, '/');
- test.equal(req.headers.foo, 'bar');
-
- var testdata = {foo1: 'bar', foo2: 'baz'};
-
- resp.writeHead(200, {'content-type': 'application/json'});
- resp.end(JSON.stringify(testdata));
-
- }, function (server, client) {
- client.fetch('GET', '/', {'foo': 'bar'}, function (resp) {
- test.equal(resp.statusCode, 200);
- test.equal(resp.headers['content-type'], 'application/json');
-
- test.ok(resp.bodyAsObject);
- test.equal(typeof resp.bodyAsObject, 'object');
- test.equal(resp.bodyAsObject.foo1, 'bar');
- test.equal(resp.bodyAsObject.foo2, 'baz');
-
- server.close();
- test.done();
- });
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js
deleted file mode 100644
index b9ef754..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js
+++ /dev/null
@@ -1,214 +0,0 @@
-var assert = require('assert'),
- sys = require('sys'),
- fs = require('fs'),
- path = require('path'),
- nodeunit = require('../lib/nodeunit');
-
-
-var setup = function (fn) {
- return function (test) {
- process.chdir(__dirname);
- require.paths.push(__dirname);
- var env = {
- mock_module1: require('./fixtures/mock_module1'),
- mock_module2: require('./fixtures/mock_module2'),
- mock_module3: require('./fixtures/dir/mock_module3'),
- mock_module4: require('./fixtures/dir/mock_module4')
- };
- fn.call(env, test);
- };
-};
-
-
-exports.testRunFiles = setup(function (test) {
- test.expect(24);
- var runModule_copy = nodeunit.runModule;
-
- var runModule_calls = [];
- var modules = [];
-
- var opts = {
- moduleStart: function () {
- return 'moduleStart';
- },
- testDone: function () {
- return 'testDone';
- },
- testStart: function () {
- return 'testStart';
- },
- log: function () {
- return 'log';
- },
- done: function (assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 4, 'length');
- test.ok(typeof assertions.duration === "number");
-
- var called_with = function (name) {
- return runModule_calls.some(function (m) {
- return m.name === name;
- });
- };
- test.ok(called_with('mock_module1'), 'mock_module1 ran');
- test.ok(called_with('mock_module2'), 'mock_module2 ran');
- test.ok(called_with('mock_module3'), 'mock_module3 ran');
- test.ok(called_with('mock_module4'), 'mock_module4 ran');
- test.equals(runModule_calls.length, 4);
-
- nodeunit.runModule = runModule_copy;
- test.done();
- }
- };
-
- nodeunit.runModule = function (name, mod, options, callback) {
- test.equals(options.testDone, opts.testDone);
- test.equals(options.testStart, opts.testStart);
- test.equals(options.log, opts.log);
- test.ok(typeof name === "string");
- runModule_calls.push(mod);
- var m = [{failed: function () {
- return false;
- }}];
- modules.push(m);
- callback(null, m);
- };
-
- nodeunit.runFiles(
- ['fixtures/mock_module1.js', 'fixtures/mock_module2.js', 'fixtures/dir'],
- opts
- );
-});
-
-exports.testRunFilesEmpty = function (test) {
- test.expect(3);
- nodeunit.runFiles([], {
- moduleStart: function () {
- test.ok(false, 'should not be called');
- },
- testDone: function () {
- test.ok(false, 'should not be called');
- },
- testStart: function () {
- test.ok(false, 'should not be called');
- },
- log: function () {
- test.ok(false, 'should not be called');
- },
- done: function (assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 0, 'length');
- test.ok(typeof assertions.duration === "number");
- test.done();
- }
- });
-};
-
-
-exports.testEmptyDir = function (test) {
- var dir2 = __dirname + '/fixtures/dir2';
-
- // git doesn't like empty directories, so we have to create one
- path.exists(dir2, function (exists) {
- if (!exists) {
- fs.mkdirSync(dir2, 0777);
- }
-
- // runFiles on empty directory:
- nodeunit.runFiles([dir2], {
- moduleStart: function () {
- test.ok(false, 'should not be called');
- },
- testDone: function () {
- test.ok(false, 'should not be called');
- },
- testStart: function () {
- test.ok(false, 'should not be called');
- },
- log: function () {
- test.ok(false, 'should not be called');
- },
- done: function (assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 0, 'length');
- test.ok(typeof assertions.duration === "number");
- test.done();
- }
- });
- });
-};
-
-
-var CoffeeScript;
-try {
- CoffeeScript = require('coffee-script');
-} catch (e) {
-}
-
-if (CoffeeScript) {
- exports.testCoffeeScript = function (test) {
- process.chdir(__dirname);
- require.paths.push(__dirname);
- var env = {
- mock_coffee_module: require('./fixtures/coffee/mock_coffee_module')
- };
-
- test.expect(9);
- var runModule_copy = nodeunit.runModule;
-
- var runModule_calls = [];
- var modules = [];
-
- var opts = {
- moduleStart: function () {
- return 'moduleStart';
- },
- testDone: function () {
- return 'testDone';
- },
- testStart: function () {
- return 'testStart';
- },
- log: function () {
- return 'log';
- },
- done: function (assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 1, 'length');
- test.ok(typeof assertions.duration === "number");
-
- var called_with = function (name) {
- return runModule_calls.some(function (m) {
- return m.name === name;
- });
- };
- test.ok(
- called_with('mock_coffee_15'),
- 'mock_coffee_module ran'
- );
- test.equals(runModule_calls.length, 1);
-
- nodeunit.runModule = runModule_copy;
- test.done();
- }
- };
-
- nodeunit.runModule = function (name, mod, options, callback) {
- test.equals(options.testDone, opts.testDone);
- test.equals(options.testStart, opts.testStart);
- test.equals(options.log, opts.log);
- test.ok(typeof name === "string");
- runModule_calls.push(mod);
- var m = [{failed: function () {
- return false;
- }}];
- modules.push(m);
- callback(null, m);
- };
-
- nodeunit.runFiles(
- ['fixtures/coffee/mock_coffee_module.coffee'],
- opts
- );
- };
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js
deleted file mode 100644
index 218e8db..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
-
-
-exports.testRunModule = function (test) {
- test.expect(11);
- var call_order = [];
- var testmodule = {
- test1: function (test) {
- call_order.push('test1');
- test.ok(true, 'ok true');
- test.done();
- },
- test2: function (test) {
- call_order.push('test2');
- test.ok(false, 'ok false');
- test.ok(false, 'ok false');
- test.done();
- },
- test3: function (test) {
- call_order.push('test3');
- test.done();
- }
- };
- nodeunit.runModule('testmodule', testmodule, {
- log: function (assertion) {
- call_order.push('log');
- },
- testStart: function (name) {
- call_order.push('testStart');
- test.ok(
- name.toString() === 'test1' ||
- name.toString() === 'test2' ||
- name.toString() === 'test3',
- 'testStart called with test name '
- );
- },
- testDone: function (name, assertions) {
- call_order.push('testDone');
- test.ok(
- name.toString() === 'test1' ||
- name.toString() === 'test2' ||
- name.toString() === 'test3',
- 'testDone called with test name'
- );
- },
- moduleDone: function (name, assertions) {
- call_order.push('moduleDone');
- test.equals(assertions.length, 3);
- test.equals(assertions.failures(), 2);
- test.equals(name, 'testmodule');
- test.ok(typeof assertions.duration === "number");
- test.same(call_order, [
- 'testStart', 'test1', 'log', 'testDone',
- 'testStart', 'test2', 'log', 'log', 'testDone',
- 'testStart', 'test3', 'testDone',
- 'moduleDone'
- ]);
- }
- }, test.done);
-};
-
-exports.testRunModuleEmpty = function (test) {
- nodeunit.runModule('module with no exports', {}, {
- log: function (assertion) {
- test.ok(false, 'log should not be called');
- },
- testStart: function (name) {
- test.ok(false, 'testStart should not be called');
- },
- testDone: function (name, assertions) {
- test.ok(false, 'testDone should not be called');
- },
- moduleDone: function (name, assertions) {
- test.equals(assertions.length, 0);
- test.equals(assertions.failures(), 0);
- test.equals(name, 'module with no exports');
- test.ok(typeof assertions.duration === "number");
- }
- }, test.done);
-};
-
-exports.testNestedTests = function (test) {
- var call_order = [];
- var m = {
- test1: function (test) {
- test.done();
- },
- suite: {
- t1: function (test) {
- test.done();
- },
- t2: function (test) {
- test.done();
- },
- another_suite: {
- t3: function (test) {
- test.done();
- }
- }
- }
- };
- nodeunit.runModule('modulename', m, {
- testStart: function (name) {
- call_order.push(['testStart'].concat(name));
- },
- testDone: function (name, assertions) {
- call_order.push(['testDone'].concat(name));
- }
- }, function () {
- test.same(call_order, [
- ['testStart', 'test1'], ['testDone', 'test1'],
- ['testStart', 'suite', 't1'], ['testDone', 'suite', 't1'],
- ['testStart', 'suite', 't2'], ['testDone', 'suite', 't2'],
- ['testStart', 'suite', 'another_suite', 't3'],
- ['testDone', 'suite', 'another_suite', 't3']
- ]);
- test.done();
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js
deleted file mode 100644
index 8fc3d52..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
-
-
-exports.testArgs = function (test) {
- test.ok(test.expect instanceof Function, 'test.expect');
- test.ok(test.done instanceof Function, 'test.done');
- test.ok(test.ok instanceof Function, 'test.ok');
- test.ok(test.same instanceof Function, 'test.same');
- test.ok(test.equals instanceof Function, 'test.equals');
- test.done();
-};
-
-exports.testDoneCallback = function (test) {
- test.expect(4);
- nodeunit.runTest('testname', exports.testArgs, {
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 0, 'failures');
- test.equals(assertions.length, 5, 'length');
- test.ok(typeof assertions.duration === "number");
- test.equals(name, 'testname');
- }
- }, test.done);
-};
-
-exports.testThrowError = function (test) {
- test.expect(3);
- var err = new Error('test');
- var testfn = function (test) {
- throw err;
- };
- nodeunit.runTest('testname', testfn, {
- log: function (assertion) {
- test.same(assertion.error, err, 'assertion.error');
- },
- testDone: function (name, assertions) {
- test.equals(assertions.failures(), 1);
- test.equals(assertions.length, 1);
- }
- }, test.done);
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js
deleted file mode 100644
index 1b249d7..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var nodeunit = require('../lib/nodeunit');
-var sandbox = require('../lib/utils').sandbox;
-var testCase = nodeunit.testCase;
-
-exports.testSimpleSandbox = function (test) {
- var raw_jscode1 = sandbox(__dirname + '/fixtures/raw_jscode1.js');
- test.equal(raw_jscode1.hello_world('foo'), '_foo_', 'evaluation ok');
- test.done();
-};
-
-exports.testSandboxContext = function (test) {
- var a_variable = 42; // should not be visible in the sandbox
- var raw_jscode2 = sandbox(__dirname + '/fixtures/raw_jscode2.js');
- a_variable = 42; // again for the win
- test.equal(
- raw_jscode2.get_a_variable(),
- 'undefined',
- 'the variable should not be defined'
- );
- test.done();
-};
-
-exports.testSandboxMultiple = function (test) {
- var raw_jscode3 = sandbox([
- __dirname + '/fixtures/raw_jscode3.js',
- __dirname + '/fixtures/raw_jscode3.js',
- __dirname + '/fixtures/raw_jscode3.js'
- ]);
- test.equal(raw_jscode3.t, 3, 'two files loaded');
- test.done();
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js
deleted file mode 100644
index a3ea331..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS!
- * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build.
- * Only code on that line will be removed, its mostly to avoid requiring code
- * that is node specific
- */
-
-var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER
-var testCase = nodeunit.testCase;
-
-exports.testTestCase = function (test) {
- test.expect(7);
- var call_order = [];
- var s = testCase({
- setUp: function (callback) {
- call_order.push('setUp');
- test.equals(this.one, undefined);
- this.one = 1;
- callback();
- },
- tearDown: function (callback) {
- call_order.push('tearDown');
- test.ok(true, 'tearDown called');
- callback();
- },
- test1: function (t) {
- call_order.push('test1');
- test.equals(this.one, 1);
- this.one = 2;
- t.done();
- },
- test2: function (t) {
- call_order.push('test2');
- test.equals(this.one, 1);
- t.done();
- }
- });
- nodeunit.runSuite(null, s, {}, function () {
- test.same(call_order, [
- 'setUp', 'test1', 'tearDown',
- 'setUp', 'test2', 'tearDown'
- ]);
- test.done();
- });
-};
-
-exports.tearDownAfterError = function (test) {
- test.expect(1);
- var s = testCase({
- tearDown: function (callback) {
- test.ok(true, 'tearDown called');
- callback();
- },
- test: function (t) {
- throw new Error('some error');
- }
- });
- nodeunit.runSuite(null, s, {}, function () {
- test.done();
- });
-};
-
-exports.catchSetUpError = function (test) {
- test.expect(2);
- var test_error = new Error('test error');
- var s = testCase({
- setUp: function (callback) {
- throw test_error;
- },
- test: function (t) {
- test.ok(false, 'test function should not be called');
- t.done();
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.equal(assertions.length, 1);
- test.equal(assertions[0].error, test_error);
- test.done();
- });
-};
-
-exports.setUpErrorCallback = function (test) {
- test.expect(2);
- var test_error = new Error('test error');
- var s = testCase({
- setUp: function (callback) {
- callback(test_error);
- },
- test: function (t) {
- test.ok(false, 'test function should not be called');
- t.done();
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.equal(assertions.length, 1);
- test.equal(assertions[0].error, test_error);
- test.done();
- });
-};
-
-exports.catchTearDownError = function (test) {
- test.expect(2);
- var test_error = new Error('test error');
- var s = testCase({
- tearDown: function (callback) {
- throw test_error;
- },
- test: function (t) {
- t.done();
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.equal(assertions.length, 1);
- test.equal(assertions[0].error, test_error);
- test.done();
- });
-};
-
-exports.tearDownErrorCallback = function (test) {
- test.expect(2);
- var test_error = new Error('test error');
- var s = testCase({
- tearDown: function (callback) {
- callback(test_error);
- },
- test: function (t) {
- t.done();
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.equal(assertions.length, 1);
- test.equal(assertions[0].error, test_error);
- test.done();
- });
-};
-
-exports.testErrorAndtearDownError = function (test) {
- test.expect(3);
- var error1 = new Error('test error one');
- var error2 = new Error('test error two');
- var s = testCase({
- tearDown: function (callback) {
- callback(error2);
- },
- test: function (t) {
- t.done(error1);
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.equal(assertions.length, 2);
- test.equal(assertions[0].error, error1);
- test.equal(assertions[1].error, error2);
- test.done();
- });
-};
-
-exports.testCaseGroups = function (test) {
- var call_order = [];
- var s = testCase({
- setUp: function (callback) {
- call_order.push('setUp');
- callback();
- },
- tearDown: function (callback) {
- call_order.push('tearDown');
- callback();
- },
- test1: function (test) {
- call_order.push('test1');
- test.done();
- },
- group1: {
- test2: function (test) {
- call_order.push('group1.test2');
- test.done();
- }
- }
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.same(call_order, [
- 'setUp',
- 'test1',
- 'tearDown',
- 'setUp',
- 'group1.test2',
- 'tearDown'
- ]);
- test.done();
- });
-};
-
-exports.nestedTestCases = function (test) {
- var call_order = [];
- var s = testCase({
- setUp: function (callback) {
- call_order.push('setUp');
- callback();
- },
- tearDown: function (callback) {
- call_order.push('tearDown');
- callback();
- },
- test1: function (test) {
- call_order.push('test1');
- test.done();
- },
- group1: testCase({
- setUp: function (callback) {
- call_order.push('group1.setUp');
- callback();
- },
- tearDown: function (callback) {
- call_order.push('group1.tearDown');
- callback();
- },
- test2: function (test) {
- call_order.push('group1.test2');
- test.done();
- }
- })
- });
- nodeunit.runSuite(null, s, {}, function (err, assertions) {
- test.same(call_order, [
- 'setUp',
- 'test1',
- 'tearDown',
- 'setUp',
- 'group1.setUp',
- 'group1.test2',
- 'group1.tearDown',
- 'tearDown'
- ]);
- test.done();
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html b/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html
deleted file mode 100644
index 31bda30..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<html>
- <head>
- <title>Nodeunit Test Suite</title>
- <!--
- Note this file is only used for 'make browser', when it is copied to
- dist/browser/test.html for running the browser test suite
- -->
- <link rel="stylesheet" href="nodeunit.css" type="text/css" media="screen" />
- <script src="nodeunit.js"></script>
- <script src="test-base.js"></script>
- <script src="test-runmodule.js"></script>
- <script src="test-runtest.js"></script>
- <script src="test-testcase.js"></script>
- </head>
- <body>
- <h1 id="nodeunit-header">Nodeunit Test Suite</h1>
- <script>
- nodeunit.run({
- 'test-base': test_base,
- 'test-runmodule': test_runmodule,
- 'test-runtest': test_runtest,
- 'test-testcase': test_testcase
- });
- </script>
- </body>
-</html>
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/.npmignore b/examples/cross-domain/node_modules/connect/node_modules/debug/.npmignore
deleted file mode 100644
index f1250e5..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-support
-test
-examples
-*.sock
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/History.md b/examples/cross-domain/node_modules/connect/node_modules/debug/History.md
deleted file mode 100644
index f3c1a98..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/History.md
+++ /dev/null
@@ -1,41 +0,0 @@
-
-0.6.0 / 2012-03-16
-==================
-
- * Added support for "-" prefix in DEBUG [Vinay Pulim]
- * Added `.enabled` flag to the node version [TooTallNate]
-
-0.5.0 / 2012-02-02
-==================
-
- * Added: humanize diffs. Closes #8
- * Added `debug.disable()` to the CS variant
- * Removed padding. Closes #10
- * Fixed: persist client-side variant again. Closes #9
-
-0.4.0 / 2012-02-01
-==================
-
- * Added browser variant support for older browsers [TooTallNate]
- * Added `debug.enable('project:*')` to browser variant [TooTallNate]
- * Added padding to diff (moved it to the right)
-
-0.3.0 / 2012-01-26
-==================
-
- * Added millisecond diff when isatty, otherwise UTC string
-
-0.2.0 / 2012-01-22
-==================
-
- * Added wildcard support
-
-0.1.0 / 2011-12-02
-==================
-
- * Added: remove colors unless stderr isatty [TooTallNate]
-
-0.0.1 / 2010-01-03
-==================
-
- * Initial release
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/Makefile b/examples/cross-domain/node_modules/connect/node_modules/debug/Makefile
deleted file mode 100644
index 36a3ed7..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-
-test:
- @echo "populate me"
-
-.PHONY: test \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/Readme.md b/examples/cross-domain/node_modules/connect/node_modules/debug/Readme.md
deleted file mode 100644
index 419fcdf..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/Readme.md
+++ /dev/null
@@ -1,130 +0,0 @@
-
-# debug
-
- tiny node.js debugging utility.
-
-## Installation
-
-```
-$ npm install debug
-```
-
-## Example
-
- This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:
-
-```js
-var debug;
-if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {
- debug = function(x) {
- var prefix = process.pid + ',' +
- (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');
- console.error(prefix, x);
- };
-} else {
- debug = function() { };
-}
-```
-
- This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
-
-Example _app.js_:
-
-```js
-var debug = require('debug')('http')
- , http = require('http')
- , name = 'My App';
-
-// fake app
-
-debug('booting %s', name);
-
-http.createServer(function(req, res){
- debug(req.method + ' ' + req.url);
- res.end('hello\n');
-}).listen(3000, function(){
- debug('listening');
-});
-
-// fake worker of some kind
-
-require('./worker');
-```
-
-Example _worker.js_:
-
-```js
-var debug = require('debug')('worker');
-
-setInterval(function(){
- debug('doing some work');
-}, 1000);
-```
-
- The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
-
- ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
-
- ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
-
-## Millisecond diff
-
- When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
-
- ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
-
- When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
-
- ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
-
-## Conventions
-
- If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
-
-## Wildcards
-
- The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
-
- You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:".
-
-## Browser support
-
- Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
-
-```js
-a = debug('worker:a');
-b = debug('worker:b');
-
-setInterval(function(){
- a('doing some work');
-}, 1000);
-
-setInterval(function(){
- a('doing some work');
-}, 1200);
-```
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/debug.js b/examples/cross-domain/node_modules/connect/node_modules/debug/debug.js
deleted file mode 100644
index b2f0798..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/debug.js
+++ /dev/null
@@ -1,122 +0,0 @@
-
-/*!
- * debug
- * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Create a debugger with the given `name`.
- *
- * @param {String} name
- * @return {Type}
- * @api public
- */
-
-function debug(name) {
- if (!debug.enabled(name)) return function(){};
-
- return function(fmt){
- var curr = new Date;
- var ms = curr - (debug[name] || curr);
- debug[name] = curr;
-
- fmt = name
- + ' '
- + fmt
- + ' +' + debug.humanize(ms);
-
- // This hackery is required for IE8
- // where `console.log` doesn't have 'apply'
- window.console
- && console.log
- && Function.prototype.apply.call(console.log, console, arguments);
- }
-}
-
-/**
- * The currently active debug mode names.
- */
-
-debug.names = [];
-debug.skips = [];
-
-/**
- * Enables a debug mode by name. This can include modes
- * separated by a colon and wildcards.
- *
- * @param {String} name
- * @api public
- */
-
-debug.enable = function(name) {
- localStorage.debug = name;
-
- var split = (name || '').split(/[\s,]+/)
- , len = split.length;
-
- for (var i = 0; i < len; i++) {
- name = split[i].replace('*', '.*?');
- if (name[0] === '-') {
- debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
- }
- else {
- debug.names.push(new RegExp('^' + name + '$'));
- }
- }
-};
-
-/**
- * Disable debug output.
- *
- * @api public
- */
-
-debug.disable = function(){
- debug.enable('');
-};
-
-/**
- * Humanize the given `ms`.
- *
- * @param {Number} m
- * @return {String}
- * @api private
- */
-
-debug.humanize = function(ms) {
- var sec = 1000
- , min = 60 * 1000
- , hour = 60 * min;
-
- if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
- if (ms >= min) return (ms / min).toFixed(1) + 'm';
- if (ms >= sec) return (ms / sec | 0) + 's';
- return ms + 'ms';
-};
-
-/**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
-
-debug.enabled = function(name) {
- for (var i = 0, len = debug.skips.length; i < len; i++) {
- if (debug.skips[i].test(name)) {
- return false;
- }
- }
- for (var i = 0, len = debug.names.length; i < len; i++) {
- if (debug.names[i].test(name)) {
- return true;
- }
- }
- return false;
-};
-
-// persist
-
-if (window.localStorage) debug.enable(localStorage.debug); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/example/app.js b/examples/cross-domain/node_modules/connect/node_modules/debug/example/app.js
deleted file mode 100644
index 05374d9..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/example/app.js
+++ /dev/null
@@ -1,19 +0,0 @@
-
-var debug = require('../')('http')
- , http = require('http')
- , name = 'My App';
-
-// fake app
-
-debug('booting %s', name);
-
-http.createServer(function(req, res){
- debug(req.method + ' ' + req.url);
- res.end('hello\n');
-}).listen(3000, function(){
- debug('listening');
-});
-
-// fake worker of some kind
-
-require('./worker'); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/example/browser.html b/examples/cross-domain/node_modules/connect/node_modules/debug/example/browser.html
deleted file mode 100644
index 7510eee..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/example/browser.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
- <head>
- <title>debug()</title>
- <script src="../debug.js"></script>
- <script>
- // type debug.enable('*') in
- // the console and refresh :)
-
- a = debug('worker:a');
- b = debug('worker:b');
-
- setInterval(function(){
- a('doing some work');
- }, 1000);
-
- setInterval(function(){
- a('doing some work');
- }, 1200);
- </script>
- </head>
- <body>
-
- </body>
-</html>
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/example/wildcards.js b/examples/cross-domain/node_modules/connect/node_modules/debug/example/wildcards.js
deleted file mode 100644
index 1fdac20..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/example/wildcards.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-var debug = {
- foo: require('../')('test:foo'),
- bar: require('../')('test:bar'),
- baz: require('../')('test:baz')
-};
-
-debug.foo('foo')
-debug.bar('bar')
-debug.baz('baz') \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/example/worker.js b/examples/cross-domain/node_modules/connect/node_modules/debug/example/worker.js
deleted file mode 100644
index 7f6d288..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/example/worker.js
+++ /dev/null
@@ -1,22 +0,0 @@
-
-// DEBUG=* node example/worker
-// DEBUG=worker:* node example/worker
-// DEBUG=worker:a node example/worker
-// DEBUG=worker:b node example/worker
-
-var a = require('../')('worker:a')
- , b = require('../')('worker:b');
-
-function work() {
- a('doing lots of uninteresting work');
- setTimeout(work, Math.random() * 1000);
-}
-
-work();
-
-function workb() {
- b('doing some work');
- setTimeout(workb, Math.random() * 2000);
-}
-
-workb(); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/index.js b/examples/cross-domain/node_modules/connect/node_modules/debug/index.js
deleted file mode 100644
index ee54454..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/debug'); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/lib/debug.js b/examples/cross-domain/node_modules/connect/node_modules/debug/lib/debug.js
deleted file mode 100644
index 984dfb5..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/lib/debug.js
+++ /dev/null
@@ -1,147 +0,0 @@
-
-/*!
- * debug
- * Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var tty = require('tty');
-
-/**
- * Expose `debug()` as the module.
- */
-
-module.exports = debug;
-
-/**
- * Library version.
- */
-
-exports.version = '0.6.0';
-
-/**
- * Enabled debuggers.
- */
-
-var names = []
- , skips = [];
-
-(process.env.DEBUG || '')
- .split(/[\s,]+/)
- .forEach(function(name){
- name = name.replace('*', '.*?');
- if (name[0] === '-') {
- skips.push(new RegExp('^' + name.substr(1) + '$'));
- } else {
- names.push(new RegExp('^' + name + '$'));
- }
- });
-
-/**
- * Colors.
- */
-
-var colors = [6, 2, 3, 4, 5, 1];
-
-/**
- * Previous debug() call.
- */
-
-var prev = {};
-
-/**
- * Previously assigned color.
- */
-
-var prevColor = 0;
-
-/**
- * Is stdout a TTY? Colored output is disabled when `true`.
- */
-
-var isatty = tty.isatty(2);
-
-/**
- * Select a color.
- *
- * @return {Number}
- * @api private
- */
-
-function color() {
- return colors[prevColor++ % colors.length];
-}
-
-/**
- * Humanize the given `ms`.
- *
- * @param {Number} m
- * @return {String}
- * @api private
- */
-
-function humanize(ms) {
- var sec = 1000
- , min = 60 * 1000
- , hour = 60 * min;
-
- if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
- if (ms >= min) return (ms / min).toFixed(1) + 'm';
- if (ms >= sec) return (ms / sec | 0) + 's';
- return ms + 'ms';
-}
-
-/**
- * Create a debugger with the given `name`.
- *
- * @param {String} name
- * @return {Type}
- * @api public
- */
-
-function debug(name) {
- function disabled(){}
- disabled.enabled = false;
-
- var match = skips.some(function(re){
- return re.test(name);
- });
-
- if (match) return disabled;
-
- match = names.some(function(re){
- return re.test(name);
- });
-
- if (!match) return disabled;
- var c = color();
-
- function colored(fmt) {
- var curr = new Date;
- var ms = curr - (prev[name] || curr);
- prev[name] = curr;
-
- fmt = ' \033[9' + c + 'm' + name + ' '
- + '\033[3' + c + 'm\033[90m'
- + fmt + '\033[3' + c + 'm'
- + ' +' + humanize(ms) + '\033[0m';
-
- console.error.apply(this, arguments);
- }
-
- function plain(fmt) {
- fmt = new Date().toUTCString()
- + ' ' + name + ' ' + fmt;
- console.error.apply(this, arguments);
- }
-
- colored.enabled = plain.enabled = true;
-
- return isatty
- ? colored
- : plain;
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/debug/package.json b/examples/cross-domain/node_modules/connect/node_modules/debug/package.json
deleted file mode 100644
index 0e54ea7..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/debug/package.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "debug",
- "version": "0.6.0",
- "description": "small debugging utility",
- "keywords": [
- "debug",
- "log",
- "debugger"
- ],
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca"
- },
- "dependencies": {},
- "devDependencies": {
- "mocha": "*"
- },
- "main": "index",
- "engines": {
- "node": "*"
- },
- "_id": "debug@0.6.0",
- "optionalDependencies": {},
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "_from": "debug@*"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/.npmignore b/examples/cross-domain/node_modules/connect/node_modules/formidable/.npmignore
deleted file mode 100644
index 4fbabb3..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/test/tmp/
-*.upload
-*.un~
-*.http
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/.travis.yml b/examples/cross-domain/node_modules/connect/node_modules/formidable/.travis.yml
deleted file mode 100644
index f1d0f13..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: node_js
-node_js:
- - 0.4
- - 0.6
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/Makefile b/examples/cross-domain/node_modules/connect/node_modules/formidable/Makefile
deleted file mode 100644
index 8945872..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-SHELL := /bin/bash
-
-test:
- @./test/run.js
-
-build: npm test
-
-npm:
- npm install .
-
-clean:
- rm test/tmp/*
-
-.PHONY: test clean build
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/Readme.md b/examples/cross-domain/node_modules/connect/node_modules/formidable/Readme.md
deleted file mode 100644
index cfa2462..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/Readme.md
+++ /dev/null
@@ -1,303 +0,0 @@
-# Formidable
-
-[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)
-
-## Purpose
-
-A node.js module for parsing form data, especially file uploads.
-
-## Current status
-
-This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading
-and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from
-a large variety of clients and is considered production-ready.
-
-## Features
-
-* Fast (~500mb/sec), non-buffering multipart parser
-* Automatically writing file uploads to disk
-* Low memory footprint
-* Graceful error handling
-* Very high test coverage
-
-## Changelog
-
-### v1.0.9
-
-* Emit progress when content length header parsed (Tim Koschützki)
-* Fix Readme syntax due to GitHub changes (goob)
-* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)
-
-### v1.0.8
-
-* Strip potentially unsafe characters when using `keepExtensions: true`.
-* Switch to utest / urun for testing
-* Add travis build
-
-### v1.0.7
-
-* Remove file from package that was causing problems when installing on windows. (#102)
-* Fix typos in Readme (Jason Davies).
-
-### v1.0.6
-
-* Do not default to the default to the field name for file uploads where
- filename="".
-
-### v1.0.5
-
-* Support filename="" in multipart parts
-* Explain unexpected end() errors in parser better
-
-**Note:** Starting with this version, formidable emits 'file' events for empty
-file input fields. Previously those were incorrectly emitted as regular file
-input fields with value = "".
-
-### v1.0.4
-
-* Detect a good default tmp directory regardless of platform. (#88)
-
-### v1.0.3
-
-* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)
-* Small performance improvements
-* New test suite and fixture system
-
-### v1.0.2
-
-* Exclude node\_modules folder from git
-* Implement new `'aborted'` event
-* Fix files in example folder to work with recent node versions
-* Make gently a devDependency
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
-
-### v1.0.1
-
-* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
-
-### v1.0.0
-
-* Add support for multipart boundaries that are quoted strings. (Jeff Craig)
-
-This marks the beginning of development on version 2.0 which will include
-several architectural improvements.
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)
-
-### v0.9.11
-
-* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)
-* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class
-
-**Important:** The old property names of the File class will be removed in a
-future release.
-
-[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)
-
-### Older releases
-
-These releases were done before starting to maintain the above Changelog:
-
-* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)
-* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)
-* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)
-* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)
-* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)
-* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)
-* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)
-* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)
-* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)
-* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
-* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)
-
-## Installation
-
-Via [npm](http://github.com/isaacs/npm):
-
- npm install formidable@latest
-
-Manually:
-
- git clone git://github.com/felixge/node-formidable.git formidable
- vim my.js
- # var formidable = require('./formidable');
-
-Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.
-
-## Example
-
-Parse an incoming file upload.
-
- var formidable = require('formidable'),
- http = require('http'),
-
- util = require('util');
-
- http.createServer(function(req, res) {
- if (req.url == '/upload' && req.method.toLowerCase() == 'post') {
- // parse a file upload
- var form = new formidable.IncomingForm();
- form.parse(req, function(err, fields, files) {
- res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received upload:\n\n');
- res.end(util.inspect({fields: fields, files: files}));
- });
- return;
- }
-
- // show a file upload form
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/upload" enctype="multipart/form-data" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="file" name="upload" multiple="multiple"><br>'+
- '<input type="submit" value="Upload">'+
- '</form>'
- );
- }).listen(80);
-
-## API
-
-### formidable.IncomingForm
-
-__new formidable.IncomingForm()__
-
-Creates a new incoming form.
-
-__incomingForm.encoding = 'utf-8'__
-
-The encoding to use for incoming form fields.
-
-__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__
-
-The directory for placing file uploads in. You can move them later on using
-`fs.rename()`. The default directory is picked at module load time depending on
-the first existing directory from those listed above.
-
-__incomingForm.keepExtensions = false__
-
-If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.
-
-__incomingForm.type__
-
-Either 'multipart' or 'urlencoded' depending on the incoming request.
-
-__incomingForm.maxFieldsSize = 2 * 1024 * 1024__
-
-Limits the amount of memory a field (not file) can allocate in bytes.
-If this value is exceeded, an `'error'` event is emitted. The default
-size is 2MB.
-
-__incomingForm.bytesReceived__
-
-The amount of bytes received for this form so far.
-
-__incomingForm.bytesExpected__
-
-The expected number of bytes in this form.
-
-__incomingForm.parse(request, [cb])__
-
-Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:
-
- incomingForm.parse(req, function(err, fields, files) {
- // ...
- });
-
-__incomingForm.onPart(part)__
-
-You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.
-
- incomingForm.onPart = function(part) {
- part.addListener('data', function() {
- // ...
- });
- }
-
-If you want to use formidable to only handle certain parts for you, you can do so:
-
- incomingForm.onPart = function(part) {
- if (!part.filename) {
- // let formidable handle all non-file parts
- incomingForm.handlePart(part);
- }
- }
-
-Check the code in this method for further inspiration.
-
-__Event: 'progress' (bytesReceived, bytesExpected)__
-
-Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.
-
-__Event: 'field' (name, value)__
-
-Emitted whenever a field / value pair has been received.
-
-__Event: 'fileBegin' (name, file)__
-
-Emitted whenever a new file is detected in the upload stream. Use this even if
-you want to stream the file to somewhere else while buffering the upload on
-the file system.
-
-__Event: 'file' (name, file)__
-
-Emitted whenever a field / file pair has been received. `file` is an instance of `File`.
-
-__Event: 'error' (err)__
-
-Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.
-
-__Event: 'aborted'__
-
-Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).
-
-__Event: 'end' ()__
-
-Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
-
-### formidable.File
-
-__file.size = 0__
-
-The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.
-
-__file.path = null__
-
-The path this file is being written to. You can modify this in the `'fileBegin'` event in
-case you are unhappy with the way formidable generates a temporary path for your files.
-
-__file.name = null__
-
-The name this file had according to the uploading client.
-
-__file.type = null__
-
-The mime type of this file, according to the uploading client.
-
-__file.lastModifiedDate = null__
-
-A date object (or `null`) containing the time this file was last written to. Mostly
-here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).
-
-## License
-
-Formidable is licensed under the MIT license.
-
-## Ports
-
-* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable
-
-## Credits
-
-* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/TODO b/examples/cross-domain/node_modules/connect/node_modules/formidable/TODO
deleted file mode 100644
index e1107f2..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- Better bufferMaxSize handling approach
-- Add tests for JSON parser pull request and merge it
-- Implement QuerystringParser the same way as MultipartParser
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
deleted file mode 100644
index bff41f1..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
+++ /dev/null
@@ -1,70 +0,0 @@
-require('../test/common');
-var multipartParser = require('../lib/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- parser = new MultipartParser(),
- Buffer = require('buffer').Buffer,
- boundary = '-----------------------------168072824752491622650073',
- mb = 100,
- buffer = createMultipartBuffer(boundary, mb * 1024 * 1024),
- callbacks =
- { partBegin: -1,
- partEnd: -1,
- headerField: -1,
- headerValue: -1,
- partData: -1,
- end: -1,
- };
-
-
-parser.initWithBoundary(boundary);
-parser.onHeaderField = function() {
- callbacks.headerField++;
-};
-
-parser.onHeaderValue = function() {
- callbacks.headerValue++;
-};
-
-parser.onPartBegin = function() {
- callbacks.partBegin++;
-};
-
-parser.onPartData = function() {
- callbacks.partData++;
-};
-
-parser.onPartEnd = function() {
- callbacks.partEnd++;
-};
-
-parser.onEnd = function() {
- callbacks.end++;
-};
-
-var start = +new Date(),
- nparsed = parser.write(buffer),
- duration = +new Date - start,
- mbPerSec = (mb / (duration / 1000)).toFixed(2);
-
-console.log(mbPerSec+' mb/sec');
-
-assert.equal(nparsed, buffer.length);
-
-function createMultipartBuffer(boundary, size) {
- var head =
- '--'+boundary+'\r\n'
- + 'content-disposition: form-data; name="field1"\r\n'
- + '\r\n'
- , tail = '\r\n--'+boundary+'--\r\n'
- , buffer = new Buffer(size);
-
- buffer.write(head, 'ascii', 0);
- buffer.write(tail, 'ascii', buffer.length - tail.length);
- return buffer;
-}
-
-process.on('exit', function() {
- for (var k in callbacks) {
- assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]);
- }
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/example/post.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/example/post.js
deleted file mode 100644
index f6c15a6..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/example/post.js
+++ /dev/null
@@ -1,43 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/post" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="text" name="data[foo][]"><br>'+
- '<input type="submit" value="Submit">'+
- '</form>'
- );
- } else if (req.url == '/post') {
- var form = new formidable.IncomingForm(),
- fields = [];
-
- form
- .on('error', function(err) {
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('error:\n\n'+util.inspect(err));
- })
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('end', function() {
- console.log('-> post done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('received fields:\n\n '+util.inspect(fields));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/example/upload.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/example/upload.js
deleted file mode 100644
index 050cdd9..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/example/upload.js
+++ /dev/null
@@ -1,48 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/upload" enctype="multipart/form-data" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="file" name="upload" multiple="multiple"><br>'+
- '<input type="submit" value="Upload">'+
- '</form>'
- );
- } else if (req.url == '/upload') {
- var form = new formidable.IncomingForm(),
- files = [],
- fields = [];
-
- form.uploadDir = TEST_TMP;
-
- form
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('file', function(field, file) {
- console.log(field, file);
- files.push([field, file]);
- })
- .on('end', function() {
- console.log('-> upload done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received fields:\n\n '+util.inspect(fields));
- res.write('\n\n');
- res.end('received files:\n\n '+util.inspect(files));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/index.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/index.js
deleted file mode 100644
index be41032..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/formidable'); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/file.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/file.js
deleted file mode 100644
index 6dc8720..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/file.js
+++ /dev/null
@@ -1,61 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var util = require('./util'),
- WriteStream = require('fs').WriteStream,
- EventEmitter = require('events').EventEmitter;
-
-function File(properties) {
- EventEmitter.call(this);
-
- this.size = 0;
- this.path = null;
- this.name = null;
- this.type = null;
- this.lastModifiedDate = null;
-
- this._writeStream = null;
-
- for (var key in properties) {
- this[key] = properties[key];
- }
-
- this._backwardsCompatibility();
-}
-module.exports = File;
-util.inherits(File, EventEmitter);
-
-// @todo Next release: Show error messages when accessing these
-File.prototype._backwardsCompatibility = function() {
- var self = this;
- this.__defineGetter__('length', function() {
- return self.size;
- });
- this.__defineGetter__('filename', function() {
- return self.name;
- });
- this.__defineGetter__('mime', function() {
- return self.type;
- });
-};
-
-File.prototype.open = function() {
- this._writeStream = new WriteStream(this.path);
-};
-
-File.prototype.write = function(buffer, cb) {
- var self = this;
- this._writeStream.write(buffer, function() {
- self.lastModifiedDate = new Date();
- self.size += buffer.length;
- self.emit('progress', self.size);
- cb();
- });
-};
-
-File.prototype.end = function(cb) {
- var self = this;
- this._writeStream.end(function() {
- self.emit('end');
- cb();
- });
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/incoming_form.js
deleted file mode 100644
index b1e2bfb..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/incoming_form.js
+++ /dev/null
@@ -1,378 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var fs = require('fs');
-var util = require('./util'),
- path = require('path'),
- File = require('./file'),
- MultipartParser = require('./multipart_parser').MultipartParser,
- QuerystringParser = require('./querystring_parser').QuerystringParser,
- StringDecoder = require('string_decoder').StringDecoder,
- EventEmitter = require('events').EventEmitter;
-
-function IncomingForm() {
- if (!(this instanceof IncomingForm)) return new IncomingForm;
- EventEmitter.call(this);
-
- this.error = null;
- this.ended = false;
-
- this.maxFieldsSize = 2 * 1024 * 1024;
- this.keepExtensions = false;
- this.uploadDir = IncomingForm.UPLOAD_DIR;
- this.encoding = 'utf-8';
- this.headers = null;
- this.type = null;
-
- this.bytesReceived = null;
- this.bytesExpected = null;
-
- this._parser = null;
- this._flushing = 0;
- this._fieldsSize = 0;
-};
-util.inherits(IncomingForm, EventEmitter);
-exports.IncomingForm = IncomingForm;
-
-IncomingForm.UPLOAD_DIR = (function() {
- var dirs = [process.env.TMP, '/tmp', process.cwd()];
- for (var i = 0; i < dirs.length; i++) {
- var dir = dirs[i];
- var isDirectory = false;
-
- try {
- isDirectory = fs.statSync(dir).isDirectory();
- } catch (e) {}
-
- if (isDirectory) return dir;
- }
-})();
-
-IncomingForm.prototype.parse = function(req, cb) {
- this.pause = function() {
- try {
- req.pause();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
- return true;
- };
-
- this.resume = function() {
- try {
- req.resume();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
-
- return true;
- };
-
- this.writeHeaders(req.headers);
-
- var self = this;
- req
- .on('error', function(err) {
- self._error(err);
- })
- .on('aborted', function() {
- self.emit('aborted');
- })
- .on('data', function(buffer) {
- self.write(buffer);
- })
- .on('end', function() {
- if (self.error) {
- return;
- }
-
- var err = self._parser.end();
- if (err) {
- self._error(err);
- }
- });
-
- if (cb) {
- var fields = {}, files = {};
- this
- .on('field', function(name, value) {
- fields[name] = value;
- })
- .on('file', function(name, file) {
- files[name] = file;
- })
- .on('error', function(err) {
- cb(err, fields, files);
- })
- .on('end', function() {
- cb(null, fields, files);
- });
- }
-
- return this;
-};
-
-IncomingForm.prototype.writeHeaders = function(headers) {
- this.headers = headers;
- this._parseContentLength();
- this._parseContentType();
-};
-
-IncomingForm.prototype.write = function(buffer) {
- if (!this._parser) {
- this._error(new Error('unintialized parser'));
- return;
- }
-
- this.bytesReceived += buffer.length;
- this.emit('progress', this.bytesReceived, this.bytesExpected);
-
- var bytesParsed = this._parser.write(buffer);
- if (bytesParsed !== buffer.length) {
- this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed'));
- }
-
- return bytesParsed;
-};
-
-IncomingForm.prototype.pause = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.resume = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.onPart = function(part) {
- // this method can be overwritten by the user
- this.handlePart(part);
-};
-
-IncomingForm.prototype.handlePart = function(part) {
- var self = this;
-
- if (part.filename === undefined) {
- var value = ''
- , decoder = new StringDecoder(this.encoding);
-
- part.on('data', function(buffer) {
- self._fieldsSize += buffer.length;
- if (self._fieldsSize > self.maxFieldsSize) {
- self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
- return;
- }
- value += decoder.write(buffer);
- });
-
- part.on('end', function() {
- self.emit('field', part.name, value);
- });
- return;
- }
-
- this._flushing++;
-
- var file = new File({
- path: this._uploadPath(part.filename),
- name: part.filename,
- type: part.mime,
- });
-
- this.emit('fileBegin', part.name, file);
-
- file.open();
-
- part.on('data', function(buffer) {
- self.pause();
- file.write(buffer, function() {
- self.resume();
- });
- });
-
- part.on('end', function() {
- file.end(function() {
- self._flushing--;
- self.emit('file', part.name, file);
- self._maybeEnd();
- });
- });
-};
-
-IncomingForm.prototype._parseContentType = function() {
- if (!this.headers['content-type']) {
- this._error(new Error('bad content-type header, no content-type'));
- return;
- }
-
- if (this.headers['content-type'].match(/urlencoded/i)) {
- this._initUrlencoded();
- return;
- }
-
- if (this.headers['content-type'].match(/multipart/i)) {
- var m;
- if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) {
- this._initMultipart(m[1] || m[2]);
- } else {
- this._error(new Error('bad content-type header, no multipart boundary'));
- }
- return;
- }
-
- this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
-};
-
-IncomingForm.prototype._error = function(err) {
- if (this.error) {
- return;
- }
-
- this.error = err;
- this.pause();
- this.emit('error', err);
-};
-
-IncomingForm.prototype._parseContentLength = function() {
- if (this.headers['content-length']) {
- this.bytesReceived = 0;
- this.bytesExpected = parseInt(this.headers['content-length'], 10);
- this.emit('progress', this.bytesReceived, this.bytesExpected);
- }
-};
-
-IncomingForm.prototype._newParser = function() {
- return new MultipartParser();
-};
-
-IncomingForm.prototype._initMultipart = function(boundary) {
- this.type = 'multipart';
-
- var parser = new MultipartParser(),
- self = this,
- headerField,
- headerValue,
- part;
-
- parser.initWithBoundary(boundary);
-
- parser.onPartBegin = function() {
- part = new EventEmitter();
- part.headers = {};
- part.name = null;
- part.filename = null;
- part.mime = null;
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderEnd = function() {
- headerField = headerField.toLowerCase();
- part.headers[headerField] = headerValue;
-
- var m;
- if (headerField == 'content-disposition') {
- if (m = headerValue.match(/name="([^"]+)"/i)) {
- part.name = m[1];
- }
-
- part.filename = self._fileName(headerValue);
- } else if (headerField == 'content-type') {
- part.mime = headerValue;
- }
-
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeadersEnd = function() {
- self.onPart(part);
- };
-
- parser.onPartData = function(b, start, end) {
- part.emit('data', b.slice(start, end));
- };
-
- parser.onPartEnd = function() {
- part.emit('end');
- };
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._fileName = function(headerValue) {
- var m = headerValue.match(/filename="(.*?)"($|; )/i)
- if (!m) return;
-
- var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
- filename = filename.replace(/%22/g, '"');
- filename = filename.replace(/&#([\d]{4});/g, function(m, code) {
- return String.fromCharCode(code);
- });
- return filename;
-};
-
-IncomingForm.prototype._initUrlencoded = function() {
- this.type = 'urlencoded';
-
- var parser = new QuerystringParser()
- , self = this;
-
- parser.onField = function(key, val) {
- self.emit('field', key, val);
- };
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._uploadPath = function(filename) {
- var name = '';
- for (var i = 0; i < 32; i++) {
- name += Math.floor(Math.random() * 16).toString(16);
- }
-
- if (this.keepExtensions) {
- var ext = path.extname(filename);
- ext = ext.replace(/(\.[a-z0-9]+).*/, '$1')
-
- name += ext;
- }
-
- return path.join(this.uploadDir, name);
-};
-
-IncomingForm.prototype._maybeEnd = function() {
- if (!this.ended || this._flushing) {
- return;
- }
-
- this.emit('end');
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/index.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/index.js
deleted file mode 100644
index 7a6e3e1..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var IncomingForm = require('./incoming_form').IncomingForm;
-IncomingForm.IncomingForm = IncomingForm;
-module.exports = IncomingForm;
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
deleted file mode 100644
index 9ca567c..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
+++ /dev/null
@@ -1,312 +0,0 @@
-var Buffer = require('buffer').Buffer,
- s = 0,
- S =
- { PARSER_UNINITIALIZED: s++,
- START: s++,
- START_BOUNDARY: s++,
- HEADER_FIELD_START: s++,
- HEADER_FIELD: s++,
- HEADER_VALUE_START: s++,
- HEADER_VALUE: s++,
- HEADER_VALUE_ALMOST_DONE: s++,
- HEADERS_ALMOST_DONE: s++,
- PART_DATA_START: s++,
- PART_DATA: s++,
- PART_END: s++,
- END: s++,
- },
-
- f = 1,
- F =
- { PART_BOUNDARY: f,
- LAST_BOUNDARY: f *= 2,
- },
-
- LF = 10,
- CR = 13,
- SPACE = 32,
- HYPHEN = 45,
- COLON = 58,
- A = 97,
- Z = 122,
-
- lower = function(c) {
- return c | 0x20;
- };
-
-for (var s in S) {
- exports[s] = S[s];
-}
-
-function MultipartParser() {
- this.boundary = null;
- this.boundaryChars = null;
- this.lookbehind = null;
- this.state = S.PARSER_UNINITIALIZED;
-
- this.index = null;
- this.flags = 0;
-};
-exports.MultipartParser = MultipartParser;
-
-MultipartParser.stateToString = function(stateNumber) {
- for (var state in S) {
- var number = S[state];
- if (number === stateNumber) return state;
- }
-};
-
-MultipartParser.prototype.initWithBoundary = function(str) {
- this.boundary = new Buffer(str.length+4);
- this.boundary.write('\r\n--', 'ascii', 0);
- this.boundary.write(str, 'ascii', 4);
- this.lookbehind = new Buffer(this.boundary.length+8);
- this.state = S.START;
-
- this.boundaryChars = {};
- for (var i = 0; i < this.boundary.length; i++) {
- this.boundaryChars[this.boundary[i]] = true;
- }
-};
-
-MultipartParser.prototype.write = function(buffer) {
- var self = this,
- i = 0,
- len = buffer.length,
- prevIndex = this.index,
- index = this.index,
- state = this.state,
- flags = this.flags,
- lookbehind = this.lookbehind,
- boundary = this.boundary,
- boundaryChars = this.boundaryChars,
- boundaryLength = this.boundary.length,
- boundaryEnd = boundaryLength - 1,
- bufferLength = buffer.length,
- c,
- cl,
-
- mark = function(name) {
- self[name+'Mark'] = i;
- },
- clear = function(name) {
- delete self[name+'Mark'];
- },
- callback = function(name, buffer, start, end) {
- if (start !== undefined && start === end) {
- return;
- }
-
- var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
- if (callbackSymbol in self) {
- self[callbackSymbol](buffer, start, end);
- }
- },
- dataCallback = function(name, clear) {
- var markSymbol = name+'Mark';
- if (!(markSymbol in self)) {
- return;
- }
-
- if (!clear) {
- callback(name, buffer, self[markSymbol], buffer.length);
- self[markSymbol] = 0;
- } else {
- callback(name, buffer, self[markSymbol], i);
- delete self[markSymbol];
- }
- };
-
- for (i = 0; i < len; i++) {
- c = buffer[i];
- switch (state) {
- case S.PARSER_UNINITIALIZED:
- return i;
- case S.START:
- index = 0;
- state = S.START_BOUNDARY;
- case S.START_BOUNDARY:
- if (index == boundary.length - 2) {
- if (c != CR) {
- return i;
- }
- index++;
- break;
- } else if (index - 1 == boundary.length - 2) {
- if (c != LF) {
- return i;
- }
- index = 0;
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
-
- if (c != boundary[index+2]) {
- return i;
- }
- index++;
- break;
- case S.HEADER_FIELD_START:
- state = S.HEADER_FIELD;
- mark('headerField');
- index = 0;
- case S.HEADER_FIELD:
- if (c == CR) {
- clear('headerField');
- state = S.HEADERS_ALMOST_DONE;
- break;
- }
-
- index++;
- if (c == HYPHEN) {
- break;
- }
-
- if (c == COLON) {
- if (index == 1) {
- // empty header field
- return i;
- }
- dataCallback('headerField', true);
- state = S.HEADER_VALUE_START;
- break;
- }
-
- cl = lower(c);
- if (cl < A || cl > Z) {
- return i;
- }
- break;
- case S.HEADER_VALUE_START:
- if (c == SPACE) {
- break;
- }
-
- mark('headerValue');
- state = S.HEADER_VALUE;
- case S.HEADER_VALUE:
- if (c == CR) {
- dataCallback('headerValue', true);
- callback('headerEnd');
- state = S.HEADER_VALUE_ALMOST_DONE;
- }
- break;
- case S.HEADER_VALUE_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
- state = S.HEADER_FIELD_START;
- break;
- case S.HEADERS_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
-
- callback('headersEnd');
- state = S.PART_DATA_START;
- break;
- case S.PART_DATA_START:
- state = S.PART_DATA
- mark('partData');
- case S.PART_DATA:
- prevIndex = index;
-
- if (index == 0) {
- // boyer-moore derrived algorithm to safely skip non-boundary data
- i += boundaryEnd;
- while (i < bufferLength && !(buffer[i] in boundaryChars)) {
- i += boundaryLength;
- }
- i -= boundaryEnd;
- c = buffer[i];
- }
-
- if (index < boundary.length) {
- if (boundary[index] == c) {
- if (index == 0) {
- dataCallback('partData', true);
- }
- index++;
- } else {
- index = 0;
- }
- } else if (index == boundary.length) {
- index++;
- if (c == CR) {
- // CR = part boundary
- flags |= F.PART_BOUNDARY;
- } else if (c == HYPHEN) {
- // HYPHEN = end boundary
- flags |= F.LAST_BOUNDARY;
- } else {
- index = 0;
- }
- } else if (index - 1 == boundary.length) {
- if (flags & F.PART_BOUNDARY) {
- index = 0;
- if (c == LF) {
- // unset the PART_BOUNDARY flag
- flags &= ~F.PART_BOUNDARY;
- callback('partEnd');
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
- } else if (flags & F.LAST_BOUNDARY) {
- if (c == HYPHEN) {
- callback('partEnd');
- callback('end');
- state = S.END;
- } else {
- index = 0;
- }
- } else {
- index = 0;
- }
- }
-
- if (index > 0) {
- // when matching a possible boundary, keep a lookbehind reference
- // in case it turns out to be a false lead
- lookbehind[index-1] = c;
- } else if (prevIndex > 0) {
- // if our boundary turned out to be rubbish, the captured lookbehind
- // belongs to partData
- callback('partData', lookbehind, 0, prevIndex);
- prevIndex = 0;
- mark('partData');
-
- // reconsider the current character even so it interrupted the sequence
- // it could be the beginning of a new sequence
- i--;
- }
-
- break;
- case S.END:
- break;
- default:
- return i;
- }
- }
-
- dataCallback('headerField');
- dataCallback('headerValue');
- dataCallback('partData');
-
- this.index = index;
- this.state = state;
- this.flags = flags;
-
- return len;
-};
-
-MultipartParser.prototype.end = function() {
- if (this.state != S.END) {
- return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
- }
-};
-
-MultipartParser.prototype.explain = function() {
- return 'state = ' + MultipartParser.stateToString(this.state);
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
deleted file mode 100644
index 63f109e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
+++ /dev/null
@@ -1,25 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-// This is a buffering parser, not quite as nice as the multipart one.
-// If I find time I'll rewrite this to be fully streaming as well
-var querystring = require('querystring');
-
-function QuerystringParser() {
- this.buffer = '';
-};
-exports.QuerystringParser = QuerystringParser;
-
-QuerystringParser.prototype.write = function(buffer) {
- this.buffer += buffer.toString('ascii');
- return buffer.length;
-};
-
-QuerystringParser.prototype.end = function() {
- var fields = querystring.parse(this.buffer);
- for (var field in fields) {
- this.onField(field, fields[field]);
- }
- this.buffer = '';
-
- this.onEnd();
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/util.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/util.js
deleted file mode 100644
index e9493e9..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/lib/util.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// Backwards compatibility ...
-try {
- module.exports = require('util');
-} catch (e) {
- module.exports = require('sys');
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/package.json b/examples/cross-domain/node_modules/connect/node_modules/formidable/package.json
deleted file mode 100644
index 64bbef8..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/package.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "formidable",
- "version": "1.0.9",
- "dependencies": {},
- "devDependencies": {
- "gently": "0.8.0",
- "findit": "0.1.1",
- "hashish": "0.0.4",
- "urun": "0.0.4",
- "utest": "0.0.3"
- },
- "directories": {
- "lib": "./lib"
- },
- "main": "./lib/index",
- "scripts": {
- "test": "make test"
- },
- "engines": {
- "node": "*"
- },
- "_id": "formidable@1.0.9",
- "optionalDependencies": {},
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "2cc70ada2b8cd07e429c1b48371f0426470ab827"
- },
- "_from": "formidable@1.0.9"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/common.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/common.js
deleted file mode 100644
index eb432ad..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/common.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var mysql = require('..');
-var path = require('path');
-
-var root = path.join(__dirname, '../');
-exports.dir = {
- root : root,
- lib : root + '/lib',
- fixture : root + '/test/fixture',
- tmp : root + '/test/tmp',
-};
-
-exports.port = 13532;
-
-exports.formidable = require('..');
-exports.assert = require('assert');
-
-exports.require = function(lib) {
- return require(exports.dir.lib + '/' + lib);
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
deleted file mode 100644
index e7a4785..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a text file with a funky name!
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
deleted file mode 100644
index 9b6903e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a plain text file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
deleted file mode 100644
index 3c9dbe3..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
+++ /dev/null
@@ -1,3 +0,0 @@
-* Opera does not allow submitting this file, it shows a warning to the
- user that the file could not be found instead. Tested in 9.8, 11.51 on OSX.
- Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com).
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
deleted file mode 100644
index 0bae449..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports['generic.http'] = [
- {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'},
-];
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
deleted file mode 100644
index eb76fdc..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var properFilename = 'funkyfilename.txt';
-
-function expect(filename) {
- return [
- {type: 'field', name: 'title', value: 'Weird filename'},
- {type: 'file', name: 'upload', filename: filename, fixture: properFilename},
- ];
-};
-
-var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-
-module.exports = {
- 'osx-chrome-13.http' : expect(webkit),
- 'osx-firefox-3.6.http' : expect(ffOrIe),
- 'osx-safari-5.http' : expect(webkit),
- 'xp-chrome-12.http' : expect(webkit),
- 'xp-ie-7.http' : expect(ffOrIe),
- 'xp-ie-8.http' : expect(ffOrIe),
- 'xp-safari-5.http' : expect(webkit),
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
deleted file mode 100644
index a476169..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
+++ /dev/null
@@ -1,72 +0,0 @@
-exports['rfc1867'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['noTrailing\r\n'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['emptyHeader'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- ': foo\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- expectError: true,
- };
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
deleted file mode 100644
index 66ad259..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
+++ /dev/null
@@ -1,89 +0,0 @@
-var hashish = require('hashish');
-var fs = require('fs');
-var findit = require('findit');
-var path = require('path');
-var http = require('http');
-var net = require('net');
-var assert = require('assert');
-
-var common = require('../common');
-var formidable = common.formidable;
-
-var server = http.createServer();
-server.listen(common.port, findFixtures);
-
-function findFixtures() {
- var fixtures = [];
- findit
- .sync(common.dir.fixture + '/js')
- .forEach(function(jsPath) {
- if (!/\.js$/.test(jsPath)) return;
-
- var group = path.basename(jsPath, '.js');
- hashish.forEach(require(jsPath), function(fixture, name) {
- fixtures.push({
- name : group + '/' + name,
- fixture : fixture,
- });
- });
- });
-
- testNext(fixtures);
-}
-
-function testNext(fixtures) {
- var fixture = fixtures.shift();
- if (!fixture) return server.close();
-
- var name = fixture.name;
- var fixture = fixture.fixture;
-
- uploadFixture(name, function(err, parts) {
- if (err) throw err;
-
- fixture.forEach(function(expectedPart, i) {
- var parsedPart = parts[i];
- assert.equal(parsedPart.type, expectedPart.type);
- assert.equal(parsedPart.name, expectedPart.name);
-
- if (parsedPart.type === 'file') {
- var filename = parsedPart.value.name;
- assert.equal(filename, expectedPart.filename);
- }
- });
-
- testNext(fixtures);
- });
-};
-
-function uploadFixture(name, cb) {
- server.once('request', function(req, res) {
- var form = new formidable.IncomingForm();
- form.uploadDir = common.dir.tmp;
- form.parse(req);
-
- function callback() {
- var realCallback = cb;
- cb = function() {};
- realCallback.apply(null, arguments);
- }
-
- var parts = [];
- form
- .on('error', callback)
- .on('fileBegin', function(name, value) {
- parts.push({type: 'file', name: name, value: value});
- })
- .on('field', function(name, value) {
- parts.push({type: 'field', name: name, value: value});
- })
- .on('end', function() {
- callback(null, parts);
- });
- });
-
- var socket = net.createConnection(common.port);
- var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
-
- file.pipe(socket);
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/common.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/common.js
deleted file mode 100644
index 2b98598..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/common.js
+++ /dev/null
@@ -1,24 +0,0 @@
-var path = require('path'),
- fs = require('fs');
-
-try {
- global.Gently = require('gently');
-} catch (e) {
- throw new Error('this test suite requires node-gently');
-}
-
-exports.lib = path.join(__dirname, '../../lib');
-
-global.GENTLY = new Gently();
-
-global.assert = require('assert');
-global.TEST_PORT = 13532;
-global.TEST_FIXTURES = path.join(__dirname, '../fixture');
-global.TEST_TMP = path.join(__dirname, '../tmp');
-
-// Stupid new feature in node that complains about gently attaching too many
-// listeners to process 'exit'. This is a workaround until I can think of a
-// better way to deal with this.
-if (process.setMaxListeners) {
- process.setMaxListeners(10000);
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
deleted file mode 100644
index 75232aa..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
+++ /dev/null
@@ -1,80 +0,0 @@
-var common = require('../common');
-var CHUNK_LENGTH = 10,
- multipartParser = require(common.lib + '/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- parser = new MultipartParser(),
- fixtures = require(TEST_FIXTURES + '/multipart'),
- Buffer = require('buffer').Buffer;
-
-Object.keys(fixtures).forEach(function(name) {
- var fixture = fixtures[name],
- buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')),
- offset = 0,
- chunk,
- nparsed,
-
- parts = [],
- part = null,
- headerField,
- headerValue,
- endCalled = '';
-
- parser.initWithBoundary(fixture.boundary);
- parser.onPartBegin = function() {
- part = {headers: {}, data: ''};
- parts.push(part);
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString('ascii', start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString('ascii', start, end);
- }
-
- parser.onHeaderEnd = function() {
- part.headers[headerField] = headerValue;
- headerField = '';
- headerValue = '';
- };
-
- parser.onPartData = function(b, start, end) {
- var str = b.toString('ascii', start, end);
- part.data += b.slice(start, end);
- }
-
- parser.onEnd = function() {
- endCalled = true;
- }
-
- buffer.write(fixture.raw, 'binary', 0);
-
- while (offset < buffer.length) {
- if (offset + CHUNK_LENGTH < buffer.length) {
- chunk = buffer.slice(offset, offset+CHUNK_LENGTH);
- } else {
- chunk = buffer.slice(offset, buffer.length);
- }
- offset = offset + CHUNK_LENGTH;
-
- nparsed = parser.write(chunk);
- if (nparsed != chunk.length) {
- if (fixture.expectError) {
- return;
- }
- puts('-- ERROR --');
- p(chunk.toString('ascii'));
- throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!');
- }
- }
-
- if (fixture.expectError) {
- throw new Error('expected parse error did not happen');
- }
-
- assert.ok(endCalled);
- assert.deepEqual(parts, fixture.parts);
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
deleted file mode 100644
index 52ceedb..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
+++ /dev/null
@@ -1,104 +0,0 @@
-var common = require('../common');
-var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
-
-var File = require(common.lib + '/file'),
- EventEmitter = require('events').EventEmitter,
- file,
- gently;
-
-function test(test) {
- gently = new Gently();
- file = new File();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.ok(file instanceof EventEmitter);
- assert.strictEqual(file.size, 0);
- assert.strictEqual(file.path, null);
- assert.strictEqual(file.name, null);
- assert.strictEqual(file.type, null);
- assert.strictEqual(file.lastModifiedDate, null);
-
- assert.strictEqual(file._writeStream, null);
-
- (function testSetProperties() {
- var file2 = new File({foo: 'bar'});
- assert.equal(file2.foo, 'bar');
- })();
-});
-
-test(function open() {
- var WRITE_STREAM;
- file.path = '/foo';
-
- gently.expect(WriteStreamStub, 'new', function (path) {
- WRITE_STREAM = this;
- assert.strictEqual(path, file.path);
- });
-
- file.open();
- assert.strictEqual(file._writeStream, WRITE_STREAM);
-});
-
-test(function write() {
- var BUFFER = {length: 10},
- CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'write', function (buffer, cb) {
- assert.strictEqual(buffer, BUFFER);
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.ok(file.lastModifiedDate instanceof Date);
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 10);
- });
-
- cb();
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 20);
- });
-
- cb();
- });
-
- file.write(BUFFER, CB);
-});
-
-test(function end() {
- var CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'end', function (cb) {
- gently.expect(file, 'emit', function (event) {
- assert.equal(event, 'end');
- });
-
- CB_STUB = gently.expect(function endCb() {
- });
-
- cb();
- });
-
- file.end(CB);
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
deleted file mode 100644
index b64df8b..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
+++ /dev/null
@@ -1,726 +0,0 @@
-var common = require('../common');
-var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'),
- QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'),
- EventEmitterStub = GENTLY.stub('events', 'EventEmitter'),
- FileStub = GENTLY.stub('./file');
-
-var formidable = require(common.lib + '/index'),
- IncomingForm = formidable.IncomingForm,
- events = require('events'),
- fs = require('fs'),
- path = require('path'),
- Buffer = require('buffer').Buffer,
- fixtures = require(TEST_FIXTURES + '/multipart'),
- form,
- gently;
-
-function test(test) {
- gently = new Gently();
- gently.expect(EventEmitterStub, 'call');
- form = new IncomingForm();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.strictEqual(form.error, null);
- assert.strictEqual(form.ended, false);
- assert.strictEqual(form.type, null);
- assert.strictEqual(form.headers, null);
- assert.strictEqual(form.keepExtensions, false);
- assert.strictEqual(form.uploadDir, '/tmp');
- assert.strictEqual(form.encoding, 'utf-8');
- assert.strictEqual(form.bytesReceived, null);
- assert.strictEqual(form.bytesExpected, null);
- assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024);
- assert.strictEqual(form._parser, null);
- assert.strictEqual(form._flushing, 0);
- assert.strictEqual(form._fieldsSize, 0);
- assert.ok(form instanceof EventEmitterStub);
- assert.equal(form.constructor.name, 'IncomingForm');
-
- (function testSimpleConstructor() {
- gently.expect(EventEmitterStub, 'call');
- var form = IncomingForm();
- assert.ok(form instanceof IncomingForm);
- })();
-
- (function testSimpleConstructorShortcut() {
- gently.expect(EventEmitterStub, 'call');
- var form = formidable();
- assert.ok(form instanceof IncomingForm);
- })();
-});
-
-test(function parse() {
- var REQ = {headers: {}}
- , emit = {};
-
- gently.expect(form, 'writeHeaders', function(headers) {
- assert.strictEqual(headers, REQ.headers);
- });
-
- var events = ['error', 'aborted', 'data', 'end'];
- gently.expect(REQ, 'on', events.length, function(event, fn) {
- assert.equal(event, events.shift());
- emit[event] = fn;
- return this;
- });
-
- form.parse(REQ);
-
- (function testPause() {
- gently.expect(REQ, 'pause');
- assert.strictEqual(form.pause(), true);
- })();
-
- (function testPauseCriticalException() {
- form.ended = false;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'pause', function() {
- throw ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- assert.strictEqual(form.pause(), false);
- })();
-
- (function testPauseHarmlessException() {
- form.ended = true;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'pause', function() {
- throw ERR;
- });
-
- assert.strictEqual(form.pause(), false);
- })();
-
- (function testResume() {
- gently.expect(REQ, 'resume');
- assert.strictEqual(form.resume(), true);
- })();
-
- (function testResumeCriticalException() {
- form.ended = false;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'resume', function() {
- throw ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- assert.strictEqual(form.resume(), false);
- })();
-
- (function testResumeHarmlessException() {
- form.ended = true;
-
- var ERR = new Error('dasdsa');
- gently.expect(REQ, 'resume', function() {
- throw ERR;
- });
-
- assert.strictEqual(form.resume(), false);
- })();
-
- (function testEmitError() {
- var ERR = new Error('something bad happened');
- gently.expect(form, '_error',function(err) {
- assert.strictEqual(err, ERR);
- });
- emit.error(ERR);
- })();
-
- (function testEmitAborted() {
- gently.expect(form, 'emit',function(event) {
- assert.equal(event, 'aborted');
- });
-
- emit.aborted();
- })();
-
-
- (function testEmitData() {
- var BUFFER = [1, 2, 3];
- gently.expect(form, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- });
- emit.data(BUFFER);
- })();
-
- (function testEmitEnd() {
- form._parser = {};
-
- (function testWithError() {
- var ERR = new Error('haha');
- gently.expect(form._parser, 'end', function() {
- return ERR;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.strictEqual(err, ERR);
- });
-
- emit.end();
- })();
-
- (function testWithoutError() {
- gently.expect(form._parser, 'end');
- emit.end();
- })();
-
- (function testAfterError() {
- form.error = true;
- emit.end();
- })();
- })();
-
- (function testWithCallback() {
- gently.expect(EventEmitterStub, 'call');
- var form = new IncomingForm(),
- REQ = {headers: {}},
- parseCalled = 0;
-
- gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 4, function() {
- return this;
- });
-
- gently.expect(form, 'on', 4, function(event, fn) {
- if (event == 'field') {
- fn('field1', 'foo');
- fn('field1', 'bar');
- fn('field2', 'nice');
- }
-
- if (event == 'file') {
- fn('file1', '1');
- fn('file1', '2');
- fn('file2', '3');
- }
-
- if (event == 'end') {
- fn();
- }
- return this;
- });
-
- form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) {
- assert.deepEqual(fields, {field1: 'bar', field2: 'nice'});
- assert.deepEqual(files, {file1: '2', file2: '3'});
- }));
-
- gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 4, function() {
- return this;
- });
-
- var ERR = new Error('test');
- gently.expect(form, 'on', 3, function(event, fn) {
- if (event == 'field') {
- fn('foo', 'bar');
- }
-
- if (event == 'error') {
- fn(ERR);
- gently.expect(form, 'on');
- }
- return this;
- });
-
- form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) {
- assert.strictEqual(err, ERR);
- assert.deepEqual(fields, {foo: 'bar'});
- }));
- })();
-});
-
-test(function pause() {
- assert.strictEqual(form.pause(), false);
-});
-
-test(function resume() {
- assert.strictEqual(form.resume(), false);
-});
-
-
-test(function writeHeaders() {
- var HEADERS = {};
- gently.expect(form, '_parseContentLength');
- gently.expect(form, '_parseContentType');
-
- form.writeHeaders(HEADERS);
- assert.strictEqual(form.headers, HEADERS);
-});
-
-test(function write() {
- var parser = {},
- BUFFER = [1, 2, 3];
-
- form._parser = parser;
- form.bytesExpected = 523423;
-
- (function testBasic() {
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, BUFFER.length);
- assert.equal(bytesExpected, form.bytesExpected);
- });
-
- gently.expect(parser, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- return buffer.length;
- });
-
- assert.equal(form.write(BUFFER), BUFFER.length);
- assert.equal(form.bytesReceived, BUFFER.length);
- })();
-
- (function testParserError() {
- gently.expect(form, 'emit');
-
- gently.expect(parser, 'write', function(buffer) {
- assert.strictEqual(buffer, BUFFER);
- return buffer.length - 1;
- });
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/parser error/i));
- });
-
- assert.equal(form.write(BUFFER), BUFFER.length - 1);
- assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length);
- })();
-
- (function testUninitialized() {
- delete form._parser;
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/unintialized parser/i));
- });
- form.write(BUFFER);
- })();
-});
-
-test(function parseContentType() {
- var HEADERS = {};
-
- form.headers = {'content-type': 'application/x-www-form-urlencoded'};
- gently.expect(form, '_initUrlencoded');
- form._parseContentType();
-
- // accept anything that has 'urlencoded' in it
- form.headers = {'content-type': 'broken-client/urlencoded-stupid'};
- gently.expect(form, '_initUrlencoded');
- form._parseContentType();
-
- var BOUNDARY = '---------------------------57814261102167618332366269';
- form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY};
-
- gently.expect(form, '_initMultipart', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
- form._parseContentType();
-
- (function testQuotedBoundary() {
- form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'};
-
- gently.expect(form, '_initMultipart', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
- form._parseContentType();
- })();
-
- (function testNoBoundary() {
- form.headers = {'content-type': 'multipart/form-data'};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/no multipart boundary/i));
- });
- form._parseContentType();
- })();
-
- (function testNoContentType() {
- form.headers = {};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/no content-type/i));
- });
- form._parseContentType();
- })();
-
- (function testUnknownContentType() {
- form.headers = {'content-type': 'invalid'};
-
- gently.expect(form, '_error', function(err) {
- assert.ok(err.message.match(/unknown content-type/i));
- });
- form._parseContentType();
- })();
-});
-
-test(function parseContentLength() {
- var HEADERS = {};
-
- form.headers = {};
- form._parseContentLength();
- assert.strictEqual(form.bytesReceived, null);
- assert.strictEqual(form.bytesExpected, null);
-
- form.headers['content-length'] = '8';
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, 0);
- assert.equal(bytesExpected, 8);
- });
- form._parseContentLength();
- assert.strictEqual(form.bytesReceived, 0);
- assert.strictEqual(form.bytesExpected, 8);
-
- // JS can be evil, lets make sure we are not
- form.headers['content-length'] = '08';
- gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
- assert.equal(event, 'progress');
- assert.equal(bytesReceived, 0);
- assert.equal(bytesExpected, 8);
- });
- form._parseContentLength();
- assert.strictEqual(form.bytesExpected, 8);
-});
-
-test(function _initMultipart() {
- var BOUNDARY = '123',
- PARSER;
-
- gently.expect(MultipartParserStub, 'new', function() {
- PARSER = this;
- });
-
- gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) {
- assert.equal(boundary, BOUNDARY);
- });
-
- form._initMultipart(BOUNDARY);
- assert.equal(form.type, 'multipart');
- assert.strictEqual(form._parser, PARSER);
-
- (function testRegularField() {
- var PART;
- gently.expect(EventEmitterStub, 'new', function() {
- PART = this;
- });
-
- gently.expect(form, 'onPart', function(part) {
- assert.strictEqual(part, PART);
- assert.deepEqual
- ( part.headers
- , { 'content-disposition': 'form-data; name="field1"'
- , 'foo': 'bar'
- }
- );
- assert.equal(part.name, 'field1');
-
- var strings = ['hello', ' world'];
- gently.expect(part, 'emit', 2, function(event, b) {
- assert.equal(event, 'data');
- assert.equal(b.toString(), strings.shift());
- });
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'end');
- });
- });
-
- PARSER.onPartBegin();
- PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10);
- PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19);
- PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14);
- PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24);
- PARSER.onHeaderEnd();
- PARSER.onHeaderField(new Buffer('foo'), 0, 3);
- PARSER.onHeaderValue(new Buffer('bar'), 0, 3);
- PARSER.onHeaderEnd();
- PARSER.onHeadersEnd();
- PARSER.onPartData(new Buffer('hello world'), 0, 5);
- PARSER.onPartData(new Buffer('hello world'), 5, 11);
- PARSER.onPartEnd();
- })();
-
- (function testFileField() {
- var PART;
- gently.expect(EventEmitterStub, 'new', function() {
- PART = this;
- });
-
- gently.expect(form, 'onPart', function(part) {
- assert.deepEqual
- ( part.headers
- , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'
- , 'content-type': 'text/plain'
- }
- );
- assert.equal(part.name, 'field2');
- assert.equal(part.filename, 'Sun"et.jpg');
- assert.equal(part.mime, 'text/plain');
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'data');
- assert.equal(b.toString(), '... contents of file1.txt ...');
- });
-
- gently.expect(part, 'emit', function(event, b) {
- assert.equal(event, 'end');
- });
- });
-
- PARSER.onPartBegin();
- PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19);
- PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85);
- PARSER.onHeaderEnd();
- PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12);
- PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10);
- PARSER.onHeaderEnd();
- PARSER.onHeadersEnd();
- PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29);
- PARSER.onPartEnd();
- })();
-
- (function testEnd() {
- gently.expect(form, '_maybeEnd');
- PARSER.onEnd();
- assert.ok(form.ended);
- })();
-});
-
-test(function _fileName() {
- // TODO
- return;
-});
-
-test(function _initUrlencoded() {
- var PARSER;
-
- gently.expect(QuerystringParserStub, 'new', function() {
- PARSER = this;
- });
-
- form._initUrlencoded();
- assert.equal(form.type, 'urlencoded');
- assert.strictEqual(form._parser, PARSER);
-
- (function testOnField() {
- var KEY = 'KEY', VAL = 'VAL';
- gently.expect(form, 'emit', function(field, key, val) {
- assert.equal(field, 'field');
- assert.equal(key, KEY);
- assert.equal(val, VAL);
- });
-
- PARSER.onField(KEY, VAL);
- })();
-
- (function testOnEnd() {
- gently.expect(form, '_maybeEnd');
-
- PARSER.onEnd();
- assert.equal(form.ended, true);
- })();
-});
-
-test(function _error() {
- var ERR = new Error('bla');
-
- gently.expect(form, 'pause');
- gently.expect(form, 'emit', function(event, err) {
- assert.equal(event, 'error');
- assert.strictEqual(err, ERR);
- });
-
- form._error(ERR);
- assert.strictEqual(form.error, ERR);
-
- // make sure _error only does its thing once
- form._error(ERR);
-});
-
-test(function onPart() {
- var PART = {};
- gently.expect(form, 'handlePart', function(part) {
- assert.strictEqual(part, PART);
- });
-
- form.onPart(PART);
-});
-
-test(function handlePart() {
- (function testUtf8Field() {
- var PART = new events.EventEmitter();
- PART.name = 'my_field';
-
- gently.expect(form, 'emit', function(event, field, value) {
- assert.equal(event, 'field');
- assert.equal(field, 'my_field');
- assert.equal(value, 'hello world: €');
- });
-
- form.handlePart(PART);
- PART.emit('data', new Buffer('hello'));
- PART.emit('data', new Buffer(' world: '));
- PART.emit('data', new Buffer([0xE2]));
- PART.emit('data', new Buffer([0x82, 0xAC]));
- PART.emit('end');
- })();
-
- (function testBinaryField() {
- var PART = new events.EventEmitter();
- PART.name = 'my_field2';
-
- gently.expect(form, 'emit', function(event, field, value) {
- assert.equal(event, 'field');
- assert.equal(field, 'my_field2');
- assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary'));
- });
-
- form.encoding = 'binary';
- form.handlePart(PART);
- PART.emit('data', new Buffer('hello'));
- PART.emit('data', new Buffer(' world: '));
- PART.emit('data', new Buffer([0xE2]));
- PART.emit('data', new Buffer([0x82, 0xAC]));
- PART.emit('end');
- })();
-
- (function testFieldSize() {
- form.maxFieldsSize = 8;
- var PART = new events.EventEmitter();
- PART.name = 'my_field';
-
- gently.expect(form, '_error', function(err) {
- assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data');
- });
-
- form.handlePart(PART);
- form._fieldsSize = 1;
- PART.emit('data', new Buffer(7));
- PART.emit('data', new Buffer(1));
- })();
-
- (function testFilePart() {
- var PART = new events.EventEmitter(),
- FILE = new events.EventEmitter(),
- PATH = '/foo/bar';
-
- PART.name = 'my_file';
- PART.filename = 'sweet.txt';
- PART.mime = 'sweet.txt';
-
- gently.expect(form, '_uploadPath', function(filename) {
- assert.equal(filename, PART.filename);
- return PATH;
- });
-
- gently.expect(FileStub, 'new', function(properties) {
- assert.equal(properties.path, PATH);
- assert.equal(properties.name, PART.filename);
- assert.equal(properties.type, PART.mime);
- FILE = this;
-
- gently.expect(form, 'emit', function (event, field, file) {
- assert.equal(event, 'fileBegin');
- assert.strictEqual(field, PART.name);
- assert.strictEqual(file, FILE);
- });
-
- gently.expect(FILE, 'open');
- });
-
- form.handlePart(PART);
- assert.equal(form._flushing, 1);
-
- var BUFFER;
- gently.expect(form, 'pause');
- gently.expect(FILE, 'write', function(buffer, cb) {
- assert.strictEqual(buffer, BUFFER);
- gently.expect(form, 'resume');
- // @todo handle cb(new Err)
- cb();
- });
-
- PART.emit('data', BUFFER = new Buffer('test'));
-
- gently.expect(FILE, 'end', function(cb) {
- gently.expect(form, 'emit', function(event, field, file) {
- assert.equal(event, 'file');
- assert.strictEqual(file, FILE);
- });
-
- gently.expect(form, '_maybeEnd');
-
- cb();
- assert.equal(form._flushing, 0);
- });
-
- PART.emit('end');
- })();
-});
-
-test(function _uploadPath() {
- (function testUniqueId() {
- var UUID_A, UUID_B;
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
- assert.equal(uploadDir, form.uploadDir);
- UUID_A = uuid;
- });
- form._uploadPath();
-
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
- UUID_B = uuid;
- });
- form._uploadPath();
-
- assert.notEqual(UUID_A, UUID_B);
- })();
-
- (function testFileExtension() {
- form.keepExtensions = true;
- var FILENAME = 'foo.jpg',
- EXT = '.bar';
-
- gently.expect(GENTLY.hijacked.path, 'extname', function(filename) {
- assert.equal(filename, FILENAME);
- gently.restore(path, 'extname');
-
- return EXT;
- });
-
- gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) {
- assert.equal(path.extname(name), EXT);
- });
- form._uploadPath(FILENAME);
- })();
-});
-
-test(function _maybeEnd() {
- gently.expect(form, 'emit', 0);
- form._maybeEnd();
-
- form.ended = true;
- form._flushing = 1;
- form._maybeEnd();
-
- gently.expect(form, 'emit', function(event) {
- assert.equal(event, 'end');
- });
-
- form.ended = true;
- form._flushing = 0;
- form._maybeEnd();
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
deleted file mode 100644
index d8dc968..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var common = require('../common');
-var multipartParser = require(common.lib + '/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- events = require('events'),
- Buffer = require('buffer').Buffer,
- parser;
-
-function test(test) {
- parser = new MultipartParser();
- test();
-}
-
-test(function constructor() {
- assert.equal(parser.boundary, null);
- assert.equal(parser.state, 0);
- assert.equal(parser.flags, 0);
- assert.equal(parser.boundaryChars, null);
- assert.equal(parser.index, null);
- assert.equal(parser.lookbehind, null);
- assert.equal(parser.constructor.name, 'MultipartParser');
-});
-
-test(function initWithBoundary() {
- var boundary = 'abc';
- parser.initWithBoundary(boundary);
- assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]);
- assert.equal(parser.state, multipartParser.START);
-
- assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true});
-});
-
-test(function parserError() {
- var boundary = 'abc',
- buffer = new Buffer(5);
-
- parser.initWithBoundary(boundary);
- buffer.write('--ad', 'ascii', 0);
- assert.equal(parser.write(buffer), 3);
-});
-
-test(function end() {
- (function testError() {
- assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain());
- })();
-
- (function testRegular() {
- parser.state = multipartParser.END;
- assert.strictEqual(parser.end(), undefined);
- })();
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
deleted file mode 100644
index 54d3e2d..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var common = require('../common');
-var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser,
- Buffer = require('buffer').Buffer,
- gently,
- parser;
-
-function test(test) {
- gently = new Gently();
- parser = new QuerystringParser();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.equal(parser.buffer, '');
- assert.equal(parser.constructor.name, 'QuerystringParser');
-});
-
-test(function write() {
- var a = new Buffer('a=1');
- assert.equal(parser.write(a), a.length);
-
- var b = new Buffer('&b=2');
- parser.write(b);
- assert.equal(parser.buffer, a + b);
-});
-
-test(function end() {
- var FIELDS = {a: ['b', {c: 'd'}], e: 'f'};
-
- gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) {
- assert.equal(str, parser.buffer);
- return FIELDS;
- });
-
- gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) {
- assert.deepEqual(FIELDS[key], val);
- });
-
- gently.expect(parser, 'onEnd');
-
- parser.buffer = 'my buffer';
- parser.end();
- assert.equal(parser.buffer, '');
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
deleted file mode 100644
index fcfdb94..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var common = require('../common');
-var BOUNDARY = '---------------------------10102754414578508781458777923',
- FIXTURE = TEST_FIXTURES+'/multi_video.upload',
- fs = require('fs'),
- util = require(common.lib + '/util'),
- http = require('http'),
- formidable = require(common.lib + '/index'),
- server = http.createServer();
-
-server.on('request', function(req, res) {
- var form = new formidable.IncomingForm(),
- uploads = {};
-
- form.uploadDir = TEST_TMP;
- form.parse(req);
-
- form
- .on('fileBegin', function(field, file) {
- assert.equal(field, 'upload');
-
- var tracker = {file: file, progress: [], ended: false};
- uploads[file.filename] = tracker;
- file
- .on('progress', function(bytesReceived) {
- tracker.progress.push(bytesReceived);
- assert.equal(bytesReceived, file.length);
- })
- .on('end', function() {
- tracker.ended = true;
- });
- })
- .on('field', function(field, value) {
- assert.equal(field, 'title');
- assert.equal(value, '');
- })
- .on('file', function(field, file) {
- assert.equal(field, 'upload');
- assert.strictEqual(uploads[file.filename].file, file);
- })
- .on('end', function() {
- assert.ok(uploads['shortest_video.flv']);
- assert.ok(uploads['shortest_video.flv'].ended);
- assert.ok(uploads['shortest_video.flv'].progress.length > 3);
- assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length);
- assert.ok(uploads['shortest_video.mp4']);
- assert.ok(uploads['shortest_video.mp4'].ended);
- assert.ok(uploads['shortest_video.mp4'].progress.length > 3);
-
- server.close();
- res.writeHead(200);
- res.end('good');
- });
-});
-
-server.listen(TEST_PORT, function() {
- var client = http.createClient(TEST_PORT),
- stat = fs.statSync(FIXTURE),
- headers = {
- 'content-type': 'multipart/form-data; boundary='+BOUNDARY,
- 'content-length': stat.size,
- }
- request = client.request('POST', '/', headers),
- fixture = new fs.ReadStream(FIXTURE);
-
- fixture
- .on('data', function(b) {
- request.write(b);
- })
- .on('end', function() {
- request.end();
- });
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/run.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/run.js
deleted file mode 100755
index 50b2361..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/run.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require('urun')(__dirname)
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
deleted file mode 100644
index bcf61d7..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
+++ /dev/null
@@ -1,63 +0,0 @@
-var common = require('../common');
-var test = require('utest');
-var assert = common.assert;
-var IncomingForm = common.require('incoming_form').IncomingForm;
-var path = require('path');
-
-var from;
-test('IncomingForm', {
- before: function() {
- form = new IncomingForm();
- },
-
- '#_fileName with regular characters': function() {
- var filename = 'foo.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'foo.txt');
- },
-
- '#_fileName with unescaped quote': function() {
- var filename = 'my".txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
- },
-
- '#_fileName with escaped quote': function() {
- var filename = 'my%22.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
- },
-
- '#_fileName with bad quote and additional sub-header': function() {
- var filename = 'my".txt';
- var header = makeHeader(filename) + '; foo="bar"';
- assert.equal(form._fileName(header), filename);
- },
-
- '#_fileName with semicolon': function() {
- var filename = 'my;.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my;.txt');
- },
-
- '#_fileName with utf8 character': function() {
- var filename = 'my&#9731;.txt';
- assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt');
- },
-
- '#_uploadPath strips harmful characters from extension when keepExtensions': function() {
- form.keepExtensions = true;
-
- var ext = path.extname(form._uploadPath('fine.jpg?foo=bar'));
- assert.equal(ext, '.jpg');
-
- var ext = path.extname(form._uploadPath('fine?foo=bar'));
- assert.equal(ext, '');
-
- var ext = path.extname(form._uploadPath('super.cr2+dsad'));
- assert.equal(ext, '.cr2');
-
- var ext = path.extname(form._uploadPath('super.bar'));
- assert.equal(ext, '.bar');
- },
-});
-
-function makeHeader(filename) {
- return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"';
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/formidable/tool/record.js b/examples/cross-domain/node_modules/connect/node_modules/formidable/tool/record.js
deleted file mode 100644
index 9f1cef8..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/formidable/tool/record.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var http = require('http');
-var fs = require('fs');
-var connections = 0;
-
-var server = http.createServer(function(req, res) {
- var socket = req.socket;
- console.log('Request: %s %s -> %s', req.method, req.url, socket.filename);
-
- req.on('end', function() {
- if (req.url !== '/') {
- res.end(JSON.stringify({
- method: req.method,
- url: req.url,
- filename: socket.filename,
- }));
- return;
- }
-
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/upload" enctype="multipart/form-data" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="file" name="upload" multiple="multiple"><br>'+
- '<input type="submit" value="Upload">'+
- '</form>'
- );
- });
-});
-
-server.on('connection', function(socket) {
- connections++;
-
- socket.id = connections;
- socket.filename = 'connection-' + socket.id + '.http';
- socket.file = fs.createWriteStream(socket.filename);
- socket.pipe(socket.file);
-
- console.log('--> %s', socket.filename);
- socket.on('close', function() {
- console.log('<-- %s', socket.filename);
- });
-});
-
-var port = process.env.PORT || 8080;
-server.listen(port, function() {
- console.log('Recording connections on port %s', port);
-});
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/LICENSE b/examples/cross-domain/node_modules/connect/node_modules/mime/LICENSE
deleted file mode 100644
index 451fc45..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/README.md b/examples/cross-domain/node_modules/connect/node_modules/mime/README.md
deleted file mode 100644
index a157de1..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# mime
-
-Support for mapping between file extensions and MIME types. This module uses the latest version of the Apache "mime.types" file (maps over 620 types to 800+ extensions). It is also trivially easy to add your own types and extensions, should you need to do that.
-
-## Install
-
-Install with [npm](http://github.com/isaacs/npm):
-
- npm install mime
-
-## API - Queries
-
-### mime.lookup(path)
-Get the mime type associated with a file. This is method is case-insensitive. Everything in path up to and including the last '/' or '.' is ignored, so you can pass it paths, filenames, or extensions, like so:
-
- var mime = require('mime');
-
- mime.lookup('/path/to/file.txt'); // => 'text/plain'
- mime.lookup('file.txt'); // => 'text/plain'
- mime.lookup('.txt'); // => 'text/plain'
- mime.lookup('htm'); // => 'text/html'
-
-### mime.extension(type) - lookup the default extension for type
-
- mime.extension('text/html'); // => 'html'
- mime.extension('application/octet-stream'); // => 'bin'
-
-### mime.charsets.lookup() - map mime-type to charset
-
- mime.charsets.lookup('text/plain'); // => 'UTF-8'
-
-(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
-
-## API - Customizing
-
-The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types).
-### mime.define() - Add custom mime/extension mappings
-
- mime.define({
- 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
- 'application/x-my-type': ['x-mt', 'x-mtt'],
- // etc ...
- });
-
- mime.lookup('x-sft'); // => 'text/x-some-format'
- mime.extension('text/x-some-format'); // => 'x-sf'
-
-### mime.load(filepath) - Load mappings from an Apache ".types" format file
-
- mime.load('./my_project.types');
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/mime.js b/examples/cross-domain/node_modules/connect/node_modules/mime/mime.js
deleted file mode 100644
index 5fac753..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/mime.js
+++ /dev/null
@@ -1,92 +0,0 @@
-var path = require('path'),
- fs = require('fs');
-
-var mime = module.exports = {
- /** Map of extension to mime type */
- types: {},
-
- /** Map of mime type to extension */
- extensions :{},
-
- /**
- * Define mimetype -> extension mappings. Each key is a mime-type that maps
- * to an array of extensions associated with the type. The first extension is
- * used as the default extension for the type.
- *
- * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
- *
- * @param map (Object) type definitions
- */
- define: function(map) {
- for (var type in map) {
- var exts = map[type];
-
- for (var i = 0; i < exts.length; i++) {
- mime.types[exts[i]] = type;
- }
-
- // Default extension is the first one we encounter
- if (!mime.extensions[type]) {
- mime.extensions[type] = exts[0];
- }
- }
- },
-
- /**
- * Load an Apache2-style ".types" file
- *
- * This may be called multiple times (it's expected). Where files declare
- * overlapping types/extensions, the last file wins.
- *
- * @param file (String) path of file to load.
- */
- load: function(file) {
- // Read file and split into lines
- var map = {},
- content = fs.readFileSync(file, 'ascii'),
- lines = content.split(/[\r\n]+/);
-
- lines.forEach(function(line, lineno) {
- // Clean up whitespace/comments, and split into fields
- var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
- map[fields.shift()] = fields;
- });
-
- mime.define(map);
- },
-
- /**
- * Lookup a mime type based on extension
- */
- lookup: function(path, fallback) {
- var ext = path.replace(/.*[\.\/]/, '').toLowerCase();
- return mime.types[ext] || fallback || mime.default_type;
- },
-
- /**
- * Return file extension associated with a mime type
- */
- extension: function(mimeType) {
- return mime.extensions[mimeType];
- },
-
- /**
- * Lookup a charset based on mime type.
- */
- charsets: {
- lookup: function (mimeType, fallback) {
- // Assume text types are utf8. Modify mime logic as needed.
- return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
- }
- }
-};
-
-// Load our local copy of
-// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
-mime.load(path.join(__dirname, 'types/mime.types'));
-
-// Overlay enhancements submitted by the node.js community
-mime.load(path.join(__dirname, 'types/node.types'));
-
-// Set the default type
-mime.default_type = mime.types.bin;
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/package.json b/examples/cross-domain/node_modules/connect/node_modules/mime/package.json
deleted file mode 100644
index 515e9bf..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "author": {
- "name": "Robert Kieffer",
- "email": "robert@broofa.com",
- "url": "http://github.com/broofa"
- },
- "contributors": [
- {
- "name": "Benjamin Thomas",
- "email": "benjamin@benjaminthomas.org",
- "url": "http://github.com/bentomas"
- }
- ],
- "dependencies": {},
- "description": "A comprehensive library for mime-type mapping",
- "devDependencies": {
- "async_testing": ""
- },
- "keywords": [
- "util",
- "mime"
- ],
- "main": "mime.js",
- "name": "mime",
- "repository": {
- "url": "git://github.com/bentomas/node-mime.git",
- "type": "git"
- },
- "version": "1.2.4",
- "_id": "mime@1.2.4",
- "optionalDependencies": {},
- "engines": {
- "node": "*"
- },
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "fc4d2c6587666e52846a7503c9ed11d773439249"
- },
- "_from": "mime@1.2.4"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/test.js b/examples/cross-domain/node_modules/connect/node_modules/mime/test.js
deleted file mode 100644
index b904895..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/test.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Requires the async_testing module
- *
- * Usage: node test.js
- */
-var mime = require('./mime');
-exports["test mime lookup"] = function(test) {
- // easy
- test.equal('text/plain', mime.lookup('text.txt'));
-
- // hidden file or multiple periods
- test.equal('text/plain', mime.lookup('.text.txt'));
-
- // just an extension
- test.equal('text/plain', mime.lookup('.txt'));
-
- // just an extension without a dot
- test.equal('text/plain', mime.lookup('txt'));
-
- // default
- test.equal('application/octet-stream', mime.lookup('text.nope'));
-
- // fallback
- test.equal('fallback', mime.lookup('text.fallback', 'fallback'));
-
- test.finish();
-};
-
-exports["test extension lookup"] = function(test) {
- // easy
- test.equal('txt', mime.extension(mime.types.text));
- test.equal('html', mime.extension(mime.types.htm));
- test.equal('bin', mime.extension('application/octet-stream'));
-
- test.finish();
-};
-
-exports["test mime lookup uppercase"] = function(test) {
- // easy
- test.equal('text/plain', mime.lookup('TEXT.TXT'));
-
- // just an extension
- test.equal('text/plain', mime.lookup('.TXT'));
-
- // just an extension without a dot
- test.equal('text/plain', mime.lookup('TXT'));
-
- // default
- test.equal('application/octet-stream', mime.lookup('TEXT.NOPE'));
-
- // fallback
- test.equal('fallback', mime.lookup('TEXT.FALLBACK', 'fallback'));
-
- test.finish();
-};
-
-exports["test custom types"] = function(test) {
- test.equal('application/octet-stream', mime.lookup('file.buffer'));
- test.equal('audio/mp4', mime.lookup('file.m4a'));
-
- test.finish();
-};
-
-exports["test charset lookup"] = function(test) {
- // easy
- test.equal('UTF-8', mime.charsets.lookup('text/plain'));
-
- // none
- test.ok(typeof mime.charsets.lookup(mime.types.js) == 'undefined');
-
- // fallback
- test.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
-
- test.finish();
-};
-
-if (module == require.main) {
- require('async_testing').run(__filename, process.ARGV);
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/types/mime.types b/examples/cross-domain/node_modules/connect/node_modules/mime/types/mime.types
deleted file mode 100644
index 6a90929..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/types/mime.types
+++ /dev/null
@@ -1,1479 +0,0 @@
-# This file maps Internet media types to unique file extension(s).
-# Although created for httpd, this file is used by many software systems
-# and has been placed in the public domain for unlimited redisribution.
-#
-# The table below contains both registered and (common) unregistered types.
-# A type that has no unique extension can be ignored -- they are listed
-# here to guide configurations toward known types and to make it easier to
-# identify "new" types. File extensions are also commonly used to indicate
-# content languages and encodings, so choose them carefully.
-#
-# Internet media types should be registered as described in RFC 4288.
-# The registry is at <http://www.iana.org/assignments/media-types/>.
-#
-# MIME type (lowercased) Extensions
-# ============================================ ==========
-# application/1d-interleaved-parityfec
-# application/3gpp-ims+xml
-# application/activemessage
-application/andrew-inset ez
-# application/applefile
-application/applixware aw
-application/atom+xml atom
-application/atomcat+xml atomcat
-# application/atomicmail
-application/atomsvc+xml atomsvc
-# application/auth-policy+xml
-# application/batch-smtp
-# application/beep+xml
-# application/cals-1840
-application/ccxml+xml ccxml
-application/cdmi-capability cdmia
-application/cdmi-container cdmic
-application/cdmi-domain cdmid
-application/cdmi-object cdmio
-application/cdmi-queue cdmiq
-# application/cea-2018+xml
-# application/cellml+xml
-# application/cfw
-# application/cnrp+xml
-# application/commonground
-# application/conference-info+xml
-# application/cpl+xml
-# application/csta+xml
-# application/cstadata+xml
-application/cu-seeme cu
-# application/cybercash
-application/davmount+xml davmount
-# application/dca-rft
-# application/dec-dx
-# application/dialog-info+xml
-# application/dicom
-# application/dns
-# application/dskpp+xml
-application/dssc+der dssc
-application/dssc+xml xdssc
-# application/dvcs
-application/ecmascript ecma
-# application/edi-consent
-# application/edi-x12
-# application/edifact
-application/emma+xml emma
-# application/epp+xml
-application/epub+zip epub
-# application/eshop
-# application/example
-application/exi exi
-# application/fastinfoset
-# application/fastsoap
-# application/fits
-application/font-tdpfr pfr
-# application/framework-attributes+xml
-# application/h224
-# application/held+xml
-# application/http
-application/hyperstudio stk
-# application/ibe-key-request+xml
-# application/ibe-pkg-reply+xml
-# application/ibe-pp-data
-# application/iges
-# application/im-iscomposing+xml
-# application/index
-# application/index.cmd
-# application/index.obj
-# application/index.response
-# application/index.vnd
-# application/iotp
-application/ipfix ipfix
-# application/ipp
-# application/isup
-application/java-archive jar
-application/java-serialized-object ser
-application/java-vm class
-application/javascript js
-application/json json
-# application/kpml-request+xml
-# application/kpml-response+xml
-application/lost+xml lostxml
-application/mac-binhex40 hqx
-application/mac-compactpro cpt
-# application/macwriteii
-application/mads+xml mads
-application/marc mrc
-application/marcxml+xml mrcx
-application/mathematica ma nb mb
-# application/mathml-content+xml
-# application/mathml-presentation+xml
-application/mathml+xml mathml
-# application/mbms-associated-procedure-description+xml
-# application/mbms-deregister+xml
-# application/mbms-envelope+xml
-# application/mbms-msk+xml
-# application/mbms-msk-response+xml
-# application/mbms-protection-description+xml
-# application/mbms-reception-report+xml
-# application/mbms-register+xml
-# application/mbms-register-response+xml
-# application/mbms-user-service-description+xml
-application/mbox mbox
-# application/media_control+xml
-application/mediaservercontrol+xml mscml
-application/metalink4+xml meta4
-application/mets+xml mets
-# application/mikey
-application/mods+xml mods
-# application/moss-keys
-# application/moss-signature
-# application/mosskey-data
-# application/mosskey-request
-application/mp21 m21 mp21
-application/mp4 mp4s
-# application/mpeg4-generic
-# application/mpeg4-iod
-# application/mpeg4-iod-xmt
-# application/msc-ivr+xml
-# application/msc-mixer+xml
-application/msword doc dot
-application/mxf mxf
-# application/nasdata
-# application/news-checkgroups
-# application/news-groupinfo
-# application/news-transmission
-# application/nss
-# application/ocsp-request
-# application/ocsp-response
-application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy
-application/oda oda
-application/oebps-package+xml opf
-application/ogg ogx
-application/onenote onetoc onetoc2 onetmp onepkg
-# application/parityfec
-application/patch-ops-error+xml xer
-application/pdf pdf
-application/pgp-encrypted pgp
-# application/pgp-keys
-application/pgp-signature asc sig
-application/pics-rules prf
-# application/pidf+xml
-# application/pidf-diff+xml
-application/pkcs10 p10
-application/pkcs7-mime p7m p7c
-application/pkcs7-signature p7s
-application/pkcs8 p8
-application/pkix-attr-cert ac
-application/pkix-cert cer
-application/pkix-crl crl
-application/pkix-pkipath pkipath
-application/pkixcmp pki
-application/pls+xml pls
-# application/poc-settings+xml
-application/postscript ai eps ps
-# application/prs.alvestrand.titrax-sheet
-application/prs.cww cww
-# application/prs.nprend
-# application/prs.plucker
-# application/prs.rdf-xml-crypt
-# application/prs.xsf+xml
-application/pskc+xml pskcxml
-# application/qsig
-application/rdf+xml rdf
-application/reginfo+xml rif
-application/relax-ng-compact-syntax rnc
-# application/remote-printing
-application/resource-lists+xml rl
-application/resource-lists-diff+xml rld
-# application/riscos
-# application/rlmi+xml
-application/rls-services+xml rs
-application/rsd+xml rsd
-application/rss+xml rss
-application/rtf rtf
-# application/rtx
-# application/samlassertion+xml
-# application/samlmetadata+xml
-application/sbml+xml sbml
-application/scvp-cv-request scq
-application/scvp-cv-response scs
-application/scvp-vp-request spq
-application/scvp-vp-response spp
-application/sdp sdp
-# application/set-payment
-application/set-payment-initiation setpay
-# application/set-registration
-application/set-registration-initiation setreg
-# application/sgml
-# application/sgml-open-catalog
-application/shf+xml shf
-# application/sieve
-# application/simple-filter+xml
-# application/simple-message-summary
-# application/simplesymbolcontainer
-# application/slate
-# application/smil
-application/smil+xml smi smil
-# application/soap+fastinfoset
-# application/soap+xml
-application/sparql-query rq
-application/sparql-results+xml srx
-# application/spirits-event+xml
-application/srgs gram
-application/srgs+xml grxml
-application/sru+xml sru
-application/ssml+xml ssml
-# application/tamp-apex-update
-# application/tamp-apex-update-confirm
-# application/tamp-community-update
-# application/tamp-community-update-confirm
-# application/tamp-error
-# application/tamp-sequence-adjust
-# application/tamp-sequence-adjust-confirm
-# application/tamp-status-query
-# application/tamp-status-response
-# application/tamp-update
-# application/tamp-update-confirm
-application/tei+xml tei teicorpus
-application/thraud+xml tfi
-# application/timestamp-query
-# application/timestamp-reply
-application/timestamped-data tsd
-# application/tve-trigger
-# application/ulpfec
-# application/vemmi
-# application/vividence.scriptfile
-# application/vnd.3gpp.bsf+xml
-application/vnd.3gpp.pic-bw-large plb
-application/vnd.3gpp.pic-bw-small psb
-application/vnd.3gpp.pic-bw-var pvb
-# application/vnd.3gpp.sms
-# application/vnd.3gpp2.bcmcsinfo+xml
-# application/vnd.3gpp2.sms
-application/vnd.3gpp2.tcap tcap
-application/vnd.3m.post-it-notes pwn
-application/vnd.accpac.simply.aso aso
-application/vnd.accpac.simply.imp imp
-application/vnd.acucobol acu
-application/vnd.acucorp atc acutc
-application/vnd.adobe.air-application-installer-package+zip air
-application/vnd.adobe.fxp fxp fxpl
-# application/vnd.adobe.partial-upload
-application/vnd.adobe.xdp+xml xdp
-application/vnd.adobe.xfdf xfdf
-# application/vnd.aether.imp
-# application/vnd.ah-barcode
-application/vnd.ahead.space ahead
-application/vnd.airzip.filesecure.azf azf
-application/vnd.airzip.filesecure.azs azs
-application/vnd.amazon.ebook azw
-application/vnd.americandynamics.acc acc
-application/vnd.amiga.ami ami
-# application/vnd.amundsen.maze+xml
-application/vnd.android.package-archive apk
-application/vnd.anser-web-certificate-issue-initiation cii
-application/vnd.anser-web-funds-transfer-initiation fti
-application/vnd.antix.game-component atx
-application/vnd.apple.installer+xml mpkg
-application/vnd.apple.mpegurl m3u8
-# application/vnd.arastra.swi
-application/vnd.aristanetworks.swi swi
-application/vnd.audiograph aep
-# application/vnd.autopackage
-# application/vnd.avistar+xml
-application/vnd.blueice.multipass mpm
-# application/vnd.bluetooth.ep.oob
-application/vnd.bmi bmi
-application/vnd.businessobjects rep
-# application/vnd.cab-jscript
-# application/vnd.canon-cpdl
-# application/vnd.canon-lips
-# application/vnd.cendio.thinlinc.clientconf
-application/vnd.chemdraw+xml cdxml
-application/vnd.chipnuts.karaoke-mmd mmd
-application/vnd.cinderella cdy
-# application/vnd.cirpack.isdn-ext
-application/vnd.claymore cla
-application/vnd.cloanto.rp9 rp9
-application/vnd.clonk.c4group c4g c4d c4f c4p c4u
-application/vnd.cluetrust.cartomobile-config c11amc
-application/vnd.cluetrust.cartomobile-config-pkg c11amz
-# application/vnd.commerce-battelle
-application/vnd.commonspace csp
-application/vnd.contact.cmsg cdbcmsg
-application/vnd.cosmocaller cmc
-application/vnd.crick.clicker clkx
-application/vnd.crick.clicker.keyboard clkk
-application/vnd.crick.clicker.palette clkp
-application/vnd.crick.clicker.template clkt
-application/vnd.crick.clicker.wordbank clkw
-application/vnd.criticaltools.wbs+xml wbs
-application/vnd.ctc-posml pml
-# application/vnd.ctct.ws+xml
-# application/vnd.cups-pdf
-# application/vnd.cups-postscript
-application/vnd.cups-ppd ppd
-# application/vnd.cups-raster
-# application/vnd.cups-raw
-application/vnd.curl.car car
-application/vnd.curl.pcurl pcurl
-# application/vnd.cybank
-application/vnd.data-vision.rdz rdz
-application/vnd.dece.data uvf uvvf uvd uvvd
-application/vnd.dece.ttml+xml uvt uvvt
-application/vnd.dece.unspecified uvx uvvx
-application/vnd.denovo.fcselayout-link fe_launch
-# application/vnd.dir-bi.plate-dl-nosuffix
-application/vnd.dna dna
-application/vnd.dolby.mlp mlp
-# application/vnd.dolby.mobile.1
-# application/vnd.dolby.mobile.2
-application/vnd.dpgraph dpg
-application/vnd.dreamfactory dfac
-application/vnd.dvb.ait ait
-# application/vnd.dvb.dvbj
-# application/vnd.dvb.esgcontainer
-# application/vnd.dvb.ipdcdftnotifaccess
-# application/vnd.dvb.ipdcesgaccess
-# application/vnd.dvb.ipdcesgaccess2
-# application/vnd.dvb.ipdcesgpdd
-# application/vnd.dvb.ipdcroaming
-# application/vnd.dvb.iptv.alfec-base
-# application/vnd.dvb.iptv.alfec-enhancement
-# application/vnd.dvb.notif-aggregate-root+xml
-# application/vnd.dvb.notif-container+xml
-# application/vnd.dvb.notif-generic+xml
-# application/vnd.dvb.notif-ia-msglist+xml
-# application/vnd.dvb.notif-ia-registration-request+xml
-# application/vnd.dvb.notif-ia-registration-response+xml
-# application/vnd.dvb.notif-init+xml
-# application/vnd.dvb.pfr
-application/vnd.dvb.service svc
-# application/vnd.dxr
-application/vnd.dynageo geo
-# application/vnd.easykaraoke.cdgdownload
-# application/vnd.ecdis-update
-application/vnd.ecowin.chart mag
-# application/vnd.ecowin.filerequest
-# application/vnd.ecowin.fileupdate
-# application/vnd.ecowin.series
-# application/vnd.ecowin.seriesrequest
-# application/vnd.ecowin.seriesupdate
-# application/vnd.emclient.accessrequest+xml
-application/vnd.enliven nml
-application/vnd.epson.esf esf
-application/vnd.epson.msf msf
-application/vnd.epson.quickanime qam
-application/vnd.epson.salt slt
-application/vnd.epson.ssf ssf
-# application/vnd.ericsson.quickcall
-application/vnd.eszigno3+xml es3 et3
-# application/vnd.etsi.aoc+xml
-# application/vnd.etsi.cug+xml
-# application/vnd.etsi.iptvcommand+xml
-# application/vnd.etsi.iptvdiscovery+xml
-# application/vnd.etsi.iptvprofile+xml
-# application/vnd.etsi.iptvsad-bc+xml
-# application/vnd.etsi.iptvsad-cod+xml
-# application/vnd.etsi.iptvsad-npvr+xml
-# application/vnd.etsi.iptvservice+xml
-# application/vnd.etsi.iptvsync+xml
-# application/vnd.etsi.iptvueprofile+xml
-# application/vnd.etsi.mcid+xml
-# application/vnd.etsi.overload-control-policy-dataset+xml
-# application/vnd.etsi.sci+xml
-# application/vnd.etsi.simservs+xml
-# application/vnd.etsi.tsl+xml
-# application/vnd.etsi.tsl.der
-# application/vnd.eudora.data
-application/vnd.ezpix-album ez2
-application/vnd.ezpix-package ez3
-# application/vnd.f-secure.mobile
-application/vnd.fdf fdf
-application/vnd.fdsn.mseed mseed
-application/vnd.fdsn.seed seed dataless
-# application/vnd.ffsns
-# application/vnd.fints
-application/vnd.flographit gph
-application/vnd.fluxtime.clip ftc
-# application/vnd.font-fontforge-sfd
-application/vnd.framemaker fm frame maker book
-application/vnd.frogans.fnc fnc
-application/vnd.frogans.ltf ltf
-application/vnd.fsc.weblaunch fsc
-application/vnd.fujitsu.oasys oas
-application/vnd.fujitsu.oasys2 oa2
-application/vnd.fujitsu.oasys3 oa3
-application/vnd.fujitsu.oasysgp fg5
-application/vnd.fujitsu.oasysprs bh2
-# application/vnd.fujixerox.art-ex
-# application/vnd.fujixerox.art4
-# application/vnd.fujixerox.hbpl
-application/vnd.fujixerox.ddd ddd
-application/vnd.fujixerox.docuworks xdw
-application/vnd.fujixerox.docuworks.binder xbd
-# application/vnd.fut-misnet
-application/vnd.fuzzysheet fzs
-application/vnd.genomatix.tuxedo txd
-# application/vnd.geocube+xml
-application/vnd.geogebra.file ggb
-application/vnd.geogebra.tool ggt
-application/vnd.geometry-explorer gex gre
-application/vnd.geonext gxt
-application/vnd.geoplan g2w
-application/vnd.geospace g3w
-# application/vnd.globalplatform.card-content-mgt
-# application/vnd.globalplatform.card-content-mgt-response
-application/vnd.gmx gmx
-application/vnd.google-earth.kml+xml kml
-application/vnd.google-earth.kmz kmz
-application/vnd.grafeq gqf gqs
-# application/vnd.gridmp
-application/vnd.groove-account gac
-application/vnd.groove-help ghf
-application/vnd.groove-identity-message gim
-application/vnd.groove-injector grv
-application/vnd.groove-tool-message gtm
-application/vnd.groove-tool-template tpl
-application/vnd.groove-vcard vcg
-application/vnd.hal+xml hal
-application/vnd.handheld-entertainment+xml zmm
-application/vnd.hbci hbci
-# application/vnd.hcl-bireports
-application/vnd.hhe.lesson-player les
-application/vnd.hp-hpgl hpgl
-application/vnd.hp-hpid hpid
-application/vnd.hp-hps hps
-application/vnd.hp-jlyt jlt
-application/vnd.hp-pcl pcl
-application/vnd.hp-pclxl pclxl
-# application/vnd.httphone
-application/vnd.hydrostatix.sof-data sfd-hdstx
-application/vnd.hzn-3d-crossword x3d
-# application/vnd.ibm.afplinedata
-# application/vnd.ibm.electronic-media
-application/vnd.ibm.minipay mpy
-application/vnd.ibm.modcap afp listafp list3820
-application/vnd.ibm.rights-management irm
-application/vnd.ibm.secure-container sc
-application/vnd.iccprofile icc icm
-application/vnd.igloader igl
-application/vnd.immervision-ivp ivp
-application/vnd.immervision-ivu ivu
-# application/vnd.informedcontrol.rms+xml
-# application/vnd.informix-visionary
-# application/vnd.infotech.project
-# application/vnd.infotech.project+xml
-application/vnd.insors.igm igm
-application/vnd.intercon.formnet xpw xpx
-application/vnd.intergeo i2g
-# application/vnd.intertrust.digibox
-# application/vnd.intertrust.nncp
-application/vnd.intu.qbo qbo
-application/vnd.intu.qfx qfx
-# application/vnd.iptc.g2.conceptitem+xml
-# application/vnd.iptc.g2.knowledgeitem+xml
-# application/vnd.iptc.g2.newsitem+xml
-# application/vnd.iptc.g2.packageitem+xml
-application/vnd.ipunplugged.rcprofile rcprofile
-application/vnd.irepository.package+xml irp
-application/vnd.is-xpr xpr
-application/vnd.isac.fcs fcs
-application/vnd.jam jam
-# application/vnd.japannet-directory-service
-# application/vnd.japannet-jpnstore-wakeup
-# application/vnd.japannet-payment-wakeup
-# application/vnd.japannet-registration
-# application/vnd.japannet-registration-wakeup
-# application/vnd.japannet-setstore-wakeup
-# application/vnd.japannet-verification
-# application/vnd.japannet-verification-wakeup
-application/vnd.jcp.javame.midlet-rms rms
-application/vnd.jisp jisp
-application/vnd.joost.joda-archive joda
-application/vnd.kahootz ktz ktr
-application/vnd.kde.karbon karbon
-application/vnd.kde.kchart chrt
-application/vnd.kde.kformula kfo
-application/vnd.kde.kivio flw
-application/vnd.kde.kontour kon
-application/vnd.kde.kpresenter kpr kpt
-application/vnd.kde.kspread ksp
-application/vnd.kde.kword kwd kwt
-application/vnd.kenameaapp htke
-application/vnd.kidspiration kia
-application/vnd.kinar kne knp
-application/vnd.koan skp skd skt skm
-application/vnd.kodak-descriptor sse
-application/vnd.las.las+xml lasxml
-# application/vnd.liberty-request+xml
-application/vnd.llamagraphics.life-balance.desktop lbd
-application/vnd.llamagraphics.life-balance.exchange+xml lbe
-application/vnd.lotus-1-2-3 123
-application/vnd.lotus-approach apr
-application/vnd.lotus-freelance pre
-application/vnd.lotus-notes nsf
-application/vnd.lotus-organizer org
-application/vnd.lotus-screencam scm
-application/vnd.lotus-wordpro lwp
-application/vnd.macports.portpkg portpkg
-# application/vnd.marlin.drm.actiontoken+xml
-# application/vnd.marlin.drm.conftoken+xml
-# application/vnd.marlin.drm.license+xml
-# application/vnd.marlin.drm.mdcf
-application/vnd.mcd mcd
-application/vnd.medcalcdata mc1
-application/vnd.mediastation.cdkey cdkey
-# application/vnd.meridian-slingshot
-application/vnd.mfer mwf
-application/vnd.mfmp mfm
-application/vnd.micrografx.flo flo
-application/vnd.micrografx.igx igx
-application/vnd.mif mif
-# application/vnd.minisoft-hp3000-save
-# application/vnd.mitsubishi.misty-guard.trustweb
-application/vnd.mobius.daf daf
-application/vnd.mobius.dis dis
-application/vnd.mobius.mbk mbk
-application/vnd.mobius.mqy mqy
-application/vnd.mobius.msl msl
-application/vnd.mobius.plc plc
-application/vnd.mobius.txf txf
-application/vnd.mophun.application mpn
-application/vnd.mophun.certificate mpc
-# application/vnd.motorola.flexsuite
-# application/vnd.motorola.flexsuite.adsi
-# application/vnd.motorola.flexsuite.fis
-# application/vnd.motorola.flexsuite.gotap
-# application/vnd.motorola.flexsuite.kmr
-# application/vnd.motorola.flexsuite.ttc
-# application/vnd.motorola.flexsuite.wem
-# application/vnd.motorola.iprm
-application/vnd.mozilla.xul+xml xul
-application/vnd.ms-artgalry cil
-# application/vnd.ms-asf
-application/vnd.ms-cab-compressed cab
-application/vnd.ms-excel xls xlm xla xlc xlt xlw
-application/vnd.ms-excel.addin.macroenabled.12 xlam
-application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb
-application/vnd.ms-excel.sheet.macroenabled.12 xlsm
-application/vnd.ms-excel.template.macroenabled.12 xltm
-application/vnd.ms-fontobject eot
-application/vnd.ms-htmlhelp chm
-application/vnd.ms-ims ims
-application/vnd.ms-lrm lrm
-# application/vnd.ms-office.activex+xml
-application/vnd.ms-officetheme thmx
-application/vnd.ms-pki.seccat cat
-application/vnd.ms-pki.stl stl
-# application/vnd.ms-playready.initiator+xml
-application/vnd.ms-powerpoint ppt pps pot
-application/vnd.ms-powerpoint.addin.macroenabled.12 ppam
-application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
-application/vnd.ms-powerpoint.slide.macroenabled.12 sldm
-application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm
-application/vnd.ms-powerpoint.template.macroenabled.12 potm
-application/vnd.ms-project mpp mpt
-# application/vnd.ms-tnef
-# application/vnd.ms-wmdrm.lic-chlg-req
-# application/vnd.ms-wmdrm.lic-resp
-# application/vnd.ms-wmdrm.meter-chlg-req
-# application/vnd.ms-wmdrm.meter-resp
-application/vnd.ms-word.document.macroenabled.12 docm
-application/vnd.ms-word.template.macroenabled.12 dotm
-application/vnd.ms-works wps wks wcm wdb
-application/vnd.ms-wpl wpl
-application/vnd.ms-xpsdocument xps
-application/vnd.mseq mseq
-# application/vnd.msign
-# application/vnd.multiad.creator
-# application/vnd.multiad.creator.cif
-# application/vnd.music-niff
-application/vnd.musician mus
-application/vnd.muvee.style msty
-# application/vnd.ncd.control
-# application/vnd.ncd.reference
-# application/vnd.nervana
-# application/vnd.netfpx
-application/vnd.neurolanguage.nlu nlu
-application/vnd.noblenet-directory nnd
-application/vnd.noblenet-sealer nns
-application/vnd.noblenet-web nnw
-# application/vnd.nokia.catalogs
-# application/vnd.nokia.conml+wbxml
-# application/vnd.nokia.conml+xml
-# application/vnd.nokia.isds-radio-presets
-# application/vnd.nokia.iptv.config+xml
-# application/vnd.nokia.landmark+wbxml
-# application/vnd.nokia.landmark+xml
-# application/vnd.nokia.landmarkcollection+xml
-# application/vnd.nokia.n-gage.ac+xml
-application/vnd.nokia.n-gage.data ngdat
-application/vnd.nokia.n-gage.symbian.install n-gage
-# application/vnd.nokia.ncd
-# application/vnd.nokia.pcd+wbxml
-# application/vnd.nokia.pcd+xml
-application/vnd.nokia.radio-preset rpst
-application/vnd.nokia.radio-presets rpss
-application/vnd.novadigm.edm edm
-application/vnd.novadigm.edx edx
-application/vnd.novadigm.ext ext
-# application/vnd.ntt-local.file-transfer
-# application/vnd.ntt-local.sip-ta_remote
-# application/vnd.ntt-local.sip-ta_tcp_stream
-application/vnd.oasis.opendocument.chart odc
-application/vnd.oasis.opendocument.chart-template otc
-application/vnd.oasis.opendocument.database odb
-application/vnd.oasis.opendocument.formula odf
-application/vnd.oasis.opendocument.formula-template odft
-application/vnd.oasis.opendocument.graphics odg
-application/vnd.oasis.opendocument.graphics-template otg
-application/vnd.oasis.opendocument.image odi
-application/vnd.oasis.opendocument.image-template oti
-application/vnd.oasis.opendocument.presentation odp
-application/vnd.oasis.opendocument.presentation-template otp
-application/vnd.oasis.opendocument.spreadsheet ods
-application/vnd.oasis.opendocument.spreadsheet-template ots
-application/vnd.oasis.opendocument.text odt
-application/vnd.oasis.opendocument.text-master odm
-application/vnd.oasis.opendocument.text-template ott
-application/vnd.oasis.opendocument.text-web oth
-# application/vnd.obn
-# application/vnd.oipf.contentaccessdownload+xml
-# application/vnd.oipf.contentaccessstreaming+xml
-# application/vnd.oipf.cspg-hexbinary
-# application/vnd.oipf.dae.svg+xml
-# application/vnd.oipf.dae.xhtml+xml
-# application/vnd.oipf.mippvcontrolmessage+xml
-# application/vnd.oipf.pae.gem
-# application/vnd.oipf.spdiscovery+xml
-# application/vnd.oipf.spdlist+xml
-# application/vnd.oipf.ueprofile+xml
-# application/vnd.oipf.userprofile+xml
-application/vnd.olpc-sugar xo
-# application/vnd.oma-scws-config
-# application/vnd.oma-scws-http-request
-# application/vnd.oma-scws-http-response
-# application/vnd.oma.bcast.associated-procedure-parameter+xml
-# application/vnd.oma.bcast.drm-trigger+xml
-# application/vnd.oma.bcast.imd+xml
-# application/vnd.oma.bcast.ltkm
-# application/vnd.oma.bcast.notification+xml
-# application/vnd.oma.bcast.provisioningtrigger
-# application/vnd.oma.bcast.sgboot
-# application/vnd.oma.bcast.sgdd+xml
-# application/vnd.oma.bcast.sgdu
-# application/vnd.oma.bcast.simple-symbol-container
-# application/vnd.oma.bcast.smartcard-trigger+xml
-# application/vnd.oma.bcast.sprov+xml
-# application/vnd.oma.bcast.stkm
-# application/vnd.oma.cab-address-book+xml
-# application/vnd.oma.cab-pcc+xml
-# application/vnd.oma.dcd
-# application/vnd.oma.dcdc
-application/vnd.oma.dd2+xml dd2
-# application/vnd.oma.drm.risd+xml
-# application/vnd.oma.group-usage-list+xml
-# application/vnd.oma.poc.detailed-progress-report+xml
-# application/vnd.oma.poc.final-report+xml
-# application/vnd.oma.poc.groups+xml
-# application/vnd.oma.poc.invocation-descriptor+xml
-# application/vnd.oma.poc.optimized-progress-report+xml
-# application/vnd.oma.push
-# application/vnd.oma.scidm.messages+xml
-# application/vnd.oma.xcap-directory+xml
-# application/vnd.omads-email+xml
-# application/vnd.omads-file+xml
-# application/vnd.omads-folder+xml
-# application/vnd.omaloc-supl-init
-application/vnd.openofficeorg.extension oxt
-# application/vnd.openxmlformats-officedocument.custom-properties+xml
-# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
-# application/vnd.openxmlformats-officedocument.drawing+xml
-# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
-# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
-# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
-# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
-# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
-# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
-# application/vnd.openxmlformats-officedocument.extended-properties+xml
-# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
-# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
-# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
-# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
-# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
-application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
-# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
-# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
-application/vnd.openxmlformats-officedocument.presentationml.slide sldx
-# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
-# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
-# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
-application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
-# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
-# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
-# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
-# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
-application/vnd.openxmlformats-officedocument.presentationml.template potx
-# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
-# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
-# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
-application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
-# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
-# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
-# application/vnd.openxmlformats-officedocument.theme+xml
-# application/vnd.openxmlformats-officedocument.themeoverride+xml
-# application/vnd.openxmlformats-officedocument.vmldrawing
-# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
-application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
-# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
-application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
-# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
-# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
-# application/vnd.openxmlformats-package.core-properties+xml
-# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
-# application/vnd.openxmlformats-package.relationships+xml
-# application/vnd.quobject-quoxdocument
-# application/vnd.osa.netdeploy
-application/vnd.osgeo.mapguide.package mgp
-# application/vnd.osgi.bundle
-application/vnd.osgi.dp dp
-# application/vnd.otps.ct-kip+xml
-application/vnd.palm pdb pqa oprc
-# application/vnd.paos.xml
-application/vnd.pawaafile paw
-application/vnd.pg.format str
-application/vnd.pg.osasli ei6
-# application/vnd.piaccess.application-licence
-application/vnd.picsel efif
-application/vnd.pmi.widget wg
-# application/vnd.poc.group-advertisement+xml
-application/vnd.pocketlearn plf
-application/vnd.powerbuilder6 pbd
-# application/vnd.powerbuilder6-s
-# application/vnd.powerbuilder7
-# application/vnd.powerbuilder7-s
-# application/vnd.powerbuilder75
-# application/vnd.powerbuilder75-s
-# application/vnd.preminet
-application/vnd.previewsystems.box box
-application/vnd.proteus.magazine mgz
-application/vnd.publishare-delta-tree qps
-application/vnd.pvi.ptid1 ptid
-# application/vnd.pwg-multiplexed
-# application/vnd.pwg-xhtml-print+xml
-# application/vnd.qualcomm.brew-app-res
-application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
-# application/vnd.radisys.moml+xml
-# application/vnd.radisys.msml+xml
-# application/vnd.radisys.msml-audit+xml
-# application/vnd.radisys.msml-audit-conf+xml
-# application/vnd.radisys.msml-audit-conn+xml
-# application/vnd.radisys.msml-audit-dialog+xml
-# application/vnd.radisys.msml-audit-stream+xml
-# application/vnd.radisys.msml-conf+xml
-# application/vnd.radisys.msml-dialog+xml
-# application/vnd.radisys.msml-dialog-base+xml
-# application/vnd.radisys.msml-dialog-fax-detect+xml
-# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
-# application/vnd.radisys.msml-dialog-group+xml
-# application/vnd.radisys.msml-dialog-speech+xml
-# application/vnd.radisys.msml-dialog-transform+xml
-# application/vnd.rainstor.data
-# application/vnd.rapid
-application/vnd.realvnc.bed bed
-application/vnd.recordare.musicxml mxl
-application/vnd.recordare.musicxml+xml musicxml
-# application/vnd.renlearn.rlprint
-application/vnd.rig.cryptonote cryptonote
-application/vnd.rim.cod cod
-application/vnd.rn-realmedia rm
-application/vnd.route66.link66+xml link66
-# application/vnd.ruckus.download
-# application/vnd.s3sms
-application/vnd.sailingtracker.track st
-# application/vnd.sbm.cid
-# application/vnd.sbm.mid2
-# application/vnd.scribus
-# application/vnd.sealed.3df
-# application/vnd.sealed.csf
-# application/vnd.sealed.doc
-# application/vnd.sealed.eml
-# application/vnd.sealed.mht
-# application/vnd.sealed.net
-# application/vnd.sealed.ppt
-# application/vnd.sealed.tiff
-# application/vnd.sealed.xls
-# application/vnd.sealedmedia.softseal.html
-# application/vnd.sealedmedia.softseal.pdf
-application/vnd.seemail see
-application/vnd.sema sema
-application/vnd.semd semd
-application/vnd.semf semf
-application/vnd.shana.informed.formdata ifm
-application/vnd.shana.informed.formtemplate itp
-application/vnd.shana.informed.interchange iif
-application/vnd.shana.informed.package ipk
-application/vnd.simtech-mindmapper twd twds
-application/vnd.smaf mmf
-# application/vnd.smart.notebook
-application/vnd.smart.teacher teacher
-# application/vnd.software602.filler.form+xml
-# application/vnd.software602.filler.form-xml-zip
-application/vnd.solent.sdkm+xml sdkm sdkd
-application/vnd.spotfire.dxp dxp
-application/vnd.spotfire.sfs sfs
-# application/vnd.sss-cod
-# application/vnd.sss-dtf
-# application/vnd.sss-ntf
-application/vnd.stardivision.calc sdc
-application/vnd.stardivision.draw sda
-application/vnd.stardivision.impress sdd
-application/vnd.stardivision.math smf
-application/vnd.stardivision.writer sdw vor
-application/vnd.stardivision.writer-global sgl
-application/vnd.stepmania.stepchart sm
-# application/vnd.street-stream
-application/vnd.sun.xml.calc sxc
-application/vnd.sun.xml.calc.template stc
-application/vnd.sun.xml.draw sxd
-application/vnd.sun.xml.draw.template std
-application/vnd.sun.xml.impress sxi
-application/vnd.sun.xml.impress.template sti
-application/vnd.sun.xml.math sxm
-application/vnd.sun.xml.writer sxw
-application/vnd.sun.xml.writer.global sxg
-application/vnd.sun.xml.writer.template stw
-# application/vnd.sun.wadl+xml
-application/vnd.sus-calendar sus susp
-application/vnd.svd svd
-# application/vnd.swiftview-ics
-application/vnd.symbian.install sis sisx
-application/vnd.syncml+xml xsm
-application/vnd.syncml.dm+wbxml bdm
-application/vnd.syncml.dm+xml xdm
-# application/vnd.syncml.dm.notification
-# application/vnd.syncml.ds.notification
-application/vnd.tao.intent-module-archive tao
-application/vnd.tmobile-livetv tmo
-application/vnd.trid.tpt tpt
-application/vnd.triscape.mxs mxs
-application/vnd.trueapp tra
-# application/vnd.truedoc
-# application/vnd.ubisoft.webplayer
-application/vnd.ufdl ufd ufdl
-application/vnd.uiq.theme utz
-application/vnd.umajin umj
-application/vnd.unity unityweb
-application/vnd.uoml+xml uoml
-# application/vnd.uplanet.alert
-# application/vnd.uplanet.alert-wbxml
-# application/vnd.uplanet.bearer-choice
-# application/vnd.uplanet.bearer-choice-wbxml
-# application/vnd.uplanet.cacheop
-# application/vnd.uplanet.cacheop-wbxml
-# application/vnd.uplanet.channel
-# application/vnd.uplanet.channel-wbxml
-# application/vnd.uplanet.list
-# application/vnd.uplanet.list-wbxml
-# application/vnd.uplanet.listcmd
-# application/vnd.uplanet.listcmd-wbxml
-# application/vnd.uplanet.signal
-application/vnd.vcx vcx
-# application/vnd.vd-study
-# application/vnd.vectorworks
-# application/vnd.verimatrix.vcas
-# application/vnd.vidsoft.vidconference
-application/vnd.visio vsd vst vss vsw
-application/vnd.visionary vis
-# application/vnd.vividence.scriptfile
-application/vnd.vsf vsf
-# application/vnd.wap.sic
-# application/vnd.wap.slc
-application/vnd.wap.wbxml wbxml
-application/vnd.wap.wmlc wmlc
-application/vnd.wap.wmlscriptc wmlsc
-application/vnd.webturbo wtb
-# application/vnd.wfa.wsc
-# application/vnd.wmc
-# application/vnd.wmf.bootstrap
-# application/vnd.wolfram.mathematica
-# application/vnd.wolfram.mathematica.package
-application/vnd.wolfram.player nbp
-application/vnd.wordperfect wpd
-application/vnd.wqd wqd
-# application/vnd.wrq-hp3000-labelled
-application/vnd.wt.stf stf
-# application/vnd.wv.csp+wbxml
-# application/vnd.wv.csp+xml
-# application/vnd.wv.ssp+xml
-application/vnd.xara xar
-application/vnd.xfdl xfdl
-# application/vnd.xfdl.webform
-# application/vnd.xmi+xml
-# application/vnd.xmpie.cpkg
-# application/vnd.xmpie.dpkg
-# application/vnd.xmpie.plan
-# application/vnd.xmpie.ppkg
-# application/vnd.xmpie.xlim
-application/vnd.yamaha.hv-dic hvd
-application/vnd.yamaha.hv-script hvs
-application/vnd.yamaha.hv-voice hvp
-application/vnd.yamaha.openscoreformat osf
-application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg
-# application/vnd.yamaha.remote-setup
-application/vnd.yamaha.smaf-audio saf
-application/vnd.yamaha.smaf-phrase spf
-# application/vnd.yamaha.tunnel-udpencap
-application/vnd.yellowriver-custom-menu cmp
-application/vnd.zul zir zirz
-application/vnd.zzazz.deck+xml zaz
-application/voicexml+xml vxml
-# application/vq-rtcpxr
-# application/watcherinfo+xml
-# application/whoispp-query
-# application/whoispp-response
-application/widget wgt
-application/winhlp hlp
-# application/wita
-# application/wordperfect5.1
-application/wsdl+xml wsdl
-application/wspolicy+xml wspolicy
-application/x-7z-compressed 7z
-application/x-abiword abw
-application/x-ace-compressed ace
-application/x-authorware-bin aab x32 u32 vox
-application/x-authorware-map aam
-application/x-authorware-seg aas
-application/x-bcpio bcpio
-application/x-bittorrent torrent
-application/x-bzip bz
-application/x-bzip2 bz2 boz
-application/x-cdlink vcd
-application/x-chat chat
-application/x-chess-pgn pgn
-# application/x-compress
-application/x-cpio cpio
-application/x-csh csh
-application/x-debian-package deb udeb
-application/x-director dir dcr dxr cst cct cxt w3d fgd swa
-application/x-doom wad
-application/x-dtbncx+xml ncx
-application/x-dtbook+xml dtb
-application/x-dtbresource+xml res
-application/x-dvi dvi
-application/x-font-bdf bdf
-# application/x-font-dos
-# application/x-font-framemaker
-application/x-font-ghostscript gsf
-# application/x-font-libgrx
-application/x-font-linux-psf psf
-application/x-font-otf otf
-application/x-font-pcf pcf
-application/x-font-snf snf
-# application/x-font-speedo
-# application/x-font-sunos-news
-application/x-font-ttf ttf ttc
-application/x-font-type1 pfa pfb pfm afm
-application/x-font-woff woff
-# application/x-font-vfont
-application/x-futuresplash spl
-application/x-gnumeric gnumeric
-application/x-gtar gtar
-# application/x-gzip
-application/x-hdf hdf
-application/x-java-jnlp-file jnlp
-application/x-latex latex
-application/x-mobipocket-ebook prc mobi
-application/x-ms-application application
-application/x-ms-wmd wmd
-application/x-ms-wmz wmz
-application/x-ms-xbap xbap
-application/x-msaccess mdb
-application/x-msbinder obd
-application/x-mscardfile crd
-application/x-msclip clp
-application/x-msdownload exe dll com bat msi
-application/x-msmediaview mvb m13 m14
-application/x-msmetafile wmf
-application/x-msmoney mny
-application/x-mspublisher pub
-application/x-msschedule scd
-application/x-msterminal trm
-application/x-mswrite wri
-application/x-netcdf nc cdf
-application/x-pkcs12 p12 pfx
-application/x-pkcs7-certificates p7b spc
-application/x-pkcs7-certreqresp p7r
-application/x-rar-compressed rar
-application/x-sh sh
-application/x-shar shar
-application/x-shockwave-flash swf
-application/x-silverlight-app xap
-application/x-stuffit sit
-application/x-stuffitx sitx
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-tcl tcl
-application/x-tex tex
-application/x-tex-tfm tfm
-application/x-texinfo texinfo texi
-application/x-ustar ustar
-application/x-wais-source src
-application/x-x509-ca-cert der crt
-application/x-xfig fig
-application/x-xpinstall xpi
-# application/x400-bp
-# application/xcap-att+xml
-# application/xcap-caps+xml
-application/xcap-diff+xml xdf
-# application/xcap-el+xml
-# application/xcap-error+xml
-# application/xcap-ns+xml
-# application/xcon-conference-info-diff+xml
-# application/xcon-conference-info+xml
-application/xenc+xml xenc
-application/xhtml+xml xhtml xht
-# application/xhtml-voice+xml
-application/xml xml xsl
-application/xml-dtd dtd
-# application/xml-external-parsed-entity
-# application/xmpp+xml
-application/xop+xml xop
-application/xslt+xml xslt
-application/xspf+xml xspf
-application/xv+xml mxml xhvml xvml xvm
-application/yang yang
-application/yin+xml yin
-application/zip zip
-# audio/1d-interleaved-parityfec
-# audio/32kadpcm
-# audio/3gpp
-# audio/3gpp2
-# audio/ac3
-audio/adpcm adp
-# audio/amr
-# audio/amr-wb
-# audio/amr-wb+
-# audio/asc
-# audio/atrac-advanced-lossless
-# audio/atrac-x
-# audio/atrac3
-audio/basic au snd
-# audio/bv16
-# audio/bv32
-# audio/clearmode
-# audio/cn
-# audio/dat12
-# audio/dls
-# audio/dsr-es201108
-# audio/dsr-es202050
-# audio/dsr-es202211
-# audio/dsr-es202212
-# audio/dvi4
-# audio/eac3
-# audio/evrc
-# audio/evrc-qcp
-# audio/evrc0
-# audio/evrc1
-# audio/evrcb
-# audio/evrcb0
-# audio/evrcb1
-# audio/evrcwb
-# audio/evrcwb0
-# audio/evrcwb1
-# audio/example
-# audio/g719
-# audio/g722
-# audio/g7221
-# audio/g723
-# audio/g726-16
-# audio/g726-24
-# audio/g726-32
-# audio/g726-40
-# audio/g728
-# audio/g729
-# audio/g7291
-# audio/g729d
-# audio/g729e
-# audio/gsm
-# audio/gsm-efr
-# audio/gsm-hr-08
-# audio/ilbc
-# audio/l16
-# audio/l20
-# audio/l24
-# audio/l8
-# audio/lpc
-audio/midi mid midi kar rmi
-# audio/mobile-xmf
-audio/mp4 mp4a
-# audio/mp4a-latm
-# audio/mpa
-# audio/mpa-robust
-audio/mpeg mpga mp2 mp2a mp3 m2a m3a
-# audio/mpeg4-generic
-audio/ogg oga ogg spx
-# audio/parityfec
-# audio/pcma
-# audio/pcma-wb
-# audio/pcmu-wb
-# audio/pcmu
-# audio/prs.sid
-# audio/qcelp
-# audio/red
-# audio/rtp-enc-aescm128
-# audio/rtp-midi
-# audio/rtx
-# audio/smv
-# audio/smv0
-# audio/smv-qcp
-# audio/sp-midi
-# audio/speex
-# audio/t140c
-# audio/t38
-# audio/telephone-event
-# audio/tone
-# audio/uemclip
-# audio/ulpfec
-# audio/vdvi
-# audio/vmr-wb
-# audio/vnd.3gpp.iufp
-# audio/vnd.4sb
-# audio/vnd.audiokoz
-# audio/vnd.celp
-# audio/vnd.cisco.nse
-# audio/vnd.cmles.radio-events
-# audio/vnd.cns.anp1
-# audio/vnd.cns.inf1
-audio/vnd.dece.audio uva uvva
-audio/vnd.digital-winds eol
-# audio/vnd.dlna.adts
-# audio/vnd.dolby.heaac.1
-# audio/vnd.dolby.heaac.2
-# audio/vnd.dolby.mlp
-# audio/vnd.dolby.mps
-# audio/vnd.dolby.pl2
-# audio/vnd.dolby.pl2x
-# audio/vnd.dolby.pl2z
-# audio/vnd.dolby.pulse.1
-audio/vnd.dra dra
-audio/vnd.dts dts
-audio/vnd.dts.hd dtshd
-# audio/vnd.everad.plj
-# audio/vnd.hns.audio
-audio/vnd.lucent.voice lvp
-audio/vnd.ms-playready.media.pya pya
-# audio/vnd.nokia.mobile-xmf
-# audio/vnd.nortel.vbk
-audio/vnd.nuera.ecelp4800 ecelp4800
-audio/vnd.nuera.ecelp7470 ecelp7470
-audio/vnd.nuera.ecelp9600 ecelp9600
-# audio/vnd.octel.sbc
-# audio/vnd.qcelp
-# audio/vnd.rhetorex.32kadpcm
-audio/vnd.rip rip
-# audio/vnd.sealedmedia.softseal.mpeg
-# audio/vnd.vmx.cvsd
-# audio/vorbis
-# audio/vorbis-config
-audio/webm weba
-audio/x-aac aac
-audio/x-aiff aif aiff aifc
-audio/x-mpegurl m3u
-audio/x-ms-wax wax
-audio/x-ms-wma wma
-audio/x-pn-realaudio ram ra
-audio/x-pn-realaudio-plugin rmp
-audio/x-wav wav
-chemical/x-cdx cdx
-chemical/x-cif cif
-chemical/x-cmdf cmdf
-chemical/x-cml cml
-chemical/x-csml csml
-# chemical/x-pdb
-chemical/x-xyz xyz
-image/bmp bmp
-image/cgm cgm
-# image/example
-# image/fits
-image/g3fax g3
-image/gif gif
-image/ief ief
-# image/jp2
-image/jpeg jpeg jpg jpe
-# image/jpm
-# image/jpx
-image/ktx ktx
-# image/naplps
-image/png png
-image/prs.btif btif
-# image/prs.pti
-image/svg+xml svg svgz
-# image/t38
-image/tiff tiff tif
-# image/tiff-fx
-image/vnd.adobe.photoshop psd
-# image/vnd.cns.inf2
-image/vnd.dece.graphic uvi uvvi uvg uvvg
-image/vnd.dvb.subtitle sub
-image/vnd.djvu djvu djv
-image/vnd.dwg dwg
-image/vnd.dxf dxf
-image/vnd.fastbidsheet fbs
-image/vnd.fpx fpx
-image/vnd.fst fst
-image/vnd.fujixerox.edmics-mmr mmr
-image/vnd.fujixerox.edmics-rlc rlc
-# image/vnd.globalgraphics.pgb
-# image/vnd.microsoft.icon
-# image/vnd.mix
-image/vnd.ms-modi mdi
-image/vnd.net-fpx npx
-# image/vnd.radiance
-# image/vnd.sealed.png
-# image/vnd.sealedmedia.softseal.gif
-# image/vnd.sealedmedia.softseal.jpg
-# image/vnd.svf
-image/vnd.wap.wbmp wbmp
-image/vnd.xiff xif
-image/webp webp
-image/x-cmu-raster ras
-image/x-cmx cmx
-image/x-freehand fh fhc fh4 fh5 fh7
-image/x-icon ico
-image/x-pcx pcx
-image/x-pict pic pct
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-rgb rgb
-image/x-xbitmap xbm
-image/x-xpixmap xpm
-image/x-xwindowdump xwd
-# message/cpim
-# message/delivery-status
-# message/disposition-notification
-# message/example
-# message/external-body
-# message/feedback-report
-# message/global
-# message/global-delivery-status
-# message/global-disposition-notification
-# message/global-headers
-# message/http
-# message/imdn+xml
-# message/news
-# message/partial
-message/rfc822 eml mime
-# message/s-http
-# message/sip
-# message/sipfrag
-# message/tracking-status
-# message/vnd.si.simp
-# model/example
-model/iges igs iges
-model/mesh msh mesh silo
-model/vnd.collada+xml dae
-model/vnd.dwf dwf
-# model/vnd.flatland.3dml
-model/vnd.gdl gdl
-# model/vnd.gs-gdl
-# model/vnd.gs.gdl
-model/vnd.gtw gtw
-# model/vnd.moml+xml
-model/vnd.mts mts
-# model/vnd.parasolid.transmit.binary
-# model/vnd.parasolid.transmit.text
-model/vnd.vtu vtu
-model/vrml wrl vrml
-# multipart/alternative
-# multipart/appledouble
-# multipart/byteranges
-# multipart/digest
-# multipart/encrypted
-# multipart/example
-# multipart/form-data
-# multipart/header-set
-# multipart/mixed
-# multipart/parallel
-# multipart/related
-# multipart/report
-# multipart/signed
-# multipart/voice-message
-# text/1d-interleaved-parityfec
-text/calendar ics ifb
-text/css css
-text/csv csv
-# text/directory
-# text/dns
-# text/ecmascript
-# text/enriched
-# text/example
-text/html html htm
-# text/javascript
-text/n3 n3
-# text/parityfec
-text/plain txt text conf def list log in
-# text/prs.fallenstein.rst
-text/prs.lines.tag dsc
-# text/vnd.radisys.msml-basic-layout
-# text/red
-# text/rfc822-headers
-text/richtext rtx
-# text/rtf
-# text/rtp-enc-aescm128
-# text/rtx
-text/sgml sgml sgm
-# text/t140
-text/tab-separated-values tsv
-text/troff t tr roff man me ms
-text/turtle ttl
-# text/ulpfec
-text/uri-list uri uris urls
-# text/vnd.abc
-text/vnd.curl curl
-text/vnd.curl.dcurl dcurl
-text/vnd.curl.scurl scurl
-text/vnd.curl.mcurl mcurl
-# text/vnd.dmclientscript
-# text/vnd.esmertec.theme-descriptor
-text/vnd.fly fly
-text/vnd.fmi.flexstor flx
-text/vnd.graphviz gv
-text/vnd.in3d.3dml 3dml
-text/vnd.in3d.spot spot
-# text/vnd.iptc.newsml
-# text/vnd.iptc.nitf
-# text/vnd.latex-z
-# text/vnd.motorola.reflex
-# text/vnd.ms-mediapackage
-# text/vnd.net2phone.commcenter.command
-# text/vnd.si.uricatalogue
-text/vnd.sun.j2me.app-descriptor jad
-# text/vnd.trolltech.linguist
-# text/vnd.wap.si
-# text/vnd.wap.sl
-text/vnd.wap.wml wml
-text/vnd.wap.wmlscript wmls
-text/x-asm s asm
-text/x-c c cc cxx cpp h hh dic
-text/x-fortran f for f77 f90
-text/x-pascal p pas
-text/x-java-source java
-text/x-setext etx
-text/x-uuencode uu
-text/x-vcalendar vcs
-text/x-vcard vcf
-# text/xml
-# text/xml-external-parsed-entity
-# video/1d-interleaved-parityfec
-video/3gpp 3gp
-# video/3gpp-tt
-video/3gpp2 3g2
-# video/bmpeg
-# video/bt656
-# video/celb
-# video/dv
-# video/example
-video/h261 h261
-video/h263 h263
-# video/h263-1998
-# video/h263-2000
-video/h264 h264
-# video/h264-rcdo
-# video/h264-svc
-video/jpeg jpgv
-# video/jpeg2000
-video/jpm jpm jpgm
-video/mj2 mj2 mjp2
-# video/mp1s
-# video/mp2p
-# video/mp2t
-video/mp4 mp4 mp4v mpg4
-# video/mp4v-es
-video/mpeg mpeg mpg mpe m1v m2v
-# video/mpeg4-generic
-# video/mpv
-# video/nv
-video/ogg ogv
-# video/parityfec
-# video/pointer
-video/quicktime qt mov
-# video/raw
-# video/rtp-enc-aescm128
-# video/rtx
-# video/smpte292m
-# video/ulpfec
-# video/vc1
-# video/vnd.cctv
-video/vnd.dece.hd uvh uvvh
-video/vnd.dece.mobile uvm uvvm
-# video/vnd.dece.mp4
-video/vnd.dece.pd uvp uvvp
-video/vnd.dece.sd uvs uvvs
-video/vnd.dece.video uvv uvvv
-# video/vnd.directv.mpeg
-# video/vnd.directv.mpeg-tts
-# video/vnd.dlna.mpeg-tts
-video/vnd.fvt fvt
-# video/vnd.hns.video
-# video/vnd.iptvforum.1dparityfec-1010
-# video/vnd.iptvforum.1dparityfec-2005
-# video/vnd.iptvforum.2dparityfec-1010
-# video/vnd.iptvforum.2dparityfec-2005
-# video/vnd.iptvforum.ttsavc
-# video/vnd.iptvforum.ttsmpeg2
-# video/vnd.motorola.video
-# video/vnd.motorola.videop
-video/vnd.mpegurl mxu m4u
-video/vnd.ms-playready.media.pyv pyv
-# video/vnd.nokia.interleaved-multimedia
-# video/vnd.nokia.videovoip
-# video/vnd.objectvideo
-# video/vnd.sealed.mpeg1
-# video/vnd.sealed.mpeg4
-# video/vnd.sealed.swf
-# video/vnd.sealedmedia.softseal.mov
-video/vnd.uvvu.mp4 uvu uvvu
-video/vnd.vivo viv
-video/webm webm
-video/x-f4v f4v
-video/x-fli fli
-video/x-flv flv
-video/x-m4v m4v
-video/x-ms-asf asf asx
-video/x-ms-wm wm
-video/x-ms-wmv wmv
-video/x-ms-wmx wmx
-video/x-ms-wvx wvx
-video/x-msvideo avi
-video/x-sgi-movie movie
-x-conference/x-cooltalk ice
diff --git a/examples/cross-domain/node_modules/connect/node_modules/mime/types/node.types b/examples/cross-domain/node_modules/connect/node_modules/mime/types/node.types
deleted file mode 100644
index fdabaa4..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/mime/types/node.types
+++ /dev/null
@@ -1,43 +0,0 @@
-# What: Google Chrome Extension
-# Why: To allow apps to (work) be served with the right content type header.
-# http://codereview.chromium.org/2830017
-# Added by: niftylettuce
-application/x-chrome-extension crx
-
-# What: OTF Message Silencer
-# Why: To silence the "Resource interpreted as font but transferred with MIME
-# type font/otf" message that occurs in Google Chrome
-# Added by: niftylettuce
-font/opentype otf
-
-# What: HTC support
-# Why: To properly render .htc files such as CSS3PIE
-# Added by: niftylettuce
-text/x-component htc
-
-# What: HTML5 application cache manifest
-# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
-# per https://developer.mozilla.org/en/offline_resources_in_firefox
-# Added by: louisremi
-text/cache-manifest appcache manifest
-
-# What: node binary buffer format
-# Why: semi-standard extension w/in the node community
-# Added by: tootallnate
-application/octet-stream buffer
-
-# What: The "protected" MP-4 formats used by iTunes.
-# Why: Required for streaming music to browsers (?)
-# Added by: broofa
-application/mp4 m4p
-audio/mp4 m4a
-
-# What: Music playlist format (http://en.wikipedia.org/wiki/M3U)
-# Why: See https://github.com/bentomas/node-mime/pull/6
-# Added by: mjrusso
-application/x-mpegURL m3u8
-
-# What: Video format, Part of RFC1890
-# Why: See https://github.com/bentomas/node-mime/pull/6
-# Added by: mjrusso
-video/MP2T ts
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/.gitmodules b/examples/cross-domain/node_modules/connect/node_modules/qs/.gitmodules
deleted file mode 100644
index 49e31da..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "support/expresso"]
- path = support/expresso
- url = git://github.com/visionmedia/expresso.git
-[submodule "support/should"]
- path = support/should
- url = git://github.com/visionmedia/should.js.git
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/.npmignore b/examples/cross-domain/node_modules/connect/node_modules/qs/.npmignore
deleted file mode 100644
index 3c3629e..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/.travis.yml b/examples/cross-domain/node_modules/connect/node_modules/qs/.travis.yml
deleted file mode 100644
index 2c0a8f6..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: node_js
-node_js:
- - 0.6
- - 0.4 \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/History.md b/examples/cross-domain/node_modules/connect/node_modules/qs/History.md
deleted file mode 100644
index 3eaf7df..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/History.md
+++ /dev/null
@@ -1,73 +0,0 @@
-
-0.4.2 / 2012-02-08
-==================
-
- * Fixed: ensure objects are created when appropriate not arrays [aheckmann]
-
-0.4.1 / 2012-01-26
-==================
-
- * Fixed stringify()ing numbers. Closes #23
-
-0.4.0 / 2011-11-21
-==================
-
- * Allow parsing of an existing object (for `bodyParser()`) [jackyz]
- * Replaced expresso with mocha
-
-0.3.2 / 2011-11-08
-==================
-
- * Fixed global variable leak
-
-0.3.1 / 2011-08-17
-==================
-
- * Added `try/catch` around malformed uri components
- * Add test coverage for Array native method bleed-though
-
-0.3.0 / 2011-07-19
-==================
-
- * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart]
-
-0.2.0 / 2011-06-29
-==================
-
- * Added `qs.stringify()` [Cory Forsyth]
-
-0.1.0 / 2011-04-13
-==================
-
- * Added jQuery-ish array support
-
-0.0.7 / 2011-03-13
-==================
-
- * Fixed; handle empty string and `== null` in `qs.parse()` [dmit]
- allows for convenient `qs.parse(url.parse(str).query)`
-
-0.0.6 / 2011-02-14
-==================
-
- * Fixed; support for implicit arrays
-
-0.0.4 / 2011-02-09
-==================
-
- * Fixed `+` as a space
-
-0.0.3 / 2011-02-08
-==================
-
- * Fixed case when right-hand value contains "]"
-
-0.0.2 / 2011-02-07
-==================
-
- * Fixed "=" presence in key
-
-0.0.1 / 2011-02-07
-==================
-
- * Initial release \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/Makefile b/examples/cross-domain/node_modules/connect/node_modules/qs/Makefile
deleted file mode 100644
index e4df837..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-
-test:
- @./node_modules/.bin/mocha
-
-.PHONY: test \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/Readme.md b/examples/cross-domain/node_modules/connect/node_modules/qs/Readme.md
deleted file mode 100644
index db0d145..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/Readme.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# node-querystring
-
- query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.
-
-## Installation
-
- $ npm install qs
-
-## Examples
-
-```js
-var qs = require('qs');
-
-qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');
-// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }
-
-qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})
-// => user[name]=Tobi&user[email]=tobi%40learnboost.com
-```
-
-## Testing
-
-Install dev dependencies:
-
- $ npm install -d
-
-and execute:
-
- $ make test
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/benchmark.js b/examples/cross-domain/node_modules/connect/node_modules/qs/benchmark.js
deleted file mode 100644
index 97e2c93..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/benchmark.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-var qs = require('./');
-
-var times = 100000
- , start = new Date
- , n = times;
-
-console.log('times: %d', times);
-
-while (n--) qs.parse('foo=bar');
-console.log('simple: %dms', new Date - start);
-
-var start = new Date
- , n = times;
-
-while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log('nested: %dms', new Date - start); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/examples.js b/examples/cross-domain/node_modules/connect/node_modules/qs/examples.js
deleted file mode 100644
index 27617b7..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/examples.js
+++ /dev/null
@@ -1,51 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('./');
-
-var obj = qs.parse('foo');
-console.log(obj)
-
-var obj = qs.parse('foo=bar=baz');
-console.log(obj)
-
-var obj = qs.parse('users[]');
-console.log(obj)
-
-var obj = qs.parse('name=tj&email=tj@vision-media.ca');
-console.log(obj)
-
-var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
-console.log(obj)
-
-var obj = qs.parse('a=a&a=b&a=c');
-console.log(obj)
-
-var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
-console.log(obj)
-
-var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[1]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[]=TJ');
-console.log(obj)
-
-var obj = qs.parse('user[0]=tj&user[foo]=TJ');
-console.log(obj)
-
-var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }});
-console.log(str); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/index.js b/examples/cross-domain/node_modules/connect/node_modules/qs/index.js
deleted file mode 100644
index d177d20..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/querystring'); \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/lib/querystring.js b/examples/cross-domain/node_modules/connect/node_modules/qs/lib/querystring.js
deleted file mode 100644
index 6c72712..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/lib/querystring.js
+++ /dev/null
@@ -1,264 +0,0 @@
-
-/*!
- * querystring
- * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Library version.
- */
-
-exports.version = '0.4.2';
-
-/**
- * Object#toString() ref for stringify().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Cache non-integer test regexp.
- */
-
-var isint = /^[0-9]+$/;
-
-function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {};
- var t = {};
- for (var i in parent[key]) t[i] = parent[key][i];
- parent[key] = t;
- return t;
-}
-
-function parse(parts, parent, key, val) {
- var part = parts.shift();
- // end
- if (!part) {
- if (Array.isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else if ('undefined' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else {
- var obj = parent[key] = parent[key] || [];
- if (']' == part) {
- if (Array.isArray(obj)) {
- if ('' != val) obj.push(val);
- } else if ('object' == typeof obj) {
- obj[Object.keys(obj).length] = val;
- } else {
- obj = parent[key] = [parent[key], val];
- }
- // prop
- } else if (~part.indexOf(']')) {
- part = part.substr(0, part.length - 1);
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- // key
- } else {
- if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- }
- }
-}
-
-/**
- * Merge parent key/val pair.
- */
-
-function merge(parent, key, val){
- if (~key.indexOf(']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
- parse(parts, parent, 'base', val);
- // optimize
- } else {
- if (!isint.test(key) && Array.isArray(parent.base)) {
- var t = {};
- for (var k in parent.base) t[k] = parent.base[k];
- parent.base = t;
- }
- set(parent.base, key, val);
- }
-
- return parent;
-}
-
-/**
- * Parse the given obj.
- */
-
-function parseObject(obj){
- var ret = { base: {} };
- Object.keys(obj).forEach(function(name){
- merge(ret, name, obj[name]);
- });
- return ret.base;
-}
-
-/**
- * Parse the given str.
- */
-
-function parseString(str){
- return String(str)
- .split('&')
- .reduce(function(ret, pair){
- try{
- pair = decodeURIComponent(pair.replace(/\+/g, ' '));
- } catch(e) {
- // ignore
- }
-
- var eql = pair.indexOf('=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(val.indexOf('=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
-
- return merge(ret, key, val);
- }, { base: {} }).base;
-}
-
-/**
- * Parse the given query `str` or `obj`, returning an object.
- *
- * @param {String} str | {Object} obj
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str){
- if (null == str || '' == str) return {};
- return 'object' == typeof str
- ? parseObject(str)
- : parseString(str);
-};
-
-/**
- * Turn the given `obj` into a query string
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
-
-var stringify = exports.stringify = function(obj, prefix) {
- if (Array.isArray(obj)) {
- return stringifyArray(obj, prefix);
- } else if ('[object Object]' == toString.call(obj)) {
- return stringifyObject(obj, prefix);
- } else if ('string' == typeof obj) {
- return stringifyString(obj, prefix);
- } else {
- return prefix + '=' + obj;
- }
-};
-
-/**
- * Stringify the given `str`.
- *
- * @param {String} str
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyString(str, prefix) {
- if (!prefix) throw new TypeError('stringify expects an object');
- return prefix + '=' + encodeURIComponent(str);
-}
-
-/**
- * Stringify the given `arr`.
- *
- * @param {Array} arr
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyArray(arr, prefix) {
- var ret = [];
- if (!prefix) throw new TypeError('stringify expects an object');
- for (var i = 0; i < arr.length; i++) {
- ret.push(stringify(arr[i], prefix + '[]'));
- }
- return ret.join('&');
-}
-
-/**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyObject(obj, prefix) {
- var ret = []
- , keys = Object.keys(obj)
- , key;
-
- for (var i = 0, len = keys.length; i < len; ++i) {
- key = keys[i];
- ret.push(stringify(obj[key], prefix
- ? prefix + '[' + encodeURIComponent(key) + ']'
- : encodeURIComponent(key)));
- }
-
- return ret.join('&');
-}
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (undefined === v) {
- obj[key] = val;
- } else if (Array.isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/package.json b/examples/cross-domain/node_modules/connect/node_modules/qs/package.json
deleted file mode 100644
index dfb5a42..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "qs",
- "description": "querystring parser",
- "version": "0.4.2",
- "repository": {
- "type": "git",
- "url": "git://github.com/visionmedia/node-querystring.git"
- },
- "devDependencies": {
- "mocha": "*",
- "should": "*"
- },
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca",
- "url": "http://tjholowaychuk.com"
- },
- "main": "index",
- "engines": {
- "node": "*"
- },
- "_id": "qs@0.4.2",
- "dependencies": {},
- "optionalDependencies": {},
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "d062885ede604961ae48191601fb1289cc9422e3"
- },
- "_from": "qs@0.4.2"
-}
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/test/mocha.opts b/examples/cross-domain/node_modules/connect/node_modules/qs/test/mocha.opts
deleted file mode 100644
index 521cbb2..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/test/mocha.opts
+++ /dev/null
@@ -1,2 +0,0 @@
---require should
---ui exports
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/test/parse.js b/examples/cross-domain/node_modules/connect/node_modules/qs/test/parse.js
deleted file mode 100644
index f219e27..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/test/parse.js
+++ /dev/null
@@ -1,167 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('../');
-
-module.exports = {
- 'test basics': function(){
- qs.parse('0=foo').should.eql({ '0': 'foo' });
-
- qs.parse('foo=c++')
- .should.eql({ foo: 'c ' });
-
- qs.parse('a[>=]=23')
- .should.eql({ a: { '>=': '23' }});
-
- qs.parse('a[<=>]==23')
- .should.eql({ a: { '<=>': '=23' }});
-
- qs.parse('a[==]=23')
- .should.eql({ a: { '==': '23' }});
-
- qs.parse('foo')
- .should.eql({ foo: '' });
-
- qs.parse('foo=bar')
- .should.eql({ foo: 'bar' });
-
- qs.parse('foo%3Dbar=baz')
- .should.eql({ foo: 'bar=baz' });
-
- qs.parse(' foo = bar = baz ')
- .should.eql({ ' foo ': ' bar = baz ' });
-
- qs.parse('foo=bar=baz')
- .should.eql({ foo: 'bar=baz' });
-
- qs.parse('foo=bar&bar=baz')
- .should.eql({ foo: 'bar', bar: 'baz' });
-
- qs.parse('foo=bar&baz')
- .should.eql({ foo: 'bar', baz: '' });
-
- qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World')
- .should.eql({
- cht: 'p3'
- , chd: 't:60,40'
- , chs: '250x100'
- , chl: 'Hello|World'
- });
- },
-
- 'test nesting': function(){
- qs.parse('ops[>=]=25')
- .should.eql({ ops: { '>=': '25' }});
-
- qs.parse('user[name]=tj')
- .should.eql({ user: { name: 'tj' }});
-
- qs.parse('user[name][first]=tj&user[name][last]=holowaychuk')
- .should.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}});
- },
-
- 'test escaping': function(){
- qs.parse('foo=foo%20bar')
- .should.eql({ foo: 'foo bar' });
- },
-
- 'test arrays': function(){
- qs.parse('images[]')
- .should.eql({ images: [] });
-
- qs.parse('user[]=tj')
- .should.eql({ user: ['tj'] });
-
- qs.parse('user[]=tj&user[]=tobi&user[]=jane')
- .should.eql({ user: ['tj', 'tobi', 'jane'] });
-
- qs.parse('user[names][]=tj&user[names][]=tyler')
- .should.eql({ user: { names: ['tj', 'tyler'] }});
-
- qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca')
- .should.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }});
-
- qs.parse('items=a&items=b')
- .should.eql({ items: ['a', 'b'] });
-
- qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ')
- .should.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }});
-
- qs.parse('user[name][first]=tj&user[name][first]=TJ')
- .should.eql({ user: { name: { first: ['tj', 'TJ'] }}});
-
- var o = qs.parse('existing[fcbaebfecc][name][last]=tj')
- o.should.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}})
- Array.isArray(o.existing).should.be.false;
- },
-
- 'test right-hand brackets': function(){
- qs.parse('pets=["tobi"]')
- .should.eql({ pets: '["tobi"]' });
-
- qs.parse('operators=[">=", "<="]')
- .should.eql({ operators: '[">=", "<="]' });
-
- qs.parse('op[>=]=[1,2,3]')
- .should.eql({ op: { '>=': '[1,2,3]' }});
-
- qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]')
- .should.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }});
- },
-
- 'test duplicates': function(){
- qs.parse('items=bar&items=baz&items=raz')
- .should.eql({ items: ['bar', 'baz', 'raz'] });
- },
-
- 'test empty': function(){
- qs.parse('').should.eql({});
- qs.parse(undefined).should.eql({});
- qs.parse(null).should.eql({});
- },
-
- 'test arrays with indexes': function(){
- qs.parse('foo[0]=bar&foo[1]=baz').should.eql({ foo: ['bar', 'baz'] });
- qs.parse('foo[1]=bar&foo[0]=baz').should.eql({ foo: ['baz', 'bar'] });
- qs.parse('foo[base64]=RAWR').should.eql({ foo: { base64: 'RAWR' }});
- qs.parse('foo[64base]=RAWR').should.eql({ foo: { '64base': 'RAWR' }});
- },
-
- 'test arrays becoming objects': function(){
- qs.parse('foo[0]=bar&foo[bad]=baz').should.eql({ foo: { 0: "bar", bad: "baz" }});
- qs.parse('foo[bad]=baz&foo[0]=bar').should.eql({ foo: { 0: "bar", bad: "baz" }});
- },
-
- 'test bleed-through of Array native properties/methods': function(){
- Array.prototype.protoProperty = true;
- Array.prototype.protoFunction = function () {};
- qs.parse('foo=bar').should.eql({ foo: 'bar' });
- },
-
- 'test malformed uri': function(){
- qs.parse('{%:%}').should.eql({ '{%:%}': '' });
- qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' });
- },
-
- 'test semi-parsed': function(){
- qs.parse({ 'user[name]': 'tobi' })
- .should.eql({ user: { name: 'tobi' }});
-
- qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' })
- .should.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }});
- }
-
- // 'test complex': function(){
- // qs.parse('users[][name][first]=tj&users[foo]=bar')
- // .should.eql({
- // users: [ { name: 'tj' }, { name: 'tobi' }, { foo: 'bar' }]
- // });
- //
- // qs.parse('users[][name][first]=tj&users[][name][first]=tobi')
- // .should.eql({
- // users: [ { name: 'tj' }, { name: 'tobi' }]
- // });
- // }
-};
diff --git a/examples/cross-domain/node_modules/connect/node_modules/qs/test/stringify.js b/examples/cross-domain/node_modules/connect/node_modules/qs/test/stringify.js
deleted file mode 100644
index c2195cb..0000000
--- a/examples/cross-domain/node_modules/connect/node_modules/qs/test/stringify.js
+++ /dev/null
@@ -1,103 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var qs = require('../')
- , should = require('should')
- , str_identities = {
- 'basics': [
- { str: 'foo=bar', obj: {'foo' : 'bar'}},
- { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}},
- { str: 'foo=', obj: {'foo': ''}},
- { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}},
- { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}},
- { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}},
- { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}}
- ],
- 'escaping': [
- { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}},
- { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: {
- cht: 'p3'
- , chd: 't:60,40'
- , chs: '250x100'
- , chl: 'Hello|World'
- }}
- ],
- 'nested': [
- { str: 'foo[]=bar&foo[]=quux', obj: {'foo' : ['bar', 'quux']}},
- { str: 'foo[]=bar', obj: {foo: ['bar']}},
- { str: 'foo[]=1&foo[]=2', obj: {'foo' : ['1', '2']}},
- { str: 'foo=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}},
- { str: 'foo[]=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}},
- { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}},
- { str: 'x[y][z][]=1', obj: {'x' : {'y' : {'z' : ['1']}}}},
- { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}},
- { str: 'x[y][z][]=1&x[y][z][]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}},
- { str: 'x[y][][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}},
- { str: 'x[y][][z][]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}},
- { str: 'x[y][][z]=1&x[y][][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}},
- { str: 'x[y][][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}},
- { str: 'x[y][][z]=1&x[y][][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}},
- { str: 'x[y][][z]=1&x[y][][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}},
- { str: 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}},
- { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}}
- ],
- 'errors': [
- { obj: 'foo=bar', message: 'stringify expects an object' },
- { obj: ['foo', 'bar'], message: 'stringify expects an object' }
- ],
- 'numbers': [
- { str: 'limit[]=1&limit[]=2&limit[]=3', obj: { limit: [1, 2, '3'] }},
- { str: 'limit=1', obj: { limit: 1 }}
- ]
- };
-
-
-// Assert error
-function err(fn, msg){
- var err;
- try {
- fn();
- } catch (e) {
- should.equal(e.message, msg);
- return;
- }
- throw new Error('no exception thrown, expected "' + msg + '"');
-}
-
-function test(type) {
- var str, obj;
- for (var i = 0; i < str_identities[type].length; i++) {
- str = str_identities[type][i].str;
- obj = str_identities[type][i].obj;
- qs.stringify(obj).should.eql(str);
- }
-}
-
-module.exports = {
- 'test basics': function() {
- test('basics');
- },
-
- 'test escaping': function() {
- test('escaping');
- },
-
- 'test nested': function() {
- test('nested');
- },
-
- 'test numbers': function(){
- test('numbers');
- },
-
- 'test errors': function() {
- var obj, message;
- for (var i = 0; i < str_identities['errors'].length; i++) {
- message = str_identities['errors'][i].message;
- obj = str_identities['errors'][i].obj;
- err(function(){ qs.stringify(obj) }, message);
- }
- }
-}; \ No newline at end of file
diff --git a/examples/cross-domain/node_modules/connect/package.json b/examples/cross-domain/node_modules/connect/package.json
deleted file mode 100644
index cec287e..0000000
--- a/examples/cross-domain/node_modules/connect/package.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "name": "connect",
- "version": "2.2.1",
- "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.4.2",
- "mime": "1.2.4",
- "formidable": "1.0.9",
- "crc": "0.1.0",
- "debug": "*"
- },
- "devDependencies": {
- "should": "*",
- "mocha": "*",
- "jade": "*",
- "dox": "*"
- },
- "main": "index",
- "engines": {
- "node": ">= 0.5.0 < 0.7.0"
- },
- "_id": "connect@2.2.1",
- "optionalDependencies": {},
- "_engineSupported": true,
- "_npmVersion": "1.1.16",
- "_nodeVersion": "v0.6.15",
- "_defaultsLoaded": true,
- "dist": {
- "shasum": "ab39e3a18e1487cad990cae33b2bf04d6de9b19c"
- },
- "_from": "connect"
-}
diff --git a/examples/cross-domain/node_modules/connect/test.js b/examples/cross-domain/node_modules/connect/test.js
deleted file mode 100644
index 4887504..0000000
--- a/examples/cross-domain/node_modules/connect/test.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var connect = require('./');
-var app = connect();
-
-app.use(connect.static(__dirname + '/public'));
-app.use(connect.bodyParser());
-
-app.use(function(req, res){
- res.end('hey');
-});
-
-app.listen(3000); \ No newline at end of file
diff --git a/examples/cross-domain/package.json b/examples/cross-domain/package.json
index fee8e0b..a03f253 100644
--- a/examples/cross-domain/package.json
+++ b/examples/cross-domain/package.json
@@ -4,11 +4,12 @@
"scripts": {
"start": "server.js"
},
- "version": "0.0.0-11",
+ "version": "0.0.0-20",
"engines": {
"node": "0.6.x"
},
"dependencies": {
- "express": "2.5.x"
+ "express": "2.5.x",
+ "connect": "2.2.x"
}
} \ No newline at end of file
diff --git a/examples/cross-domain/server.js b/examples/cross-domain/server.js
index d0adf32..65117d1 100644
--- a/examples/cross-domain/server.js
+++ b/examples/cross-domain/server.js
@@ -1,28 +1,46 @@
-
var express = require('express');
+
+var connect = require('connect');
+// Custom csrf library
+var csrf = require('./csrf');
+
var app = express.createServer();
var allowCrossDomain = function(req, res, next) {
- res.header('Access-Control-Allow-Credentials', true);
- res.header('Access-Control-Allow-Origin', req.headers.origin)
- res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
- res.header('Access-Control-Allow-Headers', 'X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version');
- next();
+ // Added other domains you want the server to give access to
+ // WARNING - Be careful with what origins you give access to
+ var allowedHost = [
+ 'http://backbonetutorials.com',
+ 'http://localhost'
+ ];
+
+ if(allowedHost.indexOf(req.headers.origin) !== -1) {
+ res.header('Access-Control-Allow-Credentials', true);
+ res.header('Access-Control-Allow-Origin', req.headers.origin)
+ res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
+ res.header('Access-Control-Allow-Headers', 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version');
+ next();
+ } else {
+ res.send({auth: false});
+ }
}
app.configure(function() {
- app.use(express.cookieParser({cookie: { domain : "localhost" }}));
+ app.use(express.cookieParser());
app.use(express.session({ secret: 'thomasdavislovessalmon' }));
app.use(express.bodyParser());
app.use(allowCrossDomain);
+ app.use(csrf.check);
});
app.get('/session', function(req, res){
- // Check auth
+ // This checks the current users auth
+ // It runs before Backbones router is started
+ // we should return a csrf token for Backbone to use
if(typeof req.session.username !== 'undefined'){
- res.send({auth: true, id: req.session.id, username: req.session.username});
+ res.send({auth: true, id: req.session.id, username: req.session.username, _csrf: req.session._csrf});
} else {
- res.send({auth: false});
+ res.send({auth: false, _csrf: req.session._csrf});
}
});
@@ -30,16 +48,19 @@ app.post('/session', function(req, res){
// Login
// Here you would pull down your user credentials and match them up
// to the request
- var randomSessionId = Math.ceil(Math.random() * 100000);
- req.session.id = randomSessionId;
req.session.username = req.body.username;
res.send({auth: true, id: req.session.id, username: req.session.username});
});
app.del('/session/:id', function(req, res, next){
- // Logout
- req.session.destroy(function(err){
- res.send({auth: false});
+ // Logout by clearing the session
+ req.session.regenerate(function(err){
+ // Generate a new csrf token so the user can login again
+ // This is pretty hacky, connect.csrf isn't built for rest
+ // I will probably release a restful csrf module
+ csrf.generate(req, res, function () {
+ res.send({auth: false, _csrf: req.session._csrf});
+ });
});
});
diff --git a/examples/cross-domain/templates/layout.html b/examples/cross-domain/templates/layout.html
index 3b73d03..895b48f 100644
--- a/examples/cross-domain/templates/layout.html
+++ b/examples/cross-domain/templates/layout.html
@@ -1,6 +1,8 @@
<div class="header">
<h1>Cross-domain Backbone.js with sessions using CORS</h1>
- <em>Simply clone this repo and host it ANYWHERE to get it to work. Run the example server with `node server.js`. Make sure to change the baseUrl in app.js though!</em>
+ <p>Simply clone this repo and host it on `localhost` to get it to work. Run the example server with `node server.js`. Make sure to change the baseUrl in app.js though!</p>
+
+ <em>Notice that this page is separate from any server.</em>
</div>
<div style="clear: both;"></div>
<div class="page">